Package-level declarations

Model validation and selection.

Model validation is the task of confirming that the outputs of a statistical model are acceptable with respect to the real data-generating process. A model can be validated only relative to some application area. A model that is valid for one application might be invalid for some other applications.

Types

Link copied to clipboard

Bootstrap validation runner.

Link copied to clipboard

Cross-validation runner.

Link copied to clipboard

Leave-one-out cross validation runner.

Link copied to clipboard

One-shot train/test evaluation runner.

Properties

Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard

Functions

Link copied to clipboard
fun accuracy(truth: IntArray, prediction: IntArray): Double

The accuracy is the proportion of true results (both true positives and true negatives) in the population.

Link copied to clipboard

Adjusted Rand Index assumes the generalized hyper-geometric distribution as the model of randomness. The adjusted Rand index has the maximum value 1, and its expected value is 0 in the case of random clusters. A larger adjusted Rand index means a higher agreement between two partitions. The adjusted Rand index is recommended for measuring agreement even when the partitions compared have different numbers of clusters.

Link copied to clipboard
fun auc(truth: IntArray, probability: DoubleArray): Double

The area under the curve (AUC). When using normalized units, the area under the curve is equal to the probability that a classifier will rank a randomly chosen positive instance higher than a randomly chosen negative one (assuming 'positive' ranks higher than 'negative').

Link copied to clipboard
fun confusion(truth: IntArray, prediction: IntArray): ConfusionMatrix

Computes the confusion matrix.

Link copied to clipboard
fun crossentropy(truth: IntArray, probability: Array<DoubleArray>): Double

Cross entropy generalizes the log loss metric to multiclass problems.

Link copied to clipboard
fun f1(truth: IntArray, prediction: IntArray): Double

The F-score (or F-measure) considers both the precision and the recall of the test to compute the score. The precision p is the number of correct positive results divided by the number of all positive results, and the recall r is the number of correct positive results divided by the number of positive results that should have been returned.

Link copied to clipboard
fun fallout(truth: IntArray, prediction: IntArray): Double

Fall-out, false alarm rate, or false positive rate (FPR). Fall-out is actually Type I error and closely related to specificity (1 - specificity).

Link copied to clipboard
fun fdr(truth: IntArray, prediction: IntArray): Double

The false discovery rate (FDR) is ratio of false positives to combined true and false positives, which is actually 1 - precision.

Link copied to clipboard
fun fscore(truth: IntArray, prediction: IntArray, beta: Double = 1.0, strategy: Averaging? = null): Double

Calculates the general F-score with custom beta and optional averaging strategy for multi-class.

Link copied to clipboard
fun logloss(truth: IntArray, probability: DoubleArray): Double

Log loss is an evaluation metric for binary classifiers and it is sometimes the optimization objective as well in case of logistic regression and neural networks. Log Loss takes into account the uncertainty of the prediction based on how much it varies from the actual label. This provides a more nuanced view of the performance of the model. In general, minimizing Log Loss gives greater accuracy for the classifier. However, it is susceptible in case of imbalanced data.

Link copied to clipboard
fun mad(truth: DoubleArray, prediction: DoubleArray): Double

Mean absolute deviation error.

Link copied to clipboard
fun mcc(truth: IntArray, prediction: IntArray): Double

MCC is a correlation coefficient between prediction and actual values. It is considered as a balanced measure for binary classification, even in unbalanced data sets. It varies between -1 and +1. 1 when there is perfect agreement between ground truth and prediction, -1 when there is a perfect disagreement between ground truth and predictions. MCC of 0 means the model is not better than random.

Link copied to clipboard
fun mse(truth: DoubleArray, prediction: DoubleArray): Double

Mean squared error.

Link copied to clipboard
fun nmi(y1: IntArray, y2: IntArray): Double

Normalized mutual information (normalized by max(H(y1), H(y2))) between two clusterings.

Link copied to clipboard
fun precision(truth: IntArray, prediction: IntArray): Double

The precision or positive predictive value (PPV) is ratio of true positives to combined true and false positives, which is different from sensitivity.

Link copied to clipboard
fun r2(truth: DoubleArray, prediction: DoubleArray): Double

R2 coefficient of determination measures how well the regression line approximates the real data points. An R2 of 1.0 indicates that the regression line perfectly fits the data.

Link copied to clipboard

Rand index is defined as the number of pairs of objects that are either in the same group or in different groups in both partitions divided by the total number of pairs of objects. The Rand index lies between 0 and 1. When two partitions agree perfectly, the Rand index achieves the maximum value 1. A problem with Rand index is that the expected value of the Rand index between two random partitions is not a constant. This problem is corrected by the adjusted Rand index.

Link copied to clipboard
fun recall(truth: IntArray, prediction: IntArray): Double

In information retrieval area, sensitivity is called recall.

Link copied to clipboard
fun rmse(truth: DoubleArray, prediction: DoubleArray): Double

Root mean squared error.

Link copied to clipboard
fun rss(truth: DoubleArray, prediction: DoubleArray): Double

Residual sum of squares.

Link copied to clipboard
fun sensitivity(truth: IntArray, prediction: IntArray): Double

Sensitivity or true positive rate (TPR) (also called hit rate, recall) is a statistical measure of the performance of a binary classification test. Sensitivity is the proportion of actual positives which are correctly identified as such.

Link copied to clipboard
fun specificity(truth: IntArray, prediction: IntArray): Double

Specificity or True Negative Rate is a statistical measure of the performance of a binary classification test. Specificity measures the proportion of negatives which are correctly identified.