Skip to content

Commit

Permalink
Updating the Concentration ROC diagram and adding the ROC and Molchga…
Browse files Browse the repository at this point in the history
…n plots using the alarm-based approach (#254)

* introduction of Contingency Molchan and ROC diagrams

I added the code to plot the contingency_ROC and the contingency_Molchan in the .\csep\utils\plots.py.
I also inserted the two funcions in the tutorial of "gridded_forecast_evaluation.py"

* Tutorial to draw the contingency_ROC and Molchan diagrams

i inserted the two function in the example "gridded_forecast_evaluation.py"

* Upgrade ROC diagram and new plots Molchan and ROC diagrams.

* fixed plot_gridded_forecast.py

updated function name call

* updated function names in  gridded_forecast_evaluation.py

* removed plot_roc_diagram from plot_gridded_forecast.py

---------

Co-authored-by: Pablo Iturrieta <[email protected]>
  • Loading branch information
Biondini and pabloitu authored Jun 10, 2024
1 parent 20be367 commit 21d275c
Show file tree
Hide file tree
Showing 9 changed files with 1,451 additions and 7 deletions.
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.

0 comments on commit 21d275c

Please sign in to comment.