Brush C++ API
A flexible interpretable machine learning framework
Loading...
Searching...
No Matches
Brush::Eval Namespace Reference

Classes

class  Evaluation
 Class for evaluating the fitness of individuals in a population. More...
class  Scorer
class  Scorer< P >

Functions

float mse (const VectorXf &y, const VectorXf &yhat, VectorXf &loss, const vector< float > &class_weights)
 mean squared error
VectorXf log_loss (const VectorXf &y, const VectorXf &predict_proba, const vector< float > &class_weights=vector< float >())
 Calculates the log loss between the predicted probabilities and the true labels.
float mean_log_loss (const VectorXf &y, const VectorXf &predict_proba, VectorXf &loss, const vector< float > &class_weights)
 log loss
float zero_one_loss (const VectorXf &y, const VectorXf &predict_proba, VectorXf &loss, const vector< float > &class_weights=vector< float >())
 Accuracy for binary classification.
float bal_zero_one_loss (const VectorXf &y, const VectorXf &predict_proba, VectorXf &loss, const vector< float > &class_weights=vector< float >())
 Balanced accuracy for binary classification.
float average_precision_score (const VectorXf &y, const VectorXf &predict_proba, VectorXf &loss, const vector< float > &class_weights=vector< float >())
 Calculates the average precision score between the predicted probabilities and the true labels.
float precision_score (const VectorXf &y, const VectorXf &predict_proba, VectorXf &loss, const vector< float > &class_weights=vector< float >())
 Precision for binary classification (threshold 0.5, positive label 1).
float recall_score (const VectorXf &y, const VectorXf &predict_proba, VectorXf &loss, const vector< float > &class_weights=vector< float >())
 Recall for binary classification (threshold 0.5, positive label 1).
float roc_auc_score (const VectorXf &y, const VectorXf &predict_proba, VectorXf &loss, const vector< float > &class_weights=vector< float >())
 Area under the ROC curve for binary classification.
VectorXf multi_log_loss (const VectorXf &y, const ArrayXXf &predict_proba, const vector< float > &class_weights=vector< float >())
 Calculates the multinomial log loss between the predicted probabilities and the true labels.
float mean_multi_log_loss (const VectorXf &y, const ArrayXXf &predict_proba, VectorXf &loss, const vector< float > &class_weights=vector< float >())
 Calculates the mean multinomial log loss between the predicted probabilities and the true labels.
float multi_zero_one_loss (const VectorXf &y, const ArrayXXf &predict_proba, VectorXf &loss, const vector< float > &class_weights=vector< float >())
 Accuracy for multi-classification.
float multi_bal_zero_one_loss (const VectorXf &y, const ArrayXXf &predict_proba, VectorXf &loss, const vector< float > &class_weights=vector< float >())
 Balanced accuracy for multi-classification.
float multi_precision_score (const VectorXf &y, const ArrayXXf &predict_proba, VectorXf &loss, const vector< float > &class_weights=vector< float >())
 Macro-averaged precision for multi-classification.
float multi_recall_score (const VectorXf &y, const ArrayXXf &predict_proba, VectorXf &loss, const vector< float > &class_weights=vector< float >())
 Macro-averaged recall for multi-classification.
float multi_roc_auc_score (const VectorXf &y, const ArrayXXf &predict_proba, VectorXf &loss, const vector< float > &class_weights=vector< float >())
 Macro-averaged one-vs-rest AUROC for multi-classification.
float multi_average_precision_score (const VectorXf &y, const ArrayXXf &predict_proba, VectorXf &loss, const vector< float > &class_weights=vector< float >())
 Macro-averaged one-vs-rest average precision for multi-classification.

Function Documentation

◆ average_precision_score()

float Brush::Eval::average_precision_score ( const VectorXf & y,
const VectorXf & predict_proba,
VectorXf & loss,
const vector< float > & class_weights = vector< float >() )

Calculates the average precision score between the predicted probabilities and the true labels.

