Scoring

Learn.jl provides scoring functions for regression, classification, and clustering. For regression r2_score, mean_squared_error, and explained_variance_score are available. For classification f1_score, precision_score, and recall_score are available. For clustering 1/totalcosts is available for K-means, as the only integrated clustering algorithms. There is a score function for each type of estimator (Regressor, Classifier, and Cluster), which takes a set of observations X and the true targets y for regression and classifcation.

score{T<:AbstractFloat}(clf::Estimator, X::Matrix{T}, y_true::Vector; scoring::Union{Function, Void})
score{T<:AbstractFloat}(clust::Cluster, X::Matrix{T}; scoring::Union{Function, Void})

These functions delegate either to scoring or, if scoring is not provided, to a default scoring function. The default for regression is r2_score and for classification f1_score.

The scoring functions below take a set of predicted targets and the observed targets. Thus, score is a convenience function that combines predict with one of the scoring functions below.

Regression

r2_score(y_true::Vector{Float64}, y_pred::Vector{Float64})

Compute the R2-score for observed targets y_true and predicted targets y_pred.

mean_squared_error(y_true::Vector{Float64}, y_pred::Vector{Float64})

Compute the mean squared error for observed targets y_true and predicted targets y_pred.

explained_variance_score(y_true::Vector{Float64}, y_pred::Vector{Float64})

Compute the explained-variance-score_ for observed targets y_true and predicted targets y_pred.

Classification

The scoring functions for classification return a dictionary with the labels as keys and the scores as values.

precision_score(y_observed, y_pred; ave_fun::Union{ASCIIString, Void}=nothing)

Compute the precision-score for observed targets y_true and predicted targets y_pred.

recall_score(y_observed, y_pred; ave_fun::Union{ASCIIString, Void}=nothing)

Compute the recall-score for observed targets y_true and predicted targets y_pred.

f1_score(y_observed, y_pred; ave_fun::Union{ASCIIString, Void}=nothing)

Compute the f1-score for observed targets y_true and predicted targets y_pred.