Last change
on this file since 460 was
460,
checked in by Peter, 17 years ago
|
changed name of class
|
-
Property svn:eol-style set to
native
-
Property svn:keywords set to
Author Date Id Revision
|
File size:
1.1 KB
|
Line | |
---|
1 | // $Id: CrossSplitting.h 460 2005-12-16 12:40:06Z peter $ |
---|
2 | |
---|
3 | #ifndef _theplu_classifier_cross_splitting_ |
---|
4 | #define _theplu_classifier_cross_splitting_ |
---|
5 | |
---|
6 | #include <vector> |
---|
7 | |
---|
8 | namespace theplu { |
---|
9 | namespace gslapi { |
---|
10 | class vector; |
---|
11 | } |
---|
12 | namespace classifier { |
---|
13 | |
---|
14 | /// |
---|
15 | /// Class splitting a set into training set and validation set in a |
---|
16 | /// crossvalidation manner. |
---|
17 | /// |
---|
18 | class CrossSplitting |
---|
19 | { |
---|
20 | |
---|
21 | public: |
---|
22 | /// |
---|
23 | /// Constructor taking \a target and \a k for k-fold cross validation |
---|
24 | /// |
---|
25 | CrossSplitting(const theplu::gslapi::vector& target, const size_t k = 3); |
---|
26 | |
---|
27 | /// |
---|
28 | /// Function generating a training set. This is done in a balanced |
---|
29 | /// way, meaning the proportions between the classes the |
---|
30 | /// trainingset is close to the proportions in the whole |
---|
31 | /// dataset. In the first \a k rounds each sample is returned k-1 |
---|
32 | /// times, for next round the samples are shuffled and... |
---|
33 | /// |
---|
34 | std::vector<size_t> next(); |
---|
35 | |
---|
36 | private: |
---|
37 | int count_; |
---|
38 | std::vector<size_t> index_negative_; |
---|
39 | std::vector<size_t> index_positive_; |
---|
40 | int k_; |
---|
41 | |
---|
42 | |
---|
43 | }; |
---|
44 | |
---|
45 | }} // of namespace classifier and namespace theplu |
---|
46 | |
---|
47 | #endif |
---|
48 | |
---|
Note: See
TracBrowser
for help on using the repository browser.