yat/classifier/Sampler.h

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