diff --git a/extreme_fit/model/result_from_model_fit/abstract_result_from_model_fit.py b/extreme_fit/model/result_from_model_fit/abstract_result_from_model_fit.py index c22ed7965dd366e2110614b111c9da1e8605839a..1606dfbaf8b0908b5b845647680ff7b5d008d4ba 100644 --- a/extreme_fit/model/result_from_model_fit/abstract_result_from_model_fit.py +++ b/extreme_fit/model/result_from_model_fit/abstract_result_from_model_fit.py @@ -43,7 +43,7 @@ class AbstractResultFromModelFit(object): @property def deviance(self): - return - 2 * self.nllh + return 2 * self.nllh @property def bic(self): diff --git a/extreme_trend/abstract_gev_trend_test.py b/extreme_trend/abstract_gev_trend_test.py index b31820f38db712a527f8d71c047b7f30413b1388..dc8f22d89180f1b9c65820d810eeb54556537fe6 100644 --- a/extreme_trend/abstract_gev_trend_test.py +++ b/extreme_trend/abstract_gev_trend_test.py @@ -76,12 +76,14 @@ class AbstractGevTrendTest(object): @property def aic(self): - # deviance = - 2 * nllh - return 2 * self.total_number_of_parameters_for_unconstrained_model - self.unconstrained_model_deviance + aic = 2 * self.total_number_of_parameters_for_unconstrained_model + self.unconstrained_model_deviance + assert np.equal(self.unconstrained_estimator.result_from_model_fit.aic, aic) + return aic @property def likelihood_ratio(self): - return self.unconstrained_model_deviance - self.constrained_model_deviance + assert self.unconstrained_model_deviance < self.constrained_model_deviance + return self.constrained_model_deviance - self.unconstrained_model_deviance @property def constrained_model_deviance(self): @@ -98,14 +100,6 @@ class AbstractGevTrendTest(object): else: return unconstrained_estimator.result_from_model_fit.deviance - @property - def unconstained_nllh(self): - unconstrained_estimator = self.unconstrained_estimator - if self.crashed: - return np.nan - else: - return unconstrained_estimator.result_from_model_fit.nllh - # Evolution of the GEV parameters and corresponding quantiles @property diff --git a/projects/exceeding_snow_loads/section_results/main_result_trends_and_return_levels.py b/projects/exceeding_snow_loads/section_results/main_result_trends_and_return_levels.py index 3a4268409182d149b74b91f9db0fe123dbec3791..ab830a32368616df25ea7d967be1cb745e5637cf 100644 --- a/projects/exceeding_snow_loads/section_results/main_result_trends_and_return_levels.py +++ b/projects/exceeding_snow_loads/section_results/main_result_trends_and_return_levels.py @@ -1,6 +1,9 @@ from multiprocessing.pool import Pool import matplotlib as mpl + +from projects.exceeding_snow_loads.section_results.plot_trend_curves import plot_trend_map + mpl.rcParams['text.usetex'] = True mpl.rcParams['text.latex.preamble'] = [r'\usepackage{amsmath}'] @@ -61,9 +64,9 @@ def intermediate_result(altitudes, massif_names=None, _ = compute_minimized_aic(visualizer) # Plots - # plot_trend_map(altitude_to_visualizer) + plot_trend_map(altitude_to_visualizer) # plot_trend_curves(altitude_to_visualizer={a: v for a, v in altitude_to_visualizer.items() if a >= 900}) - plot_uncertainty_massifs(altitude_to_visualizer) + # plot_uncertainty_massifs(altitude_to_visualizer) # plot_uncertainty_histogram(altitude_to_visualizer) # plot_selection_curves(altitude_to_visualizer) # uncertainty_interval_size(altitude_to_visualizer) @@ -72,7 +75,8 @@ def intermediate_result(altitudes, massif_names=None, def major_result(): uncertainty_methods = [ConfidenceIntervalMethodFromExtremes.my_bayes, ConfidenceIntervalMethodFromExtremes.ci_mle][1:] - massif_names = ['Beaufortain', 'Vercors'] + # massif_names = ['Beaufortain', 'Vercors'] + massif_names = None study_classes = paper_study_classes[:1] # model_subsets_for_uncertainty = [ModelSubsetForUncertainty.stationary_gumbel, # ModelSubsetForUncertainty.stationary_gumbel_and_gev,