source: trunk/test/inputranker_test.cc @ 1251

Last change on this file since 1251 was 1251, checked in by Peter, 14 years ago

make distcheck works - fixes ticket:217

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 1.9 KB
RevLine 
[151]1// $Id: inputranker_test.cc 1251 2008-04-03 05:48:24Z peter $
2
[675]3/*
[831]4  Copyright (C) 2004, 2005 Peter Johansson
5  Copyright (C) 2006 Jari Häkkinen, Peter Johansson
6  Copyright (C) 2007 Peter Johansson
[151]7
[1000]8  This file is part of the yat library, http://trac.thep.lu.se/yat
[675]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
[1237]26#include "Suite.h"
27
[675]28#include "yat/classifier/InputRanker.h"
[820]29#include "yat/statistics/AUC.h"
[1121]30#include "yat/utility/Matrix.h"
[675]31#include "yat/classifier/MatrixLookup.h"
32#include "yat/classifier/Target.h"
33
[151]34#include <cstdlib>
35#include <fstream>
36#include <iostream>
37
[1237]38int main(int argc, char* argv[])
[475]39{
[680]40  using namespace theplu::yat;
[1237]41  test::Suite suite(argc, argv);
42  suite.err() << "testing inputranker" << std::endl;
[475]43
[1251]44  std::ifstream is(test::filename("data/rank_data.txt").c_str());
[1121]45  theplu::yat::utility::Matrix data_tmp(is);
[680]46  theplu::yat::classifier::MatrixLookup data(data_tmp);
[151]47  is.close();
48
[1251]49  is.open(test::filename("data/rank_target.txt").c_str());
[475]50  classifier::Target target(is);
[151]51  is.close();
52
[820]53  statistics::AUC roc;
[453]54  classifier::InputRanker ir(data,target,roc);
[604]55  if (ir.id()[0]!=2 || ir.id()[1]!=0 || ir.id()[2]!=1){
[1237]56    suite.err() << "wrong id" << std::endl;
57    suite.add(false);
[151]58  }
59 
[604]60  if (ir.rank()[0]!=1 || ir.rank()[1]!=2 || ir.rank()[2]!=0){
[1237]61    suite.err() << "wrong rank" << std::endl;
62    suite.add(false);
[151]63  }
[1237]64  return suite.return_value();
[151]65}
Note: See TracBrowser for help on using the repository browser.