openModeller  Version 1.4.0
RocCurve Class Reference

#include <RocCurve.hh>

List of all members.

Classes

struct  VectorCompare

Public Member Functions

 RocCurve ()
 ~RocCurve ()
void initialize (int resolution=ROC_DEFAULT_RESOLUTION)
void initialize (int resolution, int num_background_points)
void initialize (int resolution, bool use_absences_as_background)
void reset ()
void calculate (const Model &model, const SamplerPtr &sampler)
int numPoints () const
double getX (int point_index) const
double getY (int point_index) const
double getTotalArea ()
double getPartialAreaRatio (double e=1.0)
bool ready () const
ConfigurationPtr getConfiguration () const

Private Member Functions

void _loadPredictions (const Model &model, const SamplerPtr &sampler)
void _calculateGraphPoints ()
bool _calculateTotalArea ()

Private Attributes

std::vector< int > _category
std::vector< Scalar_prediction
std::vector< std::vector
< Scalar > > 
_data
int _resolution
int _approach
int _num_background_points
bool _use_absences_as_background
int _true_negatives
int _true_positives
double _auc
std::map< double, double > _ratios
std::vector< Scalar_thresholds
std::vector< Scalar_proportions
bool _ready

Detailed Description

Class ROC curve

Definition at line 46 of file RocCurve.hh.


Constructor & Destructor Documentation

Default constructor.

Definition at line 57 of file RocCurve.cpp.

Destructor.

Definition at line 64 of file RocCurve.cpp.


Member Function Documentation

void RocCurve::_calculateGraphPoints ( ) [private]

Calculate all points of the curve.

Definition at line 410 of file RocCurve.cpp.

References Log::debug(), and Log::instance().

Here is the call graph for this function:

bool RocCurve::_calculateTotalArea ( ) [private]

Calculate the total area under the curve.

Definition at line 565 of file RocCurve.cpp.

void RocCurve::_loadPredictions ( const Model model,
const SamplerPtr sampler 
) [private]

Get model predictions for each sample.

Parameters:
modelModel object to be evaluated.
samplerSampler object with environment, presences and optionally absence points (no absences will trigger the background points approach).

Definition at line 149 of file RocCurve.cpp.

References Log::debug(), Log::error(), Log::info(), Log::instance(), Sample::size(), and Log::warn().

Here is the call graph for this function:

void RocCurve::calculate ( const Model model,
const SamplerPtr sampler 
)

Calculate ROC curve given a Model and a Sampler object. This method loads model predictions for all sampler points, calculates all points for the curve and calculates the area under the curve.

Parameters:
modelModel object to be evaluated.
samplerPointer to a Sampler object that will provide data for evaluation.

Definition at line 131 of file RocCurve.cpp.

References Log::info(), and Log::instance().

Referenced by OpenModeller::calculateModelStatistics(), OpenModeller::getRocCurve(), and main().

Here is the call graph for this function:

Serialize the ROC curve

Definition at line 739 of file RocCurve.cpp.

Referenced by OpenModeller::getModelConfiguration(), and main().

double RocCurve::getPartialAreaRatio ( double  e = 1.0)

Return the ratio between the area under the curve and the area under the diagonal considering only points where Y is greater than (1 - e), i.e, with omission error less than a specified value. Need to call "calculate" first.

Parameters:
eMaximum accepted omission error [0,1].
Returns:
Ratio between area under the curve and area under the diagonal for points that have omission error lesss than a specified value.

Definition at line 615 of file RocCurve.cpp.

References Log::debug(), Log::info(), and Log::instance().

Referenced by OpenModeller::calculateModelStatistics(), and main().

Here is the call graph for this function:

Return the total area under the curve. Need to call "calculate" first.

Returns:
Area under the curve.

Definition at line 602 of file RocCurve.cpp.

Referenced by OpenModeller::calculateModelStatistics(), main(), and RequestFile::makeModel().

double RocCurve::getX ( int  point_index) const [inline]

