Add automatic copula family selection - #436
Open
Santymax98 wants to merge 1 commit into
Open
Conversation
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #436 +/- ##
==========================================
+ Coverage 86.07% 86.98% +0.90%
==========================================
Files 91 91
Lines 7764 7852 +88
==========================================
+ Hits 6683 6830 +147
+ Misses 1081 1022 -59 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
Contributor
Author
|
I think this PR should be revisited once #435 is resolved and merged. Since the fitting/test infrastructure has changed on current I’ll back to it once #435 is settled. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Hi Oskar,
This is the other independent part I mentioned in #435.
I originally developed the hypothesis-testing framework and automatic family selection together, but I think separating them makes the API much easier to review. This PR does not depend on #435, so either one can be merged first.
The idea here is to allow family selection directly through the existing fitting interface:
Instead of introducing a separate model-selection object or fitting abstraction,
Copulaacts as the request to compare candidate families using the sameCopulaModelmachinery that is already available.The supported criteria are:
The candidate fits are evaluated first without the additional inference cost, the best eligible family is selected according to the requested criterion, and the winning family is then fitted normally with the options requested by the user.
The returned object is still a regular
CopulaModel, with the additional selection metadata stored inmethod_details.The complete comparison can be inspected with:
selectiontable(M)which keeps the candidate family, fitting method, convergence/status information, log-likelihood, number of parameters, and the information criteria for each candidate.
There are also two built-in candidate collections:
while an explicit tuple can be used when only a scientifically meaningful subset of families should be considered.
I think this is also a nice example of extending the existing fitting API without introducing another parallel interface: the result still behaves exactly like any other
CopulaModel.There is one particularly interesting connection with #435 that I intentionally left out of both PRs.
Once #435 and this PR are merged, a small follow-up could implement goodness-of-fit after model selection. We already had this case in the combined implementation, roughly:
The important point is that this is not the same as ordinary composite GOF. Under automatic model selection, each parametric-bootstrap replicate should reproduce the complete procedure:
So that follow-up would be a concrete example of the two APIs composing naturally: this PR provides the model-selection procedure, while #435 provides the hypothesis/statistic/calibration framework.
I left that integration out intentionally so both APIs can be reviewed independently first. If both are merged, I can send the selection-aware GOF part as a much smaller follow-up PR.
And no rush with this one either — especially with #434 and #435 already on your plate :)