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

Last change on this file since 831 was 831, checked in by Peter, 15 years ago

Refs #185.

  • 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 831 2007-03-27 13:22:09Z peter $
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://lev.thep.lu.se/trac/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
39  /// crossvalidation manner. This is done in a balanced way, meaning
40  /// the proportions between the classes in the trainingset is close
41  /// to the proportions in the whole dataset. In the first \a k
42  /// rounds each sample is returned k-1 times, for next round the
43  /// samples are shuffled and... In total there are N partitions, in
44  /// other words, each sample is in validation roughly N/k
45  ///
46  class CrossValidationSampler : public Sampler
47  {
48
49  public:
50    ///
51    /// @brief Constructor
52    ///
53    /// @a target targets.   
54    /// @a N total number of partitions.
55    /// @a k for k-fold crossvalidation.
56    ///
57    CrossValidationSampler(const Target& target, const size_t N,const size_t k);
58
59    ///
60    /// Destructor
61    ///
62    virtual ~CrossValidationSampler();
63
64  private:
65    void build(const Target& target, size_t N, size_t k); 
66    const size_t k_;
67
68  };
69
70}}} // of namespace classifier, yat, and theplu
71
72#endif
73
Note: See TracBrowser for help on using the repository browser.