151 |
09 Sep 04 |
peter |
// $Id$ |
151 |
09 Sep 04 |
peter |
2 |
|
675 |
10 Oct 06 |
jari |
3 |
/* |
831 |
27 Mar 07 |
peter |
Copyright (C) 2004, 2005 Peter Johansson |
4359 |
23 Aug 23 |
peter |
Copyright (C) 2006 Jari Häkkinen, Peter Johansson |
4359 |
23 Aug 23 |
peter |
Copyright (C) 2007 Peter Johansson |
4359 |
23 Aug 23 |
peter |
Copyright (C) 2008 Jari Häkkinen, Peter Johansson |
2919 |
19 Dec 12 |
peter |
Copyright (C) 2012 Peter Johansson |
151 |
09 Sep 04 |
peter |
9 |
|
1437 |
25 Aug 08 |
peter |
This file is part of the yat library, http://dev.thep.lu.se/yat |
675 |
10 Oct 06 |
jari |
11 |
|
675 |
10 Oct 06 |
jari |
The yat library is free software; you can redistribute it and/or |
675 |
10 Oct 06 |
jari |
modify it under the terms of the GNU General Public License as |
1486 |
09 Sep 08 |
jari |
published by the Free Software Foundation; either version 3 of the |
675 |
10 Oct 06 |
jari |
License, or (at your option) any later version. |
675 |
10 Oct 06 |
jari |
16 |
|
675 |
10 Oct 06 |
jari |
The yat library is distributed in the hope that it will be useful, |
675 |
10 Oct 06 |
jari |
but WITHOUT ANY WARRANTY; without even the implied warranty of |
675 |
10 Oct 06 |
jari |
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
675 |
10 Oct 06 |
jari |
General Public License for more details. |
675 |
10 Oct 06 |
jari |
21 |
|
675 |
10 Oct 06 |
jari |
You should have received a copy of the GNU General Public License |
1487 |
10 Sep 08 |
jari |
along with yat. If not, see <http://www.gnu.org/licenses/>. |
675 |
10 Oct 06 |
jari |
24 |
*/ |
675 |
10 Oct 06 |
jari |
25 |
|
2881 |
18 Nov 12 |
peter |
26 |
#include <config.h> |
2881 |
18 Nov 12 |
peter |
27 |
|
1237 |
15 Mar 08 |
peter |
28 |
#include "Suite.h" |
1237 |
15 Mar 08 |
peter |
29 |
|
675 |
10 Oct 06 |
jari |
30 |
#include "yat/classifier/InputRanker.h" |
820 |
17 Mar 07 |
peter |
31 |
#include "yat/statistics/AUC.h" |
1121 |
22 Feb 08 |
peter |
32 |
#include "yat/utility/Matrix.h" |
675 |
10 Oct 06 |
jari |
33 |
#include "yat/classifier/MatrixLookup.h" |
675 |
10 Oct 06 |
jari |
34 |
#include "yat/classifier/Target.h" |
675 |
10 Oct 06 |
jari |
35 |
|
151 |
09 Sep 04 |
peter |
36 |
#include <cstdlib> |
151 |
09 Sep 04 |
peter |
37 |
#include <fstream> |
151 |
09 Sep 04 |
peter |
38 |
#include <iostream> |
151 |
09 Sep 04 |
peter |
39 |
|
1237 |
15 Mar 08 |
peter |
40 |
int main(int argc, char* argv[]) |
475 |
22 Dec 05 |
peter |
41 |
{ |
680 |
11 Oct 06 |
jari |
42 |
using namespace theplu::yat; |
1237 |
15 Mar 08 |
peter |
43 |
test::Suite suite(argc, argv); |
1237 |
15 Mar 08 |
peter |
44 |
suite.err() << "testing inputranker" << std::endl; |
475 |
22 Dec 05 |
peter |
45 |
|
1251 |
03 Apr 08 |
peter |
46 |
std::ifstream is(test::filename("data/rank_data.txt").c_str()); |
1121 |
22 Feb 08 |
peter |
47 |
theplu::yat::utility::Matrix data_tmp(is); |
680 |
11 Oct 06 |
jari |
48 |
theplu::yat::classifier::MatrixLookup data(data_tmp); |
151 |
09 Sep 04 |
peter |
49 |
is.close(); |
151 |
09 Sep 04 |
peter |
50 |
|
1251 |
03 Apr 08 |
peter |
51 |
is.open(test::filename("data/rank_target.txt").c_str()); |
475 |
22 Dec 05 |
peter |
52 |
classifier::Target target(is); |
151 |
09 Sep 04 |
peter |
53 |
is.close(); |
151 |
09 Sep 04 |
peter |
54 |
|
820 |
17 Mar 07 |
peter |
55 |
statistics::AUC roc; |
453 |
15 Dec 05 |
peter |
56 |
classifier::InputRanker ir(data,target,roc); |
604 |
29 Aug 06 |
peter |
57 |
if (ir.id()[0]!=2 || ir.id()[1]!=0 || ir.id()[2]!=1){ |
1237 |
15 Mar 08 |
peter |
58 |
suite.err() << "wrong id" << std::endl; |
1237 |
15 Mar 08 |
peter |
59 |
suite.add(false); |
151 |
09 Sep 04 |
peter |
60 |
} |
4200 |
19 Aug 22 |
peter |
61 |
|
604 |
29 Aug 06 |
peter |
62 |
if (ir.rank()[0]!=1 || ir.rank()[1]!=2 || ir.rank()[2]!=0){ |
1237 |
15 Mar 08 |
peter |
63 |
suite.err() << "wrong rank" << std::endl; |
1237 |
15 Mar 08 |
peter |
64 |
suite.add(false); |
151 |
09 Sep 04 |
peter |
65 |
} |
1237 |
15 Mar 08 |
peter |
66 |
return suite.return_value(); |
151 |
09 Sep 04 |
peter |
67 |
} |