yat/classifier/CrossValidationSampler.h

Code
Comments
Other
Rev Date Author Line
4200 19 Aug 22 peter 1 #ifndef _theplu_yat_classifier_crossvalidation_sampler_
680 11 Oct 06 jari 2 #define _theplu_yat_classifier_crossvalidation_sampler_
612 30 Aug 06 peter 3
612 30 Aug 06 peter 4 // $Id$
612 30 Aug 06 peter 5
612 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
612 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
612 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.
612 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
612 30 Aug 06 peter 21   General Public License for more details.
612 30 Aug 06 peter 22
612 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/>.
612 30 Aug 06 peter 25 */
612 30 Aug 06 peter 26
680 11 Oct 06 jari 27 #include "Sampler.h"
612 30 Aug 06 peter 28
612 30 Aug 06 peter 29 namespace theplu {
680 11 Oct 06 jari 30 namespace yat {
823 19 Mar 07 peter 31 namespace classifier {
612 30 Aug 06 peter 32
613 30 Aug 06 markus 33   class Target;
613 30 Aug 06 markus 34
612 30 Aug 06 peter 35   ///
767 22 Feb 07 peter 36   /// @brief Class splitting a set into training set and validation
935 05 Oct 07 peter 37   /// set in a crossvalidation manner.
4200 19 Aug 22 peter 38   ///
935 05 Oct 07 peter 39   /// This is done in a balanced way, meaning
612 30 Aug 06 peter 40   /// the proportions between the classes in the trainingset is close
612 30 Aug 06 peter 41   /// to the proportions in the whole dataset. In the first \a k
612 30 Aug 06 peter 42   /// rounds each sample is returned k-1 times, for next round the
612 30 Aug 06 peter 43   /// samples are shuffled and... In total there are N partitions, in
612 30 Aug 06 peter 44   /// other words, each sample is in validation roughly N/k
4200 19 Aug 22 peter 45   ///
823 19 Mar 07 peter 46   class CrossValidationSampler : public Sampler
823 19 Mar 07 peter 47   {
823 19 Mar 07 peter 48
823 19 Mar 07 peter 49   public:
823 19 Mar 07 peter 50     ///
4200 19 Aug 22 peter 51     /// @brief Constructor
823 19 Mar 07 peter 52     ///
4200 19 Aug 22 peter 53     /// @a target targets.
645 08 Sep 06 markus 54     /// @a N total number of partitions.
645 08 Sep 06 markus 55     /// @a k for k-fold crossvalidation.
612 30 Aug 06 peter 56     ///
612 30 Aug 06 peter 57     CrossValidationSampler(const Target& target, const size_t N,const size_t k);
612 30 Aug 06 peter 58
612 30 Aug 06 peter 59     ///
612 30 Aug 06 peter 60     /// Destructor
612 30 Aug 06 peter 61     ///
612 30 Aug 06 peter 62     virtual ~CrossValidationSampler();
612 30 Aug 06 peter 63
612 30 Aug 06 peter 64   private:
4200 19 Aug 22 peter 65     void build(const Target& target, size_t N, size_t k);
612 30 Aug 06 peter 66     const size_t k_;
612 30 Aug 06 peter 67
612 30 Aug 06 peter 68   };
612 30 Aug 06 peter 69
680 11 Oct 06 jari 70 }}} // of namespace classifier, yat, and theplu
612 30 Aug 06 peter 71 #endif