Commit 1ad6b86c authored by Le Roux Erwan's avatar Le Roux Erwan
Browse files

[contrasting project] fix the definition of deviance. and adapt the code accordingly

parent 8938b42f
No related merge requests found
Showing with 13 additions and 15 deletions
+13 -15
......@@ -43,7 +43,7 @@ class AbstractResultFromModelFit(object):
@property
def deviance(self):
return - 2 * self.nllh
return 2 * self.nllh
@property
def bic(self):
......
......@@ -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
......
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,
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment