Categorical Statistics Functions
Categorical Statistics Functions
- gval.statistics.categorical_stat_funcs.accuracy(tp: Number, tn: Number, fp: Number, fn: Number) float
Computes accuracy
- Parameters:
tp (Number) – Count reflecting true positive
tn (Number) – Count reflecting true negative
fp (Number) – Count reflecting false positive
fn (Number) – Count reflecting false negative
- Returns:
Accuracy from 0 to 1
- Return type:
float
References
- gval.statistics.categorical_stat_funcs.balanced_accuracy(tp: Number, tn: Number, fp: Number, fn: Number) float
Computes Balanced Accuracy
- Parameters:
tp (Number) – Count reflecting true positive
tn (Number) – Count reflecting true negative
fp (Number) – Count reflecting false positive
fn (Number) – Count reflecting false negative
- Returns:
Balanced Accuracy from 0 to 1
- Return type:
float
References
[1]
- gval.statistics.categorical_stat_funcs.critical_success_index(tp: Number, fp: Number, fn: Number) float
Computes critical success index
https://www.weather.gov/media/erh/ta2004-03.pdf
- Parameters:
tp (Number) – Count reflecting true positive
fp (Number) – Count reflecting false positive
fn (Number) – Count reflecting false negative
- Returns:
Critical success index from 0 to 1
- Return type:
float
References
[1]
- gval.statistics.categorical_stat_funcs.equitable_threat_score(tp: Number, tn: Number, fp: Number, fn: Number) float
Computes Equitable Threat Score (Gilbert Score)
- Parameters:
tp (Number) – Count reflecting true positive
tn (Number) – Count reflecting true negative
fp (Number) – Count reflecting false positive
fn (Number) – Count reflecting false negative
- Returns:
Equitable threat score from -1/3 to 1
- Return type:
float
References
[1]
- gval.statistics.categorical_stat_funcs.f_score(tp: Number, fp: Number, fn: Number) float
Computes F-score AKA harmonic mean of precision and sensitivity
- Parameters:
tp (Number) – Count reflecting true positive
fp (Number) – Count reflecting false positive
fn (Number) – Count reflecting false negative
- Returns:
F-score from 0 to 1
- Return type:
float
References
[1]
- gval.statistics.categorical_stat_funcs.false_discovery_rate(tp: Number, fp: Number) float
Computes false discovery rate
- Parameters:
tp (Number) – Count reflecting true positive
fp (Number) – Count reflecting false positive
- Returns:
False discovery rate from 0 to 1
- Return type:
float
References
[1]
- gval.statistics.categorical_stat_funcs.false_negative_rate(tp: Number, fn: Number) float
Computes false negative rate
- Parameters:
tp (Number) – Count reflecting true positive
fn (Number) – Count reflecting false negative
- Returns:
False negative rate from 0 to 1
- Return type:
float
References
[1]
- gval.statistics.categorical_stat_funcs.false_omission_rate(tn: Number, fn: Number) float
Computes false omission rate
- Parameters:
tn (Number) – Count reflecting true negative
fn (Number) – Count reflecting false negative
- Returns:
False omission rate from 0 to 1
- Return type:
float
References
[1]
- gval.statistics.categorical_stat_funcs.false_positive_rate(tn: Number, fp: Number) float
Computes false positive rate AKA fall-out
- Parameters:
tn (Number) – Count reflecting true negative
fp (Number) – Count reflecting false positive
- Returns:
False positive rate from 0 to 1
- Return type:
float
References
[1]
- gval.statistics.categorical_stat_funcs.fowlkes_mallows_index(tp: Number, fp: Number, fn: Number) float
Computes Fowlkes-Mallows index
- Parameters:
tp (Number) – Count reflecting true positive
fp (Number) – Count reflecting false positive
fn (Number) – Count reflecting false negative
- Returns:
Correlation coefficient from -1 to 1
- Return type:
float
References
[1]
- gval.statistics.categorical_stat_funcs.matthews_correlation_coefficient(tp: Number, tn: Number, fp: Number, fn: Number) float
Computes matthews correlation coefficient, accounting for accuracy and precision of both true positives and true negatives AKA Phi Coefficient
- Parameters:
tp (Number) – Count reflecting true positive
tn (Number) – Count reflecting true negative
fp (Number) – Count reflecting false positive
fn (Number) – Count reflecting false negative
- Returns:
Correlation coefficient from -1 to 1
- Return type:
float
References
[1]
- gval.statistics.categorical_stat_funcs.negative_likelihood_ratio(tp: Number, tn: Number, fp: Number, fn: Number) float
Computes negative likelihood ratio
- Parameters:
tp (Number) – Count reflecting true positive
tn (Number) – Count reflecting true negative
fp (Number) – Count reflecting false positive
fn (Number) – Count reflecting false negative
- Returns:
Negative likelihood from 1 to infinity
- Return type:
float
References
[1]
- gval.statistics.categorical_stat_funcs.negative_predictive_value(tn: Number, fn: Number) float
Computes negative predictive value
- Parameters:
tn (Number) – Count reflecting true negative
fn (Number) – Count reflecting false negative
- Returns:
Negative predictive value from 0 to 1
- Return type:
float
References
[1]
- gval.statistics.categorical_stat_funcs.overall_bias(tp: Number, fp: Number, fn: Number) float
Computes the degree of correspondence between the mean forecast and the mean observation.
- Parameters:
tp (Number) – Count reflecting true positive
fp (Number) – Count reflecting false positive
fn (Number) – Count reflecting false negative
- Returns:
Overall Bias
- Return type:
float
References
[1]
- gval.statistics.categorical_stat_funcs.positive_likelihood_ratio(tp: Number, tn: Number, fp: Number, fn: Number) float
Computes positive likelihood ratio
- Parameters:
tp (Number) – Count reflecting true positive
tn (Number) – Count reflecting true negative
fp (Number) – Count reflecting false positive
fn (Number) – Count reflecting false negative
- Returns:
Positive likelihood rate from 1 to infinity
- Return type:
float
References
[1]
- gval.statistics.categorical_stat_funcs.positive_predictive_value(tp: Number, fp: Number) float
Computes positive predictive value AKA precision
- Parameters:
tp (Number) – Count reflecting true positive
fp (Number) – Count reflecting false positive
- Returns:
Positive predictive value from 0 to 1
- Return type:
float
References
[1]
- gval.statistics.categorical_stat_funcs.prevalence(tp: Number, tn: Number, fp: Number, fn: Number) float
Computes prevalence
- Parameters:
tp (Number) – Count reflecting true positive
tn (Number) – Count reflecting true negative
fp (Number) – Count reflecting false positive
fn (Number) – Count reflecting false negative
- Returns:
Prevalence from 0 to 1
- Return type:
float
References
[1]
- gval.statistics.categorical_stat_funcs.prevalence_threshold(tp: Number, tn: Number, fp: Number, fn: Number) float
Computes prevalence threshold
- Parameters:
tp (Number) – Count reflecting true positive
tn (Number) – Count reflecting true negative
fp (Number) – Count reflecting false positive
fn (Number) – Count reflecting false negative
- Returns:
Prevalence threshold from 0 to 1
- Return type:
float
References
[1]
- gval.statistics.categorical_stat_funcs.true_negative_rate(tn: Number, fp: Number) float
Computes true negative rate, AKA specificity, selectivity
- Parameters:
tn (Number) – Count reflecting true negative
fp (Number) – Count reflecting false positive
- Returns:
True negative rate from 0 to 1
- Return type:
float
References
[1]
- gval.statistics.categorical_stat_funcs.true_positive_rate(tp: Number, fn: Number) float
Computes true positive rate, AKA sensitivity, recall, hit rate
- Parameters:
tp (Number) – Count reflecting true positive
fn (Number) – Count reflecting false negative
- Returns:
True positive rate from 0 to 1
- Return type:
float
References
[1]