Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
40 changes: 20 additions & 20 deletions src/scores/categorical/contingency_impl.py
Original file line number Diff line number Diff line change
Expand Up @@ -245,7 +245,7 @@ def accuracy(self) -> xr.DataArray:
- "False negatives" is the same as "misses".

References:
https://www.cawcr.gov.au/projects/verification/#ACC
https://jwgfvr.github.io/forecastverification/index.html#ACC
"""
count_dictionary = self.counts
correct_count = count_dictionary["tp_count"] + count_dictionary["tn_count"]
Expand Down Expand Up @@ -318,7 +318,7 @@ def fraction_correct(self) -> xr.DataArray:
- "True negatives" is the same as "correct negatives".

References:
https://www.cawcr.gov.au/projects/verification/#ACC
https://jwgfvr.github.io/forecastverification/index.html#ACC
"""
return self.accuracy()

Expand All @@ -341,7 +341,7 @@ def frequency_bias(self) -> xr.DataArray:
- "False negatives" is the same as "misses".

References:
https://www.cawcr.gov.au/projects/verification/#BIAS
https://jwgfvr.github.io/forecastverification/index.html#BIAS
""" # noqa: E501
# Note - bias_score calls this method
cd = self.counts
Expand All @@ -368,7 +368,7 @@ def bias_score(self) -> xr.DataArray:
- "False negatives" is the same as "misses".

References:
https://www.cawcr.gov.au/projects/verification/#BIAS
https://jwgfvr.github.io/forecastverification/index.html#BIAS
""" # noqa: E501
return self.frequency_bias()

Expand All @@ -391,7 +391,7 @@ def hit_rate(self) -> xr.DataArray:
- "False negatives" is the same as "misses".

References:
https://www.cawcr.gov.au/projects/verification/#POD
https://jwgfvr.github.io/forecastverification/index.html#POD
""" # noqa: E501
return self.probability_of_detection()

Expand All @@ -414,7 +414,7 @@ def probability_of_detection(self) -> xr.DataArray:
- "False negatives" is the same as "misses"

References:
https://www.cawcr.gov.au/projects/verification/#POD
https://jwgfvr.github.io/forecastverification/index.html#POD
""" # noqa: E501
# Note - hit_rate and sensitiviy call this function
cd = self.counts
Expand All @@ -441,7 +441,7 @@ def true_positive_rate(self) -> xr.DataArray:
- "False negatives" is the same as "misses".

References:
https://www.cawcr.gov.au/projects/verification/#POD
https://jwgfvr.github.io/forecastverification/index.html#POD
""" # noqa: E501
return self.probability_of_detection()

Expand All @@ -463,7 +463,7 @@ def false_alarm_ratio(self) -> xr.DataArray:
- "True positives" is the same as "hits".

References:
https://www.cawcr.gov.au/projects/verification/#FAR
https://jwgfvr.github.io/forecastverification/index.html#FAR
""" # noqa: E501
cd = self.counts
far = cd["fp_count"] / (cd["tp_count"] + cd["fp_count"])
Expand All @@ -489,7 +489,7 @@ def false_alarm_rate(self) -> xr.DataArray:
- "True negatives" is the same as "correct negatives".

References:
https://www.cawcr.gov.au/projects/verification/#POFD
https://jwgfvr.github.io/forecastverification/index.html#POFD
""" # noqa: E501
# Note - probability of false detection calls this function
cd = self.counts
Expand All @@ -516,7 +516,7 @@ def probability_of_false_detection(self) -> xr.DataArray:
- "True negatives" is the same as "correct negatives".

References:
https://www.cawcr.gov.au/projects/verification/#POFD
https://jwgfvr.github.io/forecastverification/index.html#POFD
""" # noqa: E501

return self.false_alarm_rate()
Expand All @@ -540,7 +540,7 @@ def success_ratio(self) -> xr.DataArray:
- "False positives" is the same as "false alarms".

