Evaluation measures¶

Compute the common part of commuters for two pairs of fluxes. 

Compute the common part of commuters for two pairs of fluxes. 

Compute the common part of commuters according to the distance. 

R^2 (coefficient of determination) regression score function. 

Root mean squared error regression loss 

Normalized mean squared error regression loss 

The information gain 

Calculates a Pearson correlation coefficient and the pvalue for testing noncorrelation. 

Calculates a Spearman rankorder correlation coefficient and the pvalue to test for noncorrelation. 

Compute the KullbackLeibler divergence S = sum(pk * log(pk / qk), axis=0). 

The maximum error between the two arrays 
 skmob.measures.evaluation.common_part_of_commuters(values1, values2)¶
Compute the common part of commuters for two pairs of fluxes.
 Parameters
values1 (numpy array) – the values for the first array
values2 – the values for the second array
 Returns
float the common part of commuters
 skmob.measures.evaluation.common_part_of_commuters_distance(values1, values2)¶
Compute the common part of commuters according to the distance.
 Parameters
values1 (numpy array) – the values for the first array
values2 (numpy array) – the values for the second array
 Returns
float the common part of commuters according to the distance
 skmob.measures.evaluation.common_part_of_links(values1, values2)¶
Compute the common part of commuters for two pairs of fluxes.
 Parameters
values1 (numpy array) – the values for the first array
values2 (numpy array) – the values for the second array
 Returns
float the common part of commuters
 skmob.measures.evaluation.information_gain(true, pred)¶
The information gain
 Parameters
true (numpy array arraylike of shape = (n_samples) or (n_samples, n_outputs)) – Ground truth (correct) target values.
pred (numpy arraylike of shape = (n_samples) or (n_samples, n_outputs)) – Estimated target values.
 Returns
float A nonnegative floating point value (the best value is 0.0)
 skmob.measures.evaluation.kullback_leibler_divergence(true, pred)¶
Compute the KullbackLeibler divergence S = sum(pk * log(pk / qk), axis=0).
 Parameters
true (numpy array arraylike of shape = (n_samples) or (n_samples, n_outputs)) – Ground truth (correct) target values.
pred (numpy arraylike of shape = (n_samples) or (n_samples, n_outputs)) – Estimated target values.
 Returns
float the calculated KullbackLeibler divergence
 skmob.measures.evaluation.max_error(true, pred)¶
The maximum error between the two arrays
 Parameters
true (numpy array arraylike of shape = (n_samples) or (n_samples, n_outputs)) – Ground truth (correct) target values.
pred (numpy arraylike of shape = (n_samples) or (n_samples, n_outputs)) – Estimated target values.
 Returns
float max error between the two samples
 skmob.measures.evaluation.nrmse(true, pred)¶
Normalized mean squared error regression loss
 Parameters
true (numpy array arraylike of shape = (n_samples) or (n_samples, n_outputs)) – Ground truth (correct) target values.
pred (numpy arraylike of shape = (n_samples) or (n_samples, n_outputs)) – Estimated target values.
 Returns
float A nonnegative floating point value (the best value is 0.0)
 skmob.measures.evaluation.pearson_correlation(true, pred)¶
Calculates a Pearson correlation coefficient and the pvalue for testing noncorrelation. The Pearson correlation coefficient measures the linear relationship between two datasets. Strictly speaking, Pearson’s correlation requires that each dataset be normally distributed. Like other correlation coefficients, this one varies between 1 and +1 with 0 implying no correlation. Correlations of 1 or +1 imply an exact linear relationship. Positive correlations imply that as x increases, so does y. Negative correlations imply that as x increases, y decreases. The pvalue roughly indicates the probability of an uncorrelated system producing datasets that have a Pearson correlation at least as extreme as the one computed from these datasets. The pvalues are not entirely reliable but are probably reasonable for datasets larger than 500 or so.
 Parameters
true (numpy array arraylike of shape = (n_samples) or (n_samples, n_outputs)) – Ground truth (correct) target values.
pred (numpy arraylike of shape = (n_samples) or (n_samples, n_outputs)) – Estimated target values.
 Returns
tuple (Pearson’s correlation coefficient, 2tailed pvalue)
 skmob.measures.evaluation.r_squared(true, pred)¶
R^2 (coefficient of determination) regression score function.
Best possible score is 1.0 and it can be negative (because the model can be arbitrarily worse). A constant model that always predicts the expected value of y, disregarding the input features, would get a R^2 score of 0.0.
 Parameters
true (numpy array arraylike of shape = (n_samples) or (n_samples, n_outputs)) – Ground truth (correct) target values.
pred (numpy arraylike of shape = (n_samples) or (n_samples, n_outputs)) – Estimated target values.
 Returns
float
 skmob.measures.evaluation.rmse(true, pred)¶
Root mean squared error regression loss
 Parameters
true (numpy array arraylike of shape = (n_samples) or (n_samples, n_outputs)) – Ground truth (correct) target values.
pred (numpy arraylike of shape = (n_samples) or (n_samples, n_outputs)) – Estimated target values.
 Returns
float A nonnegative floating point value (the best value is 0.0)
 skmob.measures.evaluation.spearman_correlation(true, pred)¶
Calculates a Spearman rankorder correlation coefficient and the pvalue to test for noncorrelation. The Spearman correlation is a nonparametric measure of the monotonicity of the relationship between two datasets. Unlike the Pearson correlation, the Spearman correlation does not assume that both datasets are normally distributed. Like other correlation coefficients, this one varies between 1 and +1 with 0 implying no correlation. Correlations of 1 or +1 imply an exact monotonic relationship. Positive correlations imply that as x increases, so does y. Negative correlations imply that as x increases, y decreases. The pvalue roughly indicates the probability of an uncorrelated system producing datasets that have a Spearman correlation at least as extreme as the one computed from these datasets. The pvalues are not entirely reliable but are probably reasonable for datasets larger than 500 or so.
 Parameters
true (numpy array arraylike of shape = (n_samples) or (n_samples, n_outputs)) – Ground truth (correct) target values.
pred (numpy arraylike of shape = (n_samples) or (n_samples, n_outputs)) – Estimated target values.
 Returns
tuple (Spearman’s correlation coefficient, 2tailed pvalue)