Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Updating the Concentration ROC diagram and adding the ROC and Molchgan plots using the alarm-based approach #254

Merged
merged 7 commits into from
Jun 10, 2024
Merged
Show file tree
Hide file tree
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
410 changes: 406 additions & 4 deletions csep/utils/plots.py

Large diffs are not rendered by default.

Binary file added examples/tutorials/contingency_roc_figure.pdf
Binary file not shown.
Binary file added examples/tutorials/contingency_roc_figure.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1,013 changes: 1,013 additions & 0 deletions examples/tutorials/example_spatial_test.json

Large diffs are not rendered by default.

35 changes: 32 additions & 3 deletions examples/tutorials/gridded_forecast_evaluation.py
Original file line number Diff line number Diff line change
Expand Up @@ -118,9 +118,38 @@
# When comparing the forecast ROC curve against a catalog, one can evaluate if the forecast is more or less specific (or smooth) at different level or seismic rate.
#
# Note: This figure just shows an example of plotting an ROC curve with a catalog forecast.
# If "linear=True" the diagram is represented using a linear x-axis.
# If "linear=False" the diagram is represented using a logarithmic x-axis.


print("Plotting concentration ROC curve")
_= plots.plot_concentration_ROC_diagram(forecast, catalog, linear=True)




####################################################################################################################################
# Plot ROC and Molchan curves using the alarm-based approach
# -----------------------
#In this script, we generate ROC diagrams and Molchan diagrams using the alarm-based approach to evaluate the predictive
#performance of models. This method exploits contingency table analysis to evaluate the predictive capabilities of
#forecasting models. By analysing the contingency table data, we determine the ROC curve and Molchan trajectory and
#estimate the Area Skill Score to assess the accuracy and reliability of the prediction models. The generated graphs
#visually represent the prediction performance.

# Note: If "linear=True" the diagram is represented using a linear x-axis.
# If "linear=False" the diagram is represented using a logarithmic x-axis.

print("Plotting ROC curve from the contingency table")
# Set linear True to obtain a linear x-axis, False to obtain a logical x-axis.
_ = plots.plot_ROC_diagram(forecast, catalog, linear=True)

print("Plotting Molchan curve from the contingency table and the Area Skill Score")
# Set linear True to obtain a linear x-axis, False to obtain a logical x-axis.
_ = plots.plot_Molchan_diagram(forecast, catalog, linear=True)



print("Plotting ROC curve")
_ = plots.plot_ROC(forecast, catalog)

####################################################################################################################################
# Calculate Kagan's I_1 score
Expand All @@ -130,4 +159,4 @@
# (see Kagan, YanY. [2009] Testing long-term earthquake forecasts: likelihood methods and error diagrams, Geophys. J. Int., v.177, pages 532-542).

I_1 = get_Kagan_I1_score(forecast, catalog)
print("I_1score is: ", I_1)
print("I_1score is: ", I_1)
Binary file added examples/tutorials/molchan_figure.pdf
Binary file not shown.
Binary file added examples/tutorials/molchan_figure.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added examples/tutorials/roc_figure.pdf
Binary file not shown.
Binary file added examples/tutorials/roc_figure.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading