Commit 0bc9188a authored by Le Roux Erwan's avatar Le Roux Erwan
Browse files

[contrasting] aic and bic test ok for my first model combining a linearity in...

[contrasting] aic and bic test ok for my first model combining a linearity in 2 different coordinates.
parent b0b998e4
No related merge requests found
Showing with 4 additions and 19 deletions
+4 -19
......@@ -37,7 +37,8 @@ class PolynomialAllCoef(LinearCoef):
if self.dim_to_polynomial_coef is None:
return 1
else:
return sum([c.nb_params for c in self.dim_to_polynomial_coef.values()])
nb_redundant_intercept = len(self.dim_to_polynomial_coef) - 1
return sum([c.nb_params for c in self.dim_to_polynomial_coef.values()]) - nb_redundant_intercept
@property
def intercept(self) -> float:
......
......@@ -45,27 +45,11 @@ class TestGevTemporalQuadraticExtremesMle(unittest.TestCase):
return estimator
def test_location_spatio_temporal_linearity(self):
# Create estimator
# estimator = fitted_linear_margin_estimator(model_class,
# self.coordinates, self.dataset,
# starting_year=0,
# fit_method=self.fit_method)
# # Checks that parameters returned are indeed different
# mle_params_estimated_year1 = estimator.function_from_fit.get_params(np.array([1])).to_dict()
# mle_params_estimated_year3 = estimator.function_from_fit.get_params(np.array([21])).to_dict()
# mle_params_estimated_year5 = estimator.function_from_fit.get_params(np.array([41])).to_dict()
# self.assertNotEqual(mle_params_estimated_year1, mle_params_estimated_year3)
# self.assertNotEqual(mle_params_estimated_year3, mle_params_estimated_year5)
# # Assert the relationship for the location is indeed quadratic
# diff1 = mle_params_estimated_year1[quadratic_param] - mle_params_estimated_year3[quadratic_param]
# diff2 = mle_params_estimated_year3[quadratic_param] - mle_params_estimated_year5[quadratic_param]
# self.assertNotAlmostEqual(diff1, diff2)
estimator = self.get_estimator_fitted(NonStationaryLocationSpatioTemporalLinearityModel)
# Assert that indicators are correctly computed
self.assertAlmostEqual(estimator.result_from_model_fit.nllh, estimator.nllh(split=estimator.train_split))
# self.assertAlmostEqual(estimator.result_from_model_fit.aic, estimator.aic())
# self.assertAlmostEqual(estimator.result_from_model_fit.bic, estimator.bic())
self.assertAlmostEqual(estimator.result_from_model_fit.aic, estimator.aic(split=estimator.train_split))
self.assertAlmostEqual(estimator.result_from_model_fit.bic, estimator.bic(split=estimator.train_split))
if __name__ == '__main__':
......
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