#ifndef _theplu_yat_statistics_score_
#define _theplu_yat_statistics_score_
// $Id: Score.h 1023 2008-02-01 18:12:35Z peter $
/*
Copyright (C) 2004, 2005 Peter Johansson
Copyright (C) 2006 Jari Häkkinen, Markus Ringnér, Peter Johansson
Copyright (C) 2007 Jari Häkkinen, Peter Johansson
This file is part of the yat library, http://trac.thep.lu.se/yat
The yat library is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License as
published by the Free Software Foundation; either version 2 of the
License, or (at your option) any later version.
The yat library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
02111-1307, USA.
*/
namespace theplu {
namespace yat {
namespace classifier {
class Target;
class DataLookup1D;
class DataLookupWeighted1D;
}
namespace utility {
class VectorBase;
}
namespace statistics {
///
/// @brief Interface Class for score classes.
///
class Score
{
public:
///
/// @brief Constructor
///
Score(bool) ;
///
/// @brief Destructor
///
virtual ~Score(void);
///
/// @brief Function changing mode of Score
///
void absolute(bool absolute);
///
/// Function calculating the score. In absolute mode, also the
/// score using negated class labels is calculated, and the
/// largest of the two scores are returned.
///
virtual double
score(const classifier::Target& target,
const utility::VectorBase& value) const = 0;
///
/// Function calculating the score. In absolute mode, also the
/// score using negated class labels is calculated, and the
/// largest of the two scores are calculated.
///
/// @a value is copied to a utility::vector and that operator is
/// called. If speed is important this operator should be
/// implemented in inherited class to avoid copying.
///
/// @return score
///
virtual double score(const classifier::Target& target,
const classifier::DataLookup1D& value) const;
///
/// Function calculating the score in a weighted fashion. In
/// absolute mode, also the score using negated class labels is
/// calculated, and the largest of the two scores are
/// calculated. Absolute mode should be used when two-tailed test
/// is wanted.
///
/// @a value is copied to two utility::vector and that operator is
/// called. If speed is important this operator should be
/// implemented in inherited class to avoid copying.
///
virtual double
score(const classifier::Target& target,
const classifier::DataLookupWeighted1D& value) const;
///
/// Function calculating the weighted version of score. In
/// absolute mode, also the score using negated class labels is
/// calculated, and the largest of the two scores are
/// calculated. Absolute mode should be used when two-tailed test
/// is wanted.
///
virtual double
score(const classifier::Target& target,
const utility::VectorBase& value,
const utility::VectorBase& weight) const = 0;
///
/// Function calculating the weighted version of score. In
/// absolute mode, also the score using negated class labels is
/// calculated, and the largest of the two scores are
/// calculated. Absolute mode should be used when two-tailed test
/// is wanted.
///
/// \a value and \a weight are copied to utility::vector and the
/// corresponding operator is called. If speed is important this
/// operator should be implemented in inherited class to avoid
/// copying.
///
double score(const classifier::Target& target,
const classifier::DataLookup1D& value,
const classifier::DataLookup1D& weight) const;
protected:
/// true if method is absolute, which means if score is below
/// expected value (by chance) E, score returns E-score+E instead.
bool absolute_;
}; // class Score
}}} // of namespace statistics, yat, and theplu
#endif