source: trunk/yat/classifier/CrossValidationSampler.h @ 1189

Last change on this file since 1189 was 1000, checked in by Jari Häkkinen, 14 years ago

trac moved to new location.

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 2.0 KB
Line 
1#ifndef _theplu_yat_classifier_crossvalidation_sampler_
2#define _theplu_yat_classifier_crossvalidation_sampler_
3
4// $Id: CrossValidationSampler.h 1000 2007-12-23 20:09:15Z jari $
5
6/*
7  Copyright (C) 2006 Jari Häkkinen, Markus Ringnér, Peter Johansson
8  Copyright (C) 2007 Peter Johansson
9
10  This file is part of the yat library, http://trac.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 2 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 this program; if not, write to the Free Software
24  Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
25  02111-1307, USA.
26*/
27
28#include "Sampler.h"
29
30namespace theplu {
31namespace yat {
32namespace classifier {
33
34  class Target;
35
36  ///
37  /// @brief Class splitting a set into training set and validation
38  /// set in a crossvalidation manner.
39  ///
40  /// This is done in a balanced way, meaning
41  /// the proportions between the classes in the trainingset is close
42  /// to the proportions in the whole dataset. In the first \a k
43  /// rounds each sample is returned k-1 times, for next round the
44  /// samples are shuffled and... In total there are N partitions, in
45  /// other words, each sample is in validation roughly N/k
46  ///
47  class CrossValidationSampler : public Sampler
48  {
49
50  public:
51    ///
52    /// @brief Constructor
53    ///
54    /// @a target targets.   
55    /// @a N total number of partitions.
56    /// @a k for k-fold crossvalidation.
57    ///
58    CrossValidationSampler(const Target& target, const size_t N,const size_t k);
59
60    ///
61    /// Destructor
62    ///
63    virtual ~CrossValidationSampler();
64
65  private:
66    void build(const Target& target, size_t N, size_t k); 
67    const size_t k_;
68
69  };
70
71}}} // of namespace classifier, yat, and theplu
72
73#endif
74
Note: See TracBrowser for help on using the repository browser.