From 220ade60c02ee8df6179e4f6fadc157337fcf0b7 Mon Sep 17 00:00:00 2001
From: Le Roux Erwan <erwan.le-roux@irstea.fr>
Date: Tue, 16 Jun 2020 16:43:07 +0200
Subject: [PATCH] [contrasting] modify nllh code. and nb_params for gumbel
 models.

---
 .../estimator/margin_estimator/abstract_margin_estimator.py   | 2 +-
 .../linear_margin_model/temporal_linear_margin_models.py      | 4 ++++
 2 files changed, 5 insertions(+), 1 deletion(-)

diff --git a/extreme_fit/estimator/margin_estimator/abstract_margin_estimator.py b/extreme_fit/estimator/margin_estimator/abstract_margin_estimator.py
index bf20379c..5e36bfcd 100644
--- a/extreme_fit/estimator/margin_estimator/abstract_margin_estimator.py
+++ b/extreme_fit/estimator/margin_estimator/abstract_margin_estimator.py
@@ -55,7 +55,7 @@ class LinearMarginEstimator(AbstractMarginEstimator):
             assert len(
                 maximum) == 1, 'So far, only one observation for each coordinate, but code would be easy to change'
             maximum = maximum[0]
-            gev_params = self.function_from_fit.get_params(coordinate, is_transformed=False)
+            gev_params = self.function_from_fit.get_params(coordinate, is_transformed=True)
             p = gev_params.density(maximum)
             nllh -= np.log(p)
             assert not np.isinf(nllh)
diff --git a/extreme_fit/model/margin_model/linear_margin_model/temporal_linear_margin_models.py b/extreme_fit/model/margin_model/linear_margin_model/temporal_linear_margin_models.py
index c9626a48..fde5b9c6 100644
--- a/extreme_fit/model/margin_model/linear_margin_model/temporal_linear_margin_models.py
+++ b/extreme_fit/model/margin_model/linear_margin_model/temporal_linear_margin_models.py
@@ -126,6 +126,10 @@ class GumbelTemporalModel(StationaryTemporalModel):
         super().__init__(coordinates, params_user, starting_point, fit_method,
                          nb_iterations_for_bayesian_fit, params_initial_fit_bayesian, type_for_MLE="Gumbel")
 
+    @property
+    def nb_params(self):
+        return super().nb_params - 1
+
 
 class NonStationaryLocationGumbelModel(GumbelTemporalModel, NonStationaryLocationTemporalModel):
     pass
-- 
GitLab