Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

MESMER-X: thoughts on fg_fun_scale #583

Open
veni-vidi-vici-dormivi opened this issue Dec 18, 2024 · 0 comments
Open

MESMER-X: thoughts on fg_fun_scale #583

veni-vidi-vici-dormivi opened this issue Dec 18, 2024 · 0 comments

Comments

@veni-vidi-vici-dormivi
Copy link
Collaborator

veni-vidi-vici-dormivi commented Dec 18, 2024

TLDR: the current function to optimize for the scale is not optimal for all distributions but it is not worth changing it for now.

For a preliminary first guess for the scale of a distribution, we optimize the scale parameter such that it is close to the absolute deviations of the samples from the location:

def fg_fun_sca(self, x_sca):
x = np.copy(self.fg_coeffs)
x[self.fg_ind_sca] = x_sca
params = self.expr_fit.evaluate_params(x, self.data_pred)
loc, sca = params["loc"], params["scale"]
# ^ better to use that one instead of deviation, which is affected by the scale
dev = np.abs(self.data_targ - loc)
return np.sum((dev - sca) ** 2)

I wondered if instead of using absolute deviations, we should go for the squared deviations. It turns out that either option works better for specific distributions:

  • using squared deviations works better for distributions for whom the scale parameter is closely related to the squared deviations from the location (duh). This is for example the normal distribution where the scale parameter is equal to the variance of the samples (when the number of samples approaches inf). Others include
  • using absolute deviations works better for distributions for whom the scale parameter is more closely related to the absolute deviations. This includes the GEV and the Laplace distribution.

I tested it and indeed the first guess after this step improves for a normal distribution when switching to the squared deviations but worsens for the GEV. However, we do another fit for all parameters after this where the first guess is further improved and this worked well for my examples. Thus, I would not change anything for now, I just wanted to write this down to show the tradeoffs we are facing.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant