source: trunk/test/inputranker_test.cc @ 1659

Last change on this file since 1659 was 1487, checked in by Jari Häkkinen, 13 years ago

Addresses #436. GPL license copy reference should also be updated.

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