source: trunk/test/consensus_inputranker_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: 1.1 KB
Line 
1// $Id: consensus_inputranker_test.cc 453 2005-12-15 21:49:23Z 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
9#include <cstdlib>
10#include <fstream>
11#include <iostream>
12//#include <vector>
13
14using namespace std;
15
16int main()
17{ 
18  ifstream is("data/rank_data.txt");
19  theplu::gslapi::matrix data(is);
20  is.close();
21
22  is.open("data/rank_target.txt");
23  theplu::gslapi::vector target(is);
24  is.close();
25
26  theplu::statistics::ROC roc;
27  theplu::classifier::ConsensusInputRanker cir(data,target,roc,10,3);
28
29  if (cir.id(0)!=2 || cir.id(1)!=0 || cir.id(2)!=1){
30    cerr << "wrong id" << endl;
31    return -1;
32  }
33 
34  if (cir.rank(0)!=1 || cir.rank(1)!=2 || cir.rank(2)!=0){
35    cerr << "wrong rank" << endl;
36    return -1;
37  }
38
39  theplu::gslapi::matrix flag(data.rows(),data.columns(),1);
40  theplu::classifier::ConsensusInputRanker cir2(data,target,flag,roc,10,3);
41
42  if (cir2.id(0)!=2 || cir2.id(1)!=0 || cir2.id(2)!=1){
43    cerr << "wrong id" << endl;
44    return -1;
45  }
46 
47  if (cir2.rank(0)!=1 || cir2.rank(1)!=2 || cir2.rank(2)!=0){
48    cerr << "wrong rank" << endl;
49    return -1;
50  }
51
52 
53  return 0;
54}
Note: See TracBrowser for help on using the repository browser.