spearman

improvelib.metrics.spearman(y_true, y_pred)

Compute Spearman Correlation Coefficient (SCC). Uses scipy.stats.mstats.spearmanr().

Used in compute_metrics and can be used directly.

Parameters:

y_truenp.ndarray

Ground truth.

y_prednp.ndarray

Predictions made by the model.

Returns:

sccfloat

The computed SCC.

Example

This function is called by compute_metrics which is called by compute_performance_scores, which also saves the scores.

You can use this function directly, for example during model training like so:

import improvelib.metrics as metr
scc_to_monitor = metr.spearman(y_true, y_pred)