multioutput_spearman_correlation#

skfp.metrics.multioutput_spearman_correlation(y_true: ndarray | list, y_pred: ndarray | list, *args, **kwargs) float#

Spearman correlation for multioutput problems.

Returns the average value over all tasks. Missing values in target labels are ignored. Also supports single-task evaluation.

Any additional arguments are passed to the underlying spearman_correlation function, see spearman_correlation() for more information.

Parameters:
  • y_true (array-like of shape (n_samples,) or (n_samples, n_outputs)) – Ground truth (correct) target values.

  • y_pred (array-like of shape (n_samples,) or (n_samples, n_outputs)) – Estimated target values.

  • *args – Any additional parameters for the underlying scikit-learn metric function.

  • **kwargs – Any additional parameters for the underlying scikit-learn metric function.

Returns:

score – Average Spearman correlation value over all tasks.

Return type:

float

Examples

>>> import numpy as np
>>> from skfp.metrics import multioutput_spearman_correlation
>>> y_true = np.array([[1, 1], [2, 2], [3, 3], [4, 4]])
>>> y_pred = np.array([[1, 4], [2, 3], [3, 2], [4, 1]])
>>> multioutput_spearman_correlation(y_true, y_pred)
0.0
>>> y_true = np.array([[1, 1], [np.nan, 2], [2, np.nan], [3, 3]])
>>> y_pred = np.array([[1, 1], [0, 3], [3, 0], [4, 2]])
>>> multioutput_spearman_correlation(y_true, y_pred)
0.75