source: branches/0.4-stable/yat/classifier/CrossValidationSampler.h @ 1743

Last change on this file since 1743 was 1743, checked in by Peter, 12 years ago

updating copyright statements

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 2.1 KB
Line 
1#ifndef _theplu_yat_classifier_crossvalidation_sampler_
2#define _theplu_yat_classifier_crossvalidation_sampler_
3
4// $Id: CrossValidationSampler.h 1743 2009-01-23 14:20:30Z peter $
5
6/*
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
10
11  This file is part of the yat library, http://dev.thep.lu.se/yat
12
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.
17
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
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
29#include "Sampler.h"
30
31namespace theplu {
32namespace yat {
33namespace classifier {
34
35  class Target;
36
37  ///
38  /// @brief Class splitting a set into training set and validation
39  /// set in a crossvalidation manner.
40  ///
41  /// This is done in a balanced way, meaning
42  /// the proportions between the classes in the trainingset is close
43  /// to the proportions in the whole dataset. In the first \a k
44  /// rounds each sample is returned k-1 times, for next round the
45  /// samples are shuffled and... In total there are N partitions, in
46  /// other words, each sample is in validation roughly N/k
47  ///
48  class CrossValidationSampler : public Sampler
49  {
50
51  public:
52    ///
53    /// @brief Constructor
54    ///
55    /// @a target targets.   
56    /// @a N total number of partitions.
57    /// @a k for k-fold crossvalidation.
58    ///
59    CrossValidationSampler(const Target& target, const size_t N,const size_t k);
60
61    ///
62    /// Destructor
63    ///
64    virtual ~CrossValidationSampler();
65
66  private:
67    void build(const Target& target, size_t N, size_t k); 
68    const size_t k_;
69
70  };
71
72}}} // of namespace classifier, yat, and theplu
73
74#endif
75
Note: See TracBrowser for help on using the repository browser.