# 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¶

 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. 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. effective_sample_size(a, b[, dim, skipna, …]) Effective sample size for temporally correlated data. r2(a, b[, dim, weights, skipna, keep_attrs]) R^2 (coefficient of determination) score.

### Distance Metrics¶

 rmse(a, b[, dim, weights, skipna, keep_attrs]) Root Mean Squared Error. mse(a, b[, dim, weights, skipna, keep_attrs]) Mean Squared Error. mae(a, b[, dim, weights, skipna, keep_attrs]) Mean Absolute Error. median_absolute_error(a, b[, dim, skipna, …]) Median Absolute Error. smape(a, b[, dim, weights, skipna, keep_attrs]) Symmetric Mean Absolute Percentage Error. mape(a, b[, dim, weights, skipna, keep_attrs]) 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[, dim, …]) 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(x, cdf_or_dist[, xmin, …]) Continuous Ranked Probability Score with numerical integration of the normal distribution. threshold_brier_score(observations, …[, …]) Calculate the Brier scores of an ensemble for exceeding given thresholds. rps(observations, forecasts, category_edges) Calculate Ranked Probability Score. rank_histogram(observations, forecasts[, …]) Returns the rank histogram (Talagrand diagram) along the specified dimensions. discrimination(observations, forecasts[, …]) Returns the data required to construct the discrimination diagram for an event; the histogram of forecasts likelihood when observations indicate an event has occurred and has not occurred. reliability(observations, forecasts[, dim, …]) Returns the data required to construct the reliability diagram for an event; the relative frequencies of occurrence of an event for a range of forecast probability bins

## 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

### Dichotomous-Only (yes/no) Metrics¶

 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.false_alarms([yes_category]) Returns the number of false alarms (false positives) for dichotomous contingency data. Contingency.correct_negatives([yes_category]) Returns the number of correct negatives (true negatives) for dichotomous contingency data. Contingency.bias_score([yes_category]) Returns the bias score(s) for dichotomous contingency data Contingency.hit_rate([yes_category]) Returns the hit rate(s) (probability of detection) for dichotomous contingency data. Contingency.false_alarm_ratio([yes_category]) Returns the false alarm ratio(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.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. Contingency.equit_threat_score([yes_category]) Returns the equitable threat score(s) for dichotomous contingency data. Contingency.odds_ratio([yes_category]) Returns the odds ratio(s) for dichotomous contingency data Returns the odds ratio skill score(s) for dichotomous contingency data

### Multi-Category Metrics¶

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