source: trunk/test/inputranker_test.cc @ 1797

Last change on this file since 1797 was 1797, checked in by Peter, 13 years ago

updating copyright statements

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 1.8 KB
Line 
1// $Id: inputranker_test.cc 1797 2009-02-12 18:07:10Z peter $
2
3/*
4  Copyright (C) 2004, 2005 Peter Johansson
5  Copyright (C) 2006, 2007, 2008 Jari Häkkinen, Peter Johansson
6
7  This file is part of the yat library, http://dev.thep.lu.se/yat
8
9  The yat library is free software; you can redistribute it and/or
10  modify it under the terms of the GNU General Public License as
11  published by the Free Software Foundation; either version 3 of the
12  License, or (at your option) any later version.
13
14  The yat library is distributed in the hope that it will be useful,
15  but WITHOUT ANY WARRANTY; without even the implied warranty of
16  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
17  General Public License for more details.
18
19  You should have received a copy of the GNU General Public License
20  along with yat. If not, see <http://www.gnu.org/licenses/>.
21*/
22
23#include "Suite.h"
24
25#include "yat/classifier/InputRanker.h"
26#include "yat/statistics/AUC.h"
27#include "yat/utility/Matrix.h"
28#include "yat/classifier/MatrixLookup.h"
29#include "yat/classifier/Target.h"
30
31#include <cstdlib>
32#include <fstream>
33#include <iostream>
34
35int main(int argc, char* argv[])
36{
37  using namespace theplu::yat;
38  test::Suite suite(argc, argv);
39  suite.err() << "testing inputranker" << std::endl;
40
41  std::ifstream is(test::filename("data/rank_data.txt").c_str());
42  theplu::yat::utility::Matrix data_tmp(is);
43  theplu::yat::classifier::MatrixLookup data(data_tmp);
44  is.close();
45
46  is.open(test::filename("data/rank_target.txt").c_str());
47  classifier::Target target(is);
48  is.close();
49
50  statistics::AUC roc;
51  classifier::InputRanker ir(data,target,roc);
52  if (ir.id()[0]!=2 || ir.id()[1]!=0 || ir.id()[2]!=1){
53    suite.err() << "wrong id" << std::endl;
54    suite.add(false);
55  }
56 
57  if (ir.rank()[0]!=1 || ir.rank()[1]!=2 || ir.rank()[2]!=0){
58    suite.err() << "wrong rank" << std::endl;
59    suite.add(false);
60  }
61  return suite.return_value();
62}
Note: See TracBrowser for help on using the repository browser.