source: branches/peters_vector/test/consensus_inputranker_test.cc @ 470

Last change on this file since 470 was 470, checked in by Peter, 16 years ago

compiling 3 tests fail

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 1.3 KB
Line 
1// $Id: consensus_inputranker_test.cc 470 2005-12-19 19:46:50Z peter $
2
3// C++ tools include
4////////////////////
5#include <c++_tools/classifier/ConsensusInputRanker.h>
6#include <c++_tools/statistics/ROC.h>
7#include <c++_tools/gslapi/matrix.h>
8#include <c++_tools/classifier/MatrixLookup.h>
9#include <c++_tools/classifier/CrossSplitting.h>
10
11#include <cstdlib>
12#include <fstream>
13#include <iostream>
14//#include <vector>
15
16using namespace std;
17
18int main()
19{ 
20  ifstream is("data/rank_data.txt");
21  theplu::gslapi::matrix data_tmp(is);
22  theplu::classifier::MatrixLookup data(data_tmp);
23  is.close();
24
25  is.open("data/rank_target.txt");
26  theplu::classifier::Target target(is);
27  is.close();
28
29 
30  theplu::statistics::ROC roc;
31  theplu::classifier::CrossSplitting sampler(3);
32  theplu::classifier::ConsensusInputRanker cir(data,target,roc,sampler,30);
33
34  if (cir.id(0)!=2 || cir.id(1)!=0 || cir.id(2)!=1){
35    cerr << "wrong id" << endl;
36    return -1;
37  }
38 
39  if (cir.rank(0)!=1 || cir.rank(1)!=2 || cir.rank(2)!=0){
40    cerr << "wrong rank" << endl;
41    return -1;
42  }
43
44  theplu::gslapi::matrix flag(data.rows(),data.columns(),1);
45  theplu::classifier::ConsensusInputRanker
46    cir2(data,target,flag,roc,sampler,30);
47
48  if (cir2.id(0)!=2 || cir2.id(1)!=0 || cir2.id(2)!=1){
49    cerr << "wrong id" << endl;
50    return -1;
51  }
52 
53  if (cir2.rank(0)!=1 || cir2.rank(1)!=2 || cir2.rank(2)!=0){
54    cerr << "wrong rank" << endl;
55    return -1;
56  }
57
58 
59  return 0;
60}
Note: See TracBrowser for help on using the repository browser.