source: trunk/yat/statistics/Score.cc @ 1797

Last change on this file since 1797 was 1797, checked in by Peter, 13 years ago

updating copyright statements

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 2.2 KB
Line 
1// $Id: Score.cc 1797 2009-02-12 18:07:10Z 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
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 "Score.h"
25
26#include "yat/classifier/DataLookup1D.h"
27#include "yat/classifier/DataLookupWeighted1D.h"
28#include "yat/classifier/Target.h"
29#include "yat/classifier/utility.h"
30#include "yat/utility/Vector.h"
31
32#include <cassert>
33
34namespace theplu {
35namespace yat {
36namespace statistics { 
37
38  Score::Score(bool absolute)
39    : absolute_(absolute)
40  {
41  }
42
43  Score::~Score(void)
44  {
45  }
46
47  void Score::absolute(bool absolute)
48  {
49    absolute_=absolute;
50  } 
51
52  double Score::score(const classifier::Target& target,
53                      const classifier::DataLookup1D& value) const
54  {
55    assert(target.size()==value.size());
56    utility::Vector a(value.size());
57    classifier::convert(value,a);
58    return score(target,a);
59  }
60
61
62  double Score::score(const classifier::Target& target,
63                      const classifier::DataLookupWeighted1D& value) const
64  {
65    assert(target.size()==value.size());
66    utility::Vector a(value.size());
67    utility::Vector b(value.size());
68    classifier::convert(value,a,b);
69    return score(target,a,b);
70  }
71
72
73  double Score::score(const classifier::Target& target,
74                      const classifier::DataLookup1D& value,
75                      const classifier::DataLookup1D& weight) const
76  {
77    utility::Vector a(value.size());
78    classifier::convert(value,a);
79    utility::Vector b(value.size());
80    classifier::convert(weight,a);
81    return score(target,a,b);
82  }
83
84}}} // of namespace statistics, yat, and theplu
Note: See TracBrowser for help on using the repository browser.