Return the X axis value for a particular point (1-specificity if absence points were provided, otherwise proportion of background points predicted present). Need to call "calculate" first.

Parameters:
point_indexPoint index.
Returns:
X value for the point.

Definition at line 115 of file RocCurve.hh.

double RocCurve::getY ( int  point_index) const [inline]

Return the Y axis value of a particular point (sensitivity). Need to call "calculate" first.

Parameters:
point_indexPoint index.
Returns:
Y value for the point.

Definition at line 123 of file RocCurve.hh.

void RocCurve::initialize ( int  resolution = ROC_DEFAULT_RESOLUTION)

Default initializer. ROC approach will be determined automatically based on sampler data. If only presences are provided, the proportional area approach will be used (with the default number of background points). If presences and absences are provided, the traditional approach will be used.

Parameters:
resolutionNumber of points to be calculated for the curve.

Definition at line 70 of file RocCurve.cpp.

References ROC_DEFAULT_BACKGROUND_POINTS.

Referenced by OpenModeller::calculateModelStatistics(), and main().

void RocCurve::initialize ( int  resolution,
int  num_background_points 
)

Alternative initializer. In this case, the proportional area approach will be used, generating the specified number of background points. If absences are provided, they will be ignored.

Parameters:
resolutionNumber of points to be calculated for the curve.
num_background_pointsNumber of background points to be generated.

Definition at line 80 of file RocCurve.cpp.

void RocCurve::initialize ( int  resolution,
bool  use_absences_as_background 
)

Alternative initializer. In this case, the proportional area approach will be used. If use_absences_as_background is true, then absence points will serve as background points, and the number of background points will be the number of absences. If use_absences_as_background is false, background points will be generated in the default number.

Parameters:
resolutionNumber of points to be calculated for the curve.
use_absences_as_backgroundIndicates if absence points should be used as background points to calculate the proportional area. Internally, when no absence points are provided, background points are randomly generated to use the proportional area approach anyway.

Definition at line 90 of file RocCurve.cpp.

int RocCurve::numPoints ( ) const [inline]

Return the number of points for the curve.

Returns:
Total number of points for the curve.

Definition at line 106 of file RocCurve.hh.

bool RocCurve::ready ( ) const [inline]

Check whether the ROC curve has been calculated already

Definition at line 144 of file RocCurve.hh.

Referenced by OpenModeller::getModelConfiguration(), OpenModeller::getRocCurve(), and main().

void RocCurve::reset ( )

Reset all internal values, keeping the same parameters passed in the constructor.

Definition at line 100 of file RocCurve.cpp.

References Log::debug(), and Log::instance().

Referenced by OpenModeller::calculateModelStatistics(), OpenModeller::createModel(), and OpenModeller::setModelConfiguration().

Here is the call graph for this function:


Member Data Documentation

int RocCurve::_approach [private]

Definition at line 195 of file RocCurve.hh.

double RocCurve::_auc [private]

Definition at line 203 of file RocCurve.hh.

std::vector<int> RocCurve::_category [private]

Definition at line 188 of file RocCurve.hh.

std::vector< std::vector<Scalar> > RocCurve::_data [private]

Definition at line 191 of file RocCurve.hh.

Definition at line 197 of file RocCurve.hh.

std::vector<Scalar> RocCurve::_prediction [private]

Definition at line 189 of file RocCurve.hh.

std::vector<Scalar> RocCurve::_proportions [private]

Definition at line 209 of file RocCurve.hh.

std::map<double, double> RocCurve::_ratios [private]

Definition at line 205 of file RocCurve.hh.

bool RocCurve::_ready [private]

Definition at line 211 of file RocCurve.hh.

int RocCurve::_resolution [private]

Definition at line 193 of file RocCurve.hh.

std::vector<Scalar> RocCurve::_thresholds [private]

Definition at line 207 of file RocCurve.hh.

Definition at line 200 of file RocCurve.hh.

Definition at line 201 of file RocCurve.hh.

Definition at line 198 of file RocCurve.hh.


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