source: trunk/test/crossvalidation_test.cc @ 453

Last change on this file since 453 was 453, checked in by Peter, 17 years ago

changed namespace svm to classifier in test

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 797 bytes
Line 
1// $Id: crossvalidation_test.cc 453 2005-12-15 21:49:23Z peter $
2
3#include <c++_tools/classifier/CrossValidation.h>
4#include <c++_tools/gslapi/vector.h>
5
6#include <vector>
7#include <cstdlib>
8#include <iostream>
9
10using namespace theplu;
11
12int main()
13{ 
14
15  gslapi::vector target(10,1);
16  for (size_t i=0; i<5; i++) 
17    target(i)=-1;
18
19  classifier::CrossValidation cv(target,3);
20
21
22  std::vector<size_t> training_set;
23  std::vector<size_t> count(10);
24
25  training_set = cv.next();
26  for (unsigned int i=0; i<training_set.size(); i++) 
27    count[training_set[i]]++;
28 
29  training_set = cv.next();
30  for (unsigned int i=0; i<training_set.size(); i++) 
31    count[training_set[i]]++;
32
33  training_set = cv.next();
34  for (unsigned int i=0; i<training_set.size(); i++) 
35    count[training_set[i]]++;
36
37  for (unsigned int i=0; i<10 ; i++) 
38    if (count[i]!=2)
39      return -1;
40
41  return 0;
42}
Note: See TracBrowser for help on using the repository browser.