source: trunk/yat/classifier/Sampler.h

Last change on this file was 2608, checked in by Peter, 10 years ago

delete trailing newlines

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