source: trunk/yat/statistics/Score.cc

Last change on this file was 2919, checked in by Peter, 9 years ago

update copyright years

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 2.3 KB
Line 
1// $Id: Score.cc 2919 2012-12-19 06:54:23Z peter $
2
3/*
4  Copyright (C) 2004, 2005 Peter Johansson
5  Copyright (C) 2006 Jari Häkkinen, Peter Johansson, Markus Ringnér
6  Copyright (C) 2007, 2008 Jari Häkkinen, Peter Johansson
7  Copyright (C) 2012 Peter Johansson
8
9  This file is part of the yat library, http://dev.thep.lu.se/yat
10
11  The yat library is free software; you can redistribute it and/or
12  modify it under the terms of the GNU General Public License as
13  published by the Free Software Foundation; either version 3 of the
14  License, or (at your option) any later version.
15
16  The yat library is distributed in the hope that it will be useful,
17  but WITHOUT ANY WARRANTY; without even the implied warranty of
18  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
19  General Public License for more details.
20
21  You should have received a copy of the GNU General Public License
22  along with yat. If not, see <http://www.gnu.org/licenses/>.
23*/
24
25#include <config.h>
26
27#include "Score.h"
28
29#include "yat/classifier/DataLookup1D.h"
30#include "yat/classifier/DataLookupWeighted1D.h"
31#include "yat/classifier/Target.h"
32#include "yat/classifier/utility.h"
33#include "yat/utility/Vector.h"
34
35#include <cassert>
36
37namespace theplu {
38namespace yat {
39namespace statistics { 
40
41  Score::Score(bool absolute)
42    : absolute_(absolute)
43  {
44  }
45
46  Score::~Score(void)
47  {
48  }
49
50  void Score::absolute(bool absolute)
51  {
52    absolute_=absolute;
53  } 
54
55  double Score::score(const classifier::Target& target,
56                      const classifier::DataLookup1D& value) const
57  {
58    assert(target.size()==value.size());
59    utility::Vector a(value.size());
60    classifier::convert(value,a);
61    return score(target,a);
62  }
63
64
65  double Score::score(const classifier::Target& target,
66                      const classifier::DataLookupWeighted1D& value) const
67  {
68    assert(target.size()==value.size());
69    utility::Vector a(value.size());
70    utility::Vector b(value.size());
71    classifier::convert(value,a,b);
72    return score(target,a,b);
73  }
74
75
76  double Score::score(const classifier::Target& target,
77                      const classifier::DataLookup1D& value,
78                      const classifier::DataLookup1D& weight) const
79  {
80    utility::Vector a(value.size());
81    classifier::convert(value,a);
82    utility::Vector b(value.size());
83    classifier::convert(weight,a);
84    return score(target,a,b);
85  }
86
87}}} // of namespace statistics, yat, and theplu
Note: See TracBrowser for help on using the repository browser.