#ifndef _theplu_yat_statistics_score_
#define _theplu_yat_statistics_score_
// $Id: Score.h 1487 2008-09-10 08:41:36Z jari $
/*
Copyright (C) 2004, 2005 Peter Johansson
Copyright (C) 2006 Jari Häkkinen, Peter Johansson, Markus Ringnér
Copyright (C) 2007 Jari Häkkinen, Peter Johansson
Copyright (C) 2008 Peter Johansson
This file is part of the yat library, http://dev.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 3 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 yat. If not, see .
*/
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