Skip to content

Commit

Permalink
Tutorial to draw the contingency_ROC and Molchan diagrams
Browse files Browse the repository at this point in the history
i inserted the two function in the example "gridded_forecast_evaluation.py"
  • Loading branch information
Biondini committed Apr 24, 2024
1 parent 6ee4ca3 commit a470b25
Showing 1 changed file with 25 additions and 2 deletions.
27 changes: 25 additions & 2 deletions examples/tutorials/gridded_forecast_evaluation.py
Original file line number Diff line number Diff line change
Expand Up @@ -115,13 +115,36 @@
# The "True Positive Rate" is the normalized cumulative area. The dashed line is the ROC curve for a uniform forecast,
# meaning the likelihood for an earthquake to occur at any position is the same. The further the ROC curve of a
# forecast is to the uniform forecast, the specific the forecast is. When comparing the
# forecast ROC curve against an catalog, one can evaluate if the forecast is more or less specific
# 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.

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




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

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_contingency_ROC(forecast, catalog, linear=False)

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_contingency_Molchan(forecast, catalog, linear=False)




####################################################################################################################################
# Calculate Kagan's I_1 score
Expand Down

0 comments on commit a470b25

Please sign in to comment.