References:
https://www.cawcr.gov.au/projects/verification/#SR
https://jwgfvr.github.io/forecastverification/index.html#SR
"""
cd = self.counts
sr = cd["tp_count"] / (cd["tp_count"] + cd["fp_count"])
Expand All @@ -565,7 +565,7 @@ def threat_score(self) -> xr.DataArray:
- "True negatives" is the same as "correct negatives".

References:
https://www.cawcr.gov.au/projects/verification/#CSI
https://jwgfvr.github.io/forecastverification/index.html#CSI
"""
# Note - critical success index just calls this method

Expand All @@ -592,7 +592,7 @@ def critical_success_index(self) -> xr.DataArray:
- "True negatives" is the same as "correct negatives"

References:
https://www.cawcr.gov.au/projects/verification/#CSI
https://jwgfvr.github.io/forecastverification/index.html#CSI
"""
return self.threat_score()

Expand All @@ -618,7 +618,7 @@ def peirce_skill_score(self) -> xr.DataArray:
- "True negatives" is the same as "correct negatives".

References:
- https://www.cawcr.gov.au/projects/verification/#HK
- https://jwgfvr.github.io/forecastverification/index.html#HK
- Peirce, C.S., 1884. The numerical measure of the success of predictions. \
Science, ns-4(93), pp.453-454. https://doi.org/10.1126/science.ns-4.93.453.b
"""
Expand Down Expand Up @@ -650,7 +650,7 @@ def true_skill_statistic(self) -> xr.DataArray:
- "True negatives" is the same as "correct negatives".

References:
https://www.cawcr.gov.au/projects/verification/#HK
https://jwgfvr.github.io/forecastverification/index.html#HK
"""
return self.peirce_skill_score()

Expand Down Expand Up @@ -678,7 +678,7 @@ def hanssen_and_kuipers_discriminant(self) -> xr.DataArray:
- "True negatives" is the same as "correct negatives".

References:
https://www.cawcr.gov.au/projects/verification/#HK
https://jwgfvr.github.io/forecastverification/index.html#HK
"""
return self.peirce_skill_score()

Expand All @@ -702,7 +702,7 @@ def sensitivity(self) -> xr.DataArray:
- "False negatives" is the same as "misses".

References:
- https://www.cawcr.gov.au/projects/verification/#POD
- https://jwgfvr.github.io/forecastverification/index.html#POD
- https://en.wikipedia.org/wiki/Sensitivity_and_specificity
- Monaghan, T. F., Rahman, S. N., Agudelo, C. W., Wein, A. J., Lazar, J. M., Everaert, K.,
& Dmochowski, R. R. (2021).
Expand Down Expand Up @@ -780,7 +780,7 @@ def recall(self) -> xr.DataArray:
- "False negatives" is the same as "misses".

References:
- https://www.cawcr.gov.au/projects/verification/#POD
- https://jwgfvr.github.io/forecastverification/index.html#POD
- https://en.wikipedia.org/wiki/Precision_and_recall
"""
return self.probability_of_detection()
Expand All @@ -803,7 +803,7 @@ def precision(self) -> xr.DataArray:
- "False positives" is the same as "false alarms".

References:
- https://www.cawcr.gov.au/projects/verification/#SR
- https://jwgfvr.github.io/forecastverification/index.html#SR
- https://en.wikipedia.org/wiki/Precision_and_recall

"""
Expand All @@ -827,7 +827,7 @@ def positive_predictive_value(self) -> xr.DataArray:
- "False positives" is the same as "false alarms".

References:
- https://www.cawcr.gov.au/projects/verification/#SR
- https://jwgfvr.github.io/forecastverification/index.html#SR
- https://en.wikipedia.org/wiki/Positive_and_negative_predictive_values
- Monaghan, T. F., Rahman, S. N., Agudelo, C. W., Wein, A. J., Lazar, J. M., Everaert, K.,
& Dmochowski, R. R. (2021).
Expand Down