/usr/include/shogun/evaluation/MulticlassOVREvaluation.h is in libshogun-dev 3.2.0-7.5.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 | /*
* This program 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.
*
* Copyright (C) 2012 Sergey Lisitsyn
*/
#ifndef MULTICLASSOVREVALUATION_H_
#define MULTICLASSOVREVALUATION_H_
#include <shogun/evaluation/Evaluation.h>
#include <shogun/evaluation/BinaryClassEvaluation.h>
#include <shogun/labels/Labels.h>
namespace shogun
{
class CLabels;
/** @brief The class MulticlassOVREvaluation
* used to compute evaluation parameters
* of multiclass classification via
* binary OvR decomposition and given binary
* evaluation technique.
*/
class CMulticlassOVREvaluation: public CEvaluation
{
public:
/** constructor */
CMulticlassOVREvaluation();
/** constructor */
CMulticlassOVREvaluation(CBinaryClassEvaluation* binary_evaluation);
/** destructor */
virtual ~CMulticlassOVREvaluation();
/** set evaluation */
void set_binary_evaluation(CBinaryClassEvaluation* binary_evaluation)
{
SG_REF(binary_evaluation);
SG_UNREF(m_binary_evaluation);
m_binary_evaluation = binary_evaluation;
}
/** get evaluation */
CBinaryClassEvaluation* get_binary_evaluation()
{
SG_REF(m_binary_evaluation);
return m_binary_evaluation;
}
/** evaluate accuracy
* @param predicted labels to be evaluated
* @param ground_truth labels assumed to be correct
* @return mean of OvR binary evaluations
*/
virtual float64_t evaluate(CLabels* predicted, CLabels* ground_truth);
/** returns last results per class */
SGVector<float64_t> get_last_results()
{
return m_last_results;
}
/** returns graph for ith class */
SGMatrix<float64_t> get_graph_for_class(int32_t class_idx)
{
ASSERT(m_graph_results)
ASSERT(class_idx>=0)
ASSERT(class_idx<m_num_graph_results)
return m_graph_results[class_idx];
}
/** returns evaluation direction */
virtual EEvaluationDirection get_evaluation_direction() const
{
return m_binary_evaluation->get_evaluation_direction();
}
/** get name */
virtual const char* get_name() const { return "MulticlassOVREvaluation"; }
protected:
/** binary evaluation to be used */
CBinaryClassEvaluation* m_binary_evaluation;
/** last per class results */
SGVector<float64_t> m_last_results;
/** stores graph (ROC,PRC) results per class */
SGMatrix<float64_t>* m_graph_results;
/** number of graph results */
int32_t m_num_graph_results;
};
}
#endif /* MULTICLASSOVREVALUATION_H_ */
|