An error occurred while loading the file. Please try again.
-
guillaume.garbay authoredc5ea7333
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
from extreme_estimator.extreme_models.margin_model.abstract_margin_model import AbstractMarginModel
from extreme_estimator.extreme_models.margin_model.smooth_margin_model import LinearMarginModel
from extreme_estimator.extreme_models.max_stable_model.abstract_max_stable_model import AbstractMaxStableModel
from extreme_estimator.estimator.abstract_estimator import AbstractEstimator
from extreme_estimator.estimator.margin_estimator import SmoothMarginEstimator
from extreme_estimator.estimator.max_stable_estimator import MaxStableEstimator
from spatio_temporal_dataset.dataset.abstract_dataset import AbstractDataset
class AbstractFullEstimator(AbstractEstimator):
pass
class SmoothMarginalsThenUnitaryMsp(AbstractFullEstimator):
def __init__(self, dataset: AbstractDataset, margin_model: LinearMarginModel,
max_stable_model: AbstractMaxStableModel):
super().__init__(dataset)
# Instantiate the two associated estimators
self.margin_estimator = SmoothMarginEstimator(dataset=dataset, margin_model=margin_model)
self.max_stable_estimator = MaxStableEstimator(dataset=dataset, max_stable_model=max_stable_model)
def _fit(self):
# Estimate the margin parameters
self.margin_estimator.fit()
# Compute the maxima_frech
maxima_frech = AbstractMarginModel.gev2frech(maxima_gev=self.dataset.maxima_gev,
coordinates_values=self.dataset.coordinates_values,
margin_function=self.margin_estimator.margin_function_fitted)
# Update maxima frech field through the dataset object
self.dataset.maxima_frech = maxima_frech
# Estimate the max stable parameters
self.max_stable_estimator.fit()
class FullEstimatorInASingleStep(AbstractFullEstimator):
pass
class FullEstimatorInASingleStepWithSmoothMargin(AbstractFullEstimator):
"""The method of Gaume, check if its method is in a single step or not"""
def __init__(self, dataset: AbstractDataset, margin_model: LinearMarginModel,
max_stable_model: AbstractMaxStableModel):
super().__init__(dataset)
self.max_stable_model = max_stable_model
self.smooth_margin_function_to_fit = margin_model.margin_function_start_fit
def _fit(self):
# Estimate both the margin and the max-stable structure
self.full_params_fitted = self.max_stable_model.fitmaxstab(
maxima_frech=self.dataset.maxima_frech,
df_coordinates=self.dataset.df_coordinates,
fit_marge=True,
fit_marge_form_dict=self.smooth_margin_function_to_fit.fit_marge_form_dict,
margin_start_dict=self.smooth_margin_function_to_fit.margin_start_dict
)
# Initialize
class PointwiseAndThenUnitaryMsp(AbstractFullEstimator):
pass
class StochasticExpectationMaximization(AbstractFullEstimator):
pass
class INLAgoesExtremes(AbstractFullEstimator):
pass