shark::NegativeAUC< LabelType, OutputType > Class Template Reference

Negative area under the curve. More...

#include <shark/ObjectiveFunctions/NegativeAUC.h>

+ Inheritance diagram for shark::NegativeAUC< LabelType, OutputType >:

Public Types

typedef KeyValuePair< double, LabelTypeAUCPair
 
- Public Types inherited from shark::AbstractCost< LabelType, OutputType >
enum  Feature
 list of features a cost function can have More...
 
typedef OutputType OutputType
 
typedef LabelType LabelType
 
typedef Batch< OutputType >::type BatchOutputType
 
typedef Batch< LabelType >::type BatchLabelType
 
typedef TypedFlags< FeatureFeatures
 
typedef TypedFeatureNotAvailableException< FeatureFeatureNotAvailableException
 

Public Member Functions

 NegativeAUC (bool invert=false)
 
std::string name () const
 From INameable: return the class name. More...
 
double eval (Data< LabelType > const &target, Data< OutputType > const &prediction, unsigned int column) const
 Computes area under the curve. More...
 
double eval (Data< LabelType > const &target, Data< OutputType > const &prediction) const
 Computes area under the curve. If the prediction vector is 1-dimensional, the "positive" class is mapped to larger values. If the prediction vector is 2-dimensional, the second dimension is viewed as the "positive" class. For higher dimensional vectors, an exception is thrown. In such a case, the column has to be explicitly specified as an additional parameter. More...
 
- Public Member Functions inherited from shark::AbstractCost< LabelType, OutputType >
virtual ~AbstractCost ()
 
const Featuresfeatures () const
 
virtual void updateFeatures ()
 
bool hasFirstDerivative () const
 returns true when the first parameter derivative is implemented More...
 
bool isLossFunction () const
 returns true when the cost function is in fact a loss function More...
 
double operator() (Data< LabelType > const &targets, Data< OutputType > const &predictions) const
 
- Public Member Functions inherited from shark::INameable
virtual ~INameable ()
 

Protected Member Functions

double trapArea (double x1, double x2, double y1, double y2) const
 

Protected Attributes

bool m_invert
 
- Protected Attributes inherited from shark::AbstractCost< LabelType, OutputType >
Features m_features
 

Detailed Description

template<class LabelType = unsigned int, class OutputType = RealVector>
class shark::NegativeAUC< LabelType, OutputType >

Negative area under the curve.

This class computes the area under the ROC (receiver operating characteristic) curve. It implements the algorithm described in: Tom Fawcett. ROC Graphs: Notes and Practical Considerations for Researchers. 2004

The area is negated so that optimizing the AUC corresponds to a minimization task.

Definition at line 52 of file NegativeAUC.h.

Member Typedef Documentation

◆ AUCPair

template<class LabelType = unsigned int, class OutputType = RealVector>
typedef KeyValuePair< double, LabelType > shark::NegativeAUC< LabelType, OutputType >::AUCPair

Definition at line 55 of file NegativeAUC.h.

Constructor & Destructor Documentation

◆ NegativeAUC()

template<class LabelType = unsigned int, class OutputType = RealVector>
shark::NegativeAUC< LabelType, OutputType >::NegativeAUC ( bool  invert = false)
inline

Constructor.

Parameters
invertif set to true, the role of positive and negative class are switched

Definition at line 59 of file NegativeAUC.h.

References shark::NegativeAUC< LabelType, OutputType >::m_invert.

Member Function Documentation

◆ eval() [1/2]

template<class LabelType = unsigned int, class OutputType = RealVector>
double shark::NegativeAUC< LabelType, OutputType >::eval ( Data< LabelType > const &  target,
Data< OutputType > const &  prediction,
unsigned int  column 
) const
inline

Computes area under the curve.

Parameters
targetclass label, 0 or 1
predictionprediction by classifier, OutputType-valued vector
columnindicates the column of the prediction vector interpreted as probability of positive class

Definition at line 71 of file NegativeAUC.h.

Referenced by shark::NegativeAUC< LabelType, OutputType >::eval(), and shark::NegativeWilcoxonMannWhitneyStatistic< LabelType, OutputType >::eval().

◆ eval() [2/2]

template<class LabelType = unsigned int, class OutputType = RealVector>
double shark::NegativeAUC< LabelType, OutputType >::eval ( Data< LabelType > const &  target,
Data< OutputType > const &  prediction 
) const
inlinevirtual

Computes area under the curve. If the prediction vector is 1-dimensional, the "positive" class is mapped to larger values. If the prediction vector is 2-dimensional, the second dimension is viewed as the "positive" class. For higher dimensional vectors, an exception is thrown. In such a case, the column has to be explicitly specified as an additional parameter.

Parameters
targetclass label, 0 or 1
predictionprediction by classifier, OutputType-valued vector

Implements shark::AbstractCost< LabelType, OutputType >.

Definition at line 130 of file NegativeAUC.h.

References shark::dataDimension(), shark::NegativeAUC< LabelType, OutputType >::eval(), shark::Data< Type >::numberOfElements(), and SHARK_RUNTIME_CHECK.

◆ name()

template<class LabelType = unsigned int, class OutputType = RealVector>
std::string shark::NegativeAUC< LabelType, OutputType >::name ( ) const
inlinevirtual

From INameable: return the class name.

Reimplemented from shark::INameable.

Definition at line 64 of file NegativeAUC.h.

◆ trapArea()

template<class LabelType = unsigned int, class OutputType = RealVector>
double shark::NegativeAUC< LabelType, OutputType >::trapArea ( double  x1,
double  x2,
double  y1,
double  y2 
) const
inlineprotected

Definition at line 143 of file NegativeAUC.h.

Member Data Documentation

◆ m_invert


The documentation for this class was generated from the following file: