Closed eastjames closed 1 year ago
Thank you. A few requests:
fixed_parameters
Added a new commit to address these points
Patch coverage: 100.00
% and no project coverage change.
Comparison is base (
b8cf576
) 100.00% compared to head (0797aff
) 100.00%.
:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Do you have feedback about the report comment? Let us know in this issue.
Thank you James. I have reviewed the PR and I realized that I previously misunderstood the problem. A fix still needs to be pushed however, let me elaborate.
I reviewed ks test implementation and I think it's correct. The idea is that you pass sample (extremes), distribution, and fit parameters. Fit parameters are used to convert distribution's CDF function of quantiles + fit parameters to a function of only quantiles - this produces a function of only quantiles. Fit parameters has all parameters (free and fixed). Because of this, we shouldn't be modifying the KolmogorovSmirnov
class itself.
Regarding the original issue. Pyextremes EVA
class works by doing the following:
ExtremesTransformer
classfit_parameters
attribute, which has estimated parametersfixed_parameters
, which has frozen (e.g., floc
) parameters.Where the issue truly lies is how the EVA.test_ks
method is implemented. To summarize:
KolmogorovSmirnov
expects a sample, distribution, and all (free and fixed) parametersEVA
has raw extremes and transformed extremes (we must use transformed because that's what fit parameters are for)EVA.model
has fit parameters which are only free parameters (bad choice of terminology on my end)What we need to do is to change the EVA.test_ks
method to pass the following to KolmogorovSmirnov
:
self.extremes_transformer.transformed_extremes
to extremes
self.model.fit_parameters
(this is the same as self.model.distribution.mle_parameters
) combined with self.model.distribution.fixed_parameters
to fit_parameters
- this way we will be passing all (free and fixed) parametersMy apologies for sending you on a wild goose chase earlier. Please let me know if you would be willing to revert the changes and update code.
George, thank you for the clarification. I see why changes to KolmogorovSmirnov
class aren't needed -- I've changed the PR to only have the necessary changes to EVA.test_ks
.
Using the term fit_parameters
to mean (very slightly) different things in different places of the code is a bit confusing. However, you've already noted this and I think it is outside the scope of this PR!
This pull request fixes the KS Test by providing the location (fixed) parameters and resolves issue #39.