Parameters
yThe true labels.
predict_probaThe predicted probabilities.
lossReference to store the calculated losses for each sample.
class_weightsThe optional class weights.
Returns
The average precision score.

Definition at line 343 of file metrics.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ bal_zero_one_loss()

float Brush::Eval::bal_zero_one_loss ( const VectorXf & y,
const VectorXf & predict_proba,
VectorXf & loss,
const vector< float > & class_weights = vector< float >() )

Balanced accuracy for binary classification.

Parameters
yThe true labels.
predict_probaThe predicted probabilities.
lossReference to store the calculated losses for each sample.
class_weightsThe optional class weights.
Returns
The final accuracy.

Definition at line 102 of file metrics.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ log_loss()

VectorXf Brush::Eval::log_loss ( const VectorXf & y,
const VectorXf & predict_proba,
const vector< float > & class_weights = vector< float >() )

Calculates the log loss between the predicted probabilities and the true labels.

Parameters
yThe true labels.
predict_probaThe predicted probabilities.
class_weightsThe optional class weights.
Returns
The log loss.

Definition at line 19 of file metrics.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ mean_log_loss()

float Brush::Eval::mean_log_loss ( const VectorXf & y,
const VectorXf & predict_proba,
VectorXf & loss,
const vector< float > & class_weights = vector< float >() )

log loss

Calculates the mean log loss between the predicted probabilities and the true labels.

Parameters
yThe true labels.
predict_probaThe predicted probabilities.
lossReference to store the calculated losses for each sample.
class_weightsThe optional class weights.
Returns
The mean log loss.

Definition at line 47 of file metrics.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ mean_multi_log_loss()

float Brush::Eval::mean_multi_log_loss ( const VectorXf & y,
const ArrayXXf & predict_proba,
VectorXf & loss,
const vector< float > & class_weights = vector< float >() )

Calculates the mean multinomial log loss between the predicted probabilities and the true labels.

Parameters
yThe true labels.
predict_probaThe predicted probabilities.
lossReference to store the calculated losses for each sample.
class_weightsThe optional class weights.
Returns
The mean multinomial log loss.

Definition at line 417 of file metrics.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ mse()

float Brush::Eval::mse ( const VectorXf & y,
const VectorXf & yhat,
VectorXf & loss,
const vector< float > & class_weights = vector< float >() )

mean squared error

Calculates the mean squared error between the predicted values and the true values.

Parameters
yThe true values.
yhatThe predicted values.
lossReference to store the calculated losses for each sample.
class_weightsThe optional class weights (not used for MSE).
Returns
The mean squared error.

Definition at line 11 of file metrics.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ multi_average_precision_score()

float Brush::Eval::multi_average_precision_score ( const VectorXf & y,
const ArrayXXf & predict_proba,
VectorXf & loss,
const vector< float > & class_weights = vector< float >() )

Macro-averaged one-vs-rest average precision for multi-classification.

Mean of the binary average precision of each class against the rest, skipping classes that are absent from y. The loss vector holds the per-sample multinomial log loss.

Definition at line 537 of file metrics.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ multi_bal_zero_one_loss()

float Brush::Eval::multi_bal_zero_one_loss ( const VectorXf & y,
const ArrayXXf & predict_proba,
VectorXf & loss,
const vector< float > & class_weights )

Balanced accuracy for multi-classification.

Definition at line 465 of file metrics.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ multi_log_loss()

VectorXf Brush::Eval::multi_log_loss ( const VectorXf & y,
const ArrayXXf & predict_proba,
const vector< float > & class_weights = vector< float >() )

Calculates the multinomial log loss between the predicted probabilities and the true labels.

Parameters
yThe true labels.
predict_probaThe predicted probabilities.
class_weightsThe optional class weights.
Returns
The multinomial log loss.

Definition at line 396 of file metrics.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ multi_precision_score()

float Brush::Eval::multi_precision_score ( const VectorXf & y,
const ArrayXXf & predict_proba,
VectorXf & loss,
const vector< float > & class_weights = vector< float >() )

