42 reset(predictionThreshold, ignoreAbsences);
62 model->setNormalization( sampler );
75 Sample sample = (*it)->environment();
77 if ( sample.
size() > 0 ) {
79 predictionValue = model->getValue( sample );
119 int predictionIndex, actualIndex;
134 if ( (*it)->hasEnvironment() ) {
136 sample = (*it)->environment();
140 sample = env->get( (*it)->x(), (*it)->y() );
143 if ( sample.
size() > 0 ) {
147 predictionValue = model->getValue( sample );
154 ((*it)->id()).c_str(), (*it)->x(), (*it)->y(), predictionValue );
159 ((*it)->id()).c_str() );
177 if ( absences && ! absences->isEmpty() ) {
179 it = absences->begin();
180 fin = absences->end();
186 if ( (*it)->hasEnvironment() ) {
188 sample = (*it)->environment();
192 sample = env->get( (*it)->x(), (*it)->y() );
195 if ( sample.
size() > 0 ) {
199 predictionValue = model->getValue( sample );
205 ((*it)->id()).c_str(), (*it)->x(), (*it)->y(), predictionValue );
210 ((*it)->id()).c_str() );
225 model->setNormalization( sampler );
227 calculate(sampler->getEnvironment(), model, sampler->getPresences(), sampler->getAbsences() );
234 int predictedIndex, actualIndex;
250 return ( _confMatrix[0][0] + _confMatrix[1][1] ) / total;
260 return _confMatrix[1][0] / total;
270 return _confMatrix[0][1] / total;
281 config->addNameValue(
"Accuracy",
getAccuracy() * 100 );
284 config->addNameValue(
"TruePositives",
getValue( 1, 1 ) );
285 config->addNameValue(
"FalsePositives",
getValue( 0, 1 ) );
286 config->addNameValue(
"TrueNegatives",
getValue( 0, 0 ) );
287 config->addNameValue(
"FalseNegatives",
getValue( 1, 0 ) );
void reset(Scalar predictionThreshold=CONF_MATRIX_DEFAULT_THRESHOLD, bool ignoreAbsences=false)
void warn(const char *format,...)
'Warn' level.
double Scalar
Type of map values.
double getAccuracy() const
static Log * instance()
Returns the instance pointer, creating the object on the first call.
int getValue(Scalar predictionValue, Scalar actualValue) const
double getCommissionError() const
Scalar _predictionThreshold
void calculate(const EnvironmentPtr &env, const Model &model, const OccurrencesPtr &presences, const OccurrencesPtr &absences=OccurrencesPtr())
void setLowestTrainingThreshold(const Model &model, const SamplerPtr &sampler)
double getOmissionError() const
double getThreshold() const
std::vector< OccurrencePtr >::const_iterator const_iterator
ConfusionMatrix(Scalar predictionThreshold=CONF_MATRIX_DEFAULT_THRESHOLD, bool ignoreAbsences=false)
ConfigurationPtr getConfiguration() const
#define CONF_MATRIX_DEFAULT_THRESHOLD
void debug(const char *format,...)
'Debug' level.