Deep learning for NeuroImaging in Python.
Note
This page is a reference documentation. It only explains the function signature, and not how to use it. Please refer to the gallery for the big picture.
- nidl.metrics.regression.pearson_r(y_true, y_pred, sample_weight=None, multioutput='uniform_average', force_finite=False)[source]¶
Pearson correlation coefficient between 2 arrays y_true, y_pred. This score is symmetric between y_true and y_pred and is always between 1 (perfect correlation) and -1 (perfect anti-correlation).
- Parameters:
y_true : array-like of shape (n_samples,) or (n_samples, n_outputs)
First input array.
y_pred : array-like of shape (n_samples,) or (n_samples, n_outputs)
Second input array.
sample_weight : array-like of shape (n_samples,), default=None
Sample weights for weighted Pearson’s correlation.
multioutput : {‘raw_values’, ‘uniform_average’} or array-like of shape (n_outputs,), optional
Defines aggregating of multiple output scores.
‘raw_values’: Returns a full set of scores in case of multioutput input.
‘uniform_average’: Scores of all outputs are averaged with uniform weight.
array-like: Defines weights used to average scores.
force_finite : bool, default=False
Flag indicating if
NaN
and-Inf
scores resulting from constant data should be replaced with real numbers (1.0
if prediction is perfect, i.e. all data are equal ,0.0
otherwise). Default isFalse
since Pearson’s correlation is not defined for constant data (zero variance).- Returns:
pearson_r : float or array of floats
The correlation score or ndarray of scores if ‘multioutput’ is ‘raw_values’.
Follow us