Commit debd8caf authored by Le Roux Erwan's avatar Le Roux Erwan
Browse files

[projection snowfall] refactor nb_params.

parent bd486a7e
No related merge requests found
Showing with 3 additions and 7 deletions
+3 -7
......@@ -35,10 +35,6 @@ class LinearMarginModel(ParametricMarginModel):
param_name_and_dim_to_coef[(param_name, dim)] = default_slope
return param_name_and_dim_to_coef
@property
def nb_params(self):
return self.margin_function.nb_params
def param_name_to_linear_coef(self, param_name_and_dim_to_coef):
param_name_to_linear_coef = {}
param_names = list(set([e[0] for e in param_name_and_dim_to_coef.keys()]))
......
......@@ -296,7 +296,7 @@ class OneFoldFit(object):
@property
def degree_freedom_chi2(self):
return self.best_estimator.margin_model.nb_params - self.stationary_estimator.margin_model.nb_params
return self.best_estimator.nb_params - self.stationary_estimator.nb_params
@cached_property
def is_significant(self) -> bool:
......
......@@ -101,7 +101,7 @@ class AbstractGevTrendTest(object):
@property
def aic(self):
aic = 2 * self.total_number_of_parameters_for_unconstrained_model + self.unconstrained_model_deviance
assert np.equal(self.total_number_of_parameters_for_unconstrained_model, self.unconstrained_estimator.margin_model.nb_params)
assert np.equal(self.total_number_of_parameters_for_unconstrained_model, self.unconstrained_estimator.nb_params)
npt.assert_almost_equal(self.unconstrained_estimator.result_from_model_fit.aic, aic, decimal=5)
npt.assert_almost_equal(self.unconstrained_estimator.aic(), aic, decimal=5)
return aic
......
......@@ -63,7 +63,7 @@ class TestEnsembleFit(unittest.TestCase):
}
for model_class in model_classes:
expected = model_class_to_expected_number_params[model_class]
found = model_class_to_estimator[model_class].margin_model.nb_params
found = model_class_to_estimator[model_class].nb_params
self.assertEqual(expected, found)
# _ = ensemble_fit.visualizer.massif_name_to_one_fold_fit[self.massif_names[0]].best_function_from_fit
......
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