source: trunk/yat/classifier/Sampler.h @ 1437

Last change on this file since 1437 was 1437, checked in by Peter, 13 years ago

merge patch release 0.4.2 to trunk. Delta 0.4.2-0.4.1

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 2.7 KB
RevLine 
[680]1#ifndef _theplu_yat_classifier_sampler_
2#define _theplu_yat_classifier_sampler_
[610]3
4// $Id: Sampler.h 1437 2008-08-25 17:55:00Z peter $
5
6/*
[1275]7  Copyright (C) 2006 Jari Häkkinen, Peter Johansson, Markus Ringnér
8  Copyright (C) 2007 Jari Häkkinen, Peter Johansson
9  Copyright (C) 2008 Peter Johansson
[610]10
[1437]11  This file is part of the yat library, http://dev.thep.lu.se/yat
[610]12
[675]13  The yat library is free software; you can redistribute it and/or
14  modify it under the terms of the GNU General Public License as
15  published by the Free Software Foundation; either version 2 of the
16  License, or (at your option) any later version.
[610]17
[675]18  The yat library is distributed in the hope that it will be useful,
19  but WITHOUT ANY WARRANTY; without even the implied warranty of
20  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
[610]21  General Public License for more details.
22
23  You should have received a copy of the GNU General Public License
24  along with this program; if not, write to the Free Software
25  Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
26  02111-1307, USA.
27*/
28
[680]29#include "Target.h"
[1134]30#include "yat/utility/Index.h"
[610]31
32#include <vector>
33
34namespace theplu {
[680]35namespace yat {
[610]36namespace classifier { 
37
38  ///
[767]39  /// @brief Interface class for dividing samples into training and
40  /// validation.
[823]41  ///   
42  class Sampler
43  {
44
45  public:
46    ///
47    /// @brief Constructor
48    ///
[648]49    /// @param target used to balance partitions
[966]50    /// @param N Number of partitions
[610]51    ///
[823]52    Sampler(const Target& target, size_t N);
[610]53
54    ///
[613]55    /// Destructor (pure virtual destructor)
[610]56    ///
[613]57    virtual ~Sampler() =0;
[610]58
59    ///
60    /// @return number of partitions
61    ///
[1220]62    size_t size(void) const;
[610]63
64    ///
[613]65    /// @return the targets for the total set
[610]66    ///
[720]67    const Target& target(void) const;
[610]68
69    ///
[613]70    /// @return training indices
[610]71    ///
[1134]72    const utility::Index&
[1220]73    training_index(size_t i) const;
[610]74
75    ///
76    /// @return training target
77    ///
78    /// @note if state is invalid the result is undefined
79    ///
[1221]80    const Target& training_target(size_t i) const;
[610]81
82    ///
83    /// @return validation index
84    ///
85    /// @note if state is invalid the result is undefined
86    ///
[1221]87    const utility::Index& validation_index(size_t i) const;
[610]88
89    ///
90    /// @return validation target
91    ///
92    /// @note if state is invalid the result is undefined
93    ///
[1221]94    const Target& validation_target(size_t i) const;
[610]95
96  protected:
[648]97    /// index of training sets for the partitions
[1134]98    std::vector<utility::Index> training_index_;
[648]99    /// Targets for training sets for the partitions
[610]100    std::vector<Target> training_target_;
[648]101    /// index of validation sets for the partitions
[1134]102    std::vector<utility::Index> validation_index_;
[648]103    /// Targets for validation sets for the partitions
[610]104    std::vector<Target> validation_target_;
105
[1219]106  private:
107    Target target_;
[610]108  };
109
[680]110}}} // of namespace classifier, yat, and theplu
[610]111
112#endif
113
Note: See TracBrowser for help on using the repository browser.