source: trunk/test/inputranker_test.cc @ 1275

Last change on this file since 1275 was 1275, checked in by Jari Häkkinen, 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.9 KB
Line 
1// $Id: inputranker_test.cc 1275 2008-04-11 06:10:12Z 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://trac.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 2 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 this program; if not, write to the Free Software
22  Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
23  02111-1307, USA.
24*/
25
26#include "Suite.h"
27
28#include "yat/classifier/InputRanker.h"
29#include "yat/statistics/AUC.h"
30#include "yat/utility/Matrix.h"
31#include "yat/classifier/MatrixLookup.h"
32#include "yat/classifier/Target.h"
33
34#include <cstdlib>
35#include <fstream>
36#include <iostream>
37
38int main(int argc, char* argv[])
39{
40  using namespace theplu::yat;
41  test::Suite suite(argc, argv);
42  suite.err() << "testing inputranker" << std::endl;
43
44  std::ifstream is(test::filename("data/rank_data.txt").c_str());
45  theplu::yat::utility::Matrix data_tmp(is);
46  theplu::yat::classifier::MatrixLookup data(data_tmp);
47  is.close();
48
49  is.open(test::filename("data/rank_target.txt").c_str());
50  classifier::Target target(is);
51  is.close();
52
53  statistics::AUC roc;
54  classifier::InputRanker ir(data,target,roc);
55  if (ir.id()[0]!=2 || ir.id()[1]!=0 || ir.id()[2]!=1){
56    suite.err() << "wrong id" << std::endl;
57    suite.add(false);
58  }
59 
60  if (ir.rank()[0]!=1 || ir.rank()[1]!=2 || ir.rank()[2]!=0){
61    suite.err() << "wrong rank" << std::endl;
62    suite.add(false);
63  }
64  return suite.return_value();
65}
Note: See TracBrowser for help on using the repository browser.