Macro-averaged precision for multi-classification.

Equivalent to sklearn's precision_score(average='macro', zero_division=0): averages over classes present in either the true or the predicted labels. The loss vector holds the misclassification indicator.

Definition at line 503 of file metrics.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ multi_recall_score()

float Brush::Eval::multi_recall_score ( const VectorXf & y,
const ArrayXXf & predict_proba,
VectorXf & loss,
const vector< float > & class_weights = vector< float >() )

Macro-averaged recall for multi-classification.

Equivalent to sklearn's recall_score(average='macro', zero_division=0). The loss vector holds the misclassification indicator.

Definition at line 509 of file metrics.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ multi_roc_auc_score()

float Brush::Eval::multi_roc_auc_score ( const VectorXf & y,
const ArrayXXf & predict_proba,
VectorXf & loss,
const vector< float > & class_weights = vector< float >() )

Macro-averaged one-vs-rest AUROC for multi-classification.

Mean of the binary AUROC of each class against the rest, skipping classes that are absent from y. The loss vector holds the per-sample multinomial log loss.

Definition at line 515 of file metrics.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ multi_zero_one_loss()

float Brush::Eval::multi_zero_one_loss ( const VectorXf & y,
const ArrayXXf & predict_proba,
VectorXf & loss,
const vector< float > & class_weights = vector< float >() )

Accuracy for multi-classification.

Parameters
yThe true labels.
predict_probaThe predicted probabilities.
lossReference to store the calculated losses for each sample.
class_weightsThe optional class weights.
Returns
The average accuracy in a one-vs-all schema.

Definition at line 438 of file metrics.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ precision_score()

float Brush::Eval::precision_score ( const VectorXf & y,
const VectorXf & predict_proba,
VectorXf & loss,
const vector< float > & class_weights = vector< float >() )

Precision for binary classification (threshold 0.5, positive label 1).

Equivalent to sklearn's precision_score(zero_division=0). Class weights are used as sample weights. The loss vector holds the per-sample misclassification indicator (used in lexicase selection).

Parameters
yThe true labels.
predict_probaThe predicted probabilities.
lossReference to store the calculated losses for each sample.
class_weightsThe optional class weights.
Returns
The precision.

Definition at line 360 of file metrics.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ recall_score()

float Brush::Eval::recall_score ( const VectorXf & y,
const VectorXf & predict_proba,
VectorXf & loss,
const vector< float > & class_weights = vector< float >() )

Recall for binary classification (threshold 0.5, positive label 1).

Equivalent to sklearn's recall_score(zero_division=0). The loss vector holds the per-sample misclassification indicator.

Parameters
yThe true labels.
predict_probaThe predicted probabilities.
lossReference to store the calculated losses for each sample.
class_weightsThe optional class weights.
Returns
The recall.

Definition at line 374 of file metrics.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ roc_auc_score()

float Brush::Eval::roc_auc_score ( const VectorXf & y,
const VectorXf & predict_proba,
VectorXf & loss,
const vector< float > & class_weights = vector< float >() )

Area under the ROC curve for binary classification.

Equivalent to sklearn's roc_auc_score. Returns 0.5 when only one class is present (where the metric is undefined). The loss vector holds the per-sample log loss (used in lexicase selection).

Parameters
yThe true labels.
predict_probaThe predicted probabilities.
lossReference to store the calculated losses for each sample.
class_weightsThe optional class weights.
Returns
The AUROC.

Definition at line 386 of file metrics.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ zero_one_loss()

float Brush::Eval::zero_one_loss ( const VectorXf & y,
const VectorXf & predict_proba,
VectorXf & loss,
const vector< float > & class_weights = vector< float >() )

Accuracy for binary classification.

Parameters
yThe true labels.
predict_probaThe predicted probabilities.
lossReference to store the calculated losses for each sample.
class_weightsThe optional class weights.
Returns
The final accuracy.

Definition at line 75 of file metrics.cpp.

Here is the call graph for this function:
Here is the caller graph for this function: