API Reference

This page provides an auto-generated summary of xskillscore’s API. For more details and examples, refer to the relevant chapters in the main part of the documentation.

Deterministic Metrics

Correlation Metrics

effective_sample_size(a, b[, dim, skipna, ...])

Effective sample size for temporally correlated data.

pearson_r(a, b[, dim, weights, skipna, ...])

Pearson's correlation coefficient.

pearson_r_p_value(a, b[, dim, weights, ...])

2-tailed p-value associated with pearson's correlation coefficient.

pearson_r_eff_p_value(a, b[, dim, skipna, ...])

2-tailed p-value associated with Pearson's correlation coefficient, accounting for autocorrelation.

linslope(a, b[, dim, weights, skipna, ...])

Slope of linear fit.

spearman_r(a, b[, dim, weights, skipna, ...])

Spearman's correlation coefficient.

spearman_r_p_value(a, b[, dim, weights, ...])

2-tailed p-value associated with Spearman's correlation coefficient.

spearman_r_eff_p_value(a, b[, dim, skipna, ...])

2-tailed p-value associated with Spearman rank correlation coefficient, accounting for autocorrelation.

Distance Metrics

mae(a, b[, dim, weights, skipna, keep_attrs])

Mean Absolute Error.

mape(a, b[, dim, weights, skipna, keep_attrs])

Mean Absolute Percentage Error.

me(a, b[, dim, weights, skipna, keep_attrs])

Mean Error.

median_absolute_error(a, b[, dim, skipna, ...])

Median Absolute Error.

mse(a, b[, dim, weights, skipna, keep_attrs])

Mean Squared Error.

r2(a, b[, dim, weights, skipna, keep_attrs])

R^2 (coefficient of determination) score.

rmse(a, b[, dim, weights, skipna, keep_attrs])

Root Mean Squared Error.

smape(a, b[, dim, weights, skipna, keep_attrs])

Symmetric Mean Absolute Percentage Error.

Probabilistic Metrics

Currently, most of our probabilistic metrics are ported over from properscoring to work with xarray DataArrays and Datasets.

brier_score(observations, forecasts[, ...])

Calculate Brier score (BS).

crps_ensemble(observations, forecasts[, ...])

Continuous Ranked Probability Score with the ensemble distribution.

crps_gaussian(observations, mu, sig[, dim, ...])

Continuous Ranked Probability Score with a Gaussian distribution.

crps_quadrature(observations, cdf_or_dist[, ...])

Continuous Ranked Probability Score with numerical integration of the normal distribution.

discrimination(observations, forecasts[, ...])

Returns the data required to construct the discrimination diagram for an event;

rank_histogram(observations, forecasts[, ...])

Returns the rank histogram (Talagrand diagram) along the specified dimensions.

reliability(observations, forecasts[, dim, ...])

Returns the data required to construct the reliability diagram for an event;

roc(observations, forecasts[, bin_edges, ...])

Computes the relative operating characteristic for a range of thresholds.

rps(observations, forecasts, category_edges)

Calculate Ranked Probability Score.

threshold_brier_score(observations, ...[, ...])

Calculate the Brier scores of an ensemble for exceeding given thresholds.

Contingency-based Metrics

These metrics rely upon the construction of a Contingency object. The user calls the individual methods to access metrics based on the table.

Contingency(observations, forecasts, ...)

Class for contingency based skill scores

Contingency table

Contingency.table

Dichotomous-Only (yes/no) Metrics

Contingency.bias_score([yes_category])

Returns the bias score(s) for dichotomous contingency data

Contingency.correct_negatives([yes_category])

Returns the number of correct negatives (true negatives) for dichotomous contingency data.

Contingency.equit_threat_score([yes_category])

Returns the equitable threat score(s) for dichotomous contingency data.

Contingency.false_alarm_rate([yes_category])

Returns the false alarm rate(s) (probability of false detection) for dichotomous contingency data.

Contingency.false_alarm_ratio([yes_category])

Returns the false alarm ratio(s) for dichotomous contingency data.

Contingency.false_alarms([yes_category])

Returns the number of false alarms (false positives) for dichotomous contingency data.

Contingency.hit_rate([yes_category])

Returns the hit rate(s) (probability of detection) for dichotomous contingency data.

Contingency.hits([yes_category])

Returns the number of hits (true positives) for dichotomous contingency data.

Contingency.misses([yes_category])

Returns the number of misses (false negatives) for dichotomous contingency data.

Contingency.odds_ratio([yes_category])

Returns the odds ratio(s) for dichotomous contingency data

Contingency.odds_ratio_skill_score([...])

Returns the odds ratio skill score(s) for dichotomous contingency data

Contingency.success_ratio([yes_category])

Returns the success ratio(s) for dichotomous contingency data.

Contingency.threat_score([yes_category])

Returns the threat score(s) for dichotomous contingency data.

Multi-Category Metrics

Contingency.accuracy()

Returns the accuracy score(s) for a contingency table with K categories

Contingency.gerrity_score()

Returns Gerrity equitable score for a contingency table with K categories.

Contingency.heidke_score()

Returns the Heidke skill score(s) for a contingency table with K categories

Contingency.peirce_score()

Returns the Peirce skill score(s) (Hanssen and Kuipers discriminantor true skill statistic) for a contingency table with K categories.

roc(observations, forecasts[, bin_edges, ...])

Computes the relative operating characteristic for a range of thresholds.

Comparative

Tests to compare whether one forecast is significantly better than another one.

halfwidth_ci_test(forecasts1, forecasts2[, ...])

Returns the Jolliffe and Ebert significance test.

sign_test(forecasts1, forecasts2[, ...])

Returns the Delsole and Tippett sign test over the given time dimension.

Resampling

Functions for resampling from a dataset with or without replacement that create a new iteration dimension.

resample_iterations(forecast, iterations[, ...])

Resample over dim by index iterations times.

resample_iterations_idx(forecast, iterations)

Resample over dim by index iterations times.