Repository navigation
Conversation
|
Hello @josef-pkt! Thanks for updating this PR. We checked the lines you've touched for PEP 8 issues, and found:
|
|
names: we lose sorting if copulas are part of larger namespace, but "Copula" is more like "Model" and used in context. Do we put "BV" in name for bivariate?
|
|
This pull request introduces 3 alerts and fixes 2 when merging 850c728 into fb3e061 - view on LGTM.com new alerts:
fixed alerts:
|
|
possible ENH that works as usage and test case |
|
params/args #7254 has theta in mv elliptical copulas will have correlation matrix, but we might not want to estimate correlation matrix as part of full MLE. How do we handle fixed or frozen params? one of the original designs used update I have problems with args unpacking, naming Parameters that don't need to have the same shape should be args, unless we want to force them into matching arrays, like e.g. weights in WLS. When do we use methods of CopulaDistribution cannot have |
|
unit test for tawn doesn't have an asymmetric case evd: current code comment in unit test seems to apply only for tawn2, but should also be for tawn this needs another check trying example EV copula distribution with genextreme/gev margins R evd mine, current interface before refactoring: |
|
still undecided: I like (*) Pickands dependence function, or (inverse ?) Laplace transform for positive dependence in Archimedean, otherwise just "generator functions" but Laplace transform even has aside elliptical distributions also have "generator functions"
|
|
unpacking components is a mess in bivariate case we have unpacking bivariate copula functions need to be converted to use a single unpacking for marginal distributions:
conclusion: use np.asarray and assume iterating is along last axis. That makes it simpler. |
|
we have both options for methods in Copula classes, require a tuple like arg as currently in ArchimedeanCopula and copula_bv_ev (cdf), or allow individual args, so it needs to be called with For indvidual XXXCopula it would be nicer to have explicitly named args. The generator, transformation functions and methods use explicit arguments. How about nested copulas? I'm not a fan of #7254 doesn't have parameters/args in method, only in still undecided update I'm sticking with old copula functions, at top of module, will not be compatible anymore It's a bit messy because most current copulas only have a single parameter and we need to pack it. another problem with |
|
current decision on frozen args/params: make it all or nothing, i.e. cop args can be set in |
|
random thought: add class transforms.Chain to nest transformations g(f(x)) aside: scipy has uniform distribution |
| # Extreme Value Copulas | ||
| # ===================== | ||
|
|
||
| def copula_bv_ev(u, v, transform, args=()): |
There was a problem hiding this comment.
Why not put these in their own module, so that you would have
distributions/copula/init.py
distributions/copula/bv.py
distributions/copula/mv.py
< and possibly others>
There was a problem hiding this comment.
Right now my plan was only to have two modules, not to build a full copula package, and I thought a longer namespace is not needed. If we plan to add nested and vine copulas, then this would get larger. But I will not be working on those.
(in an old private refactoring of sandbox.distributions, I had added subdirectories.)
bv and mv cannot be split nicely because it's mainly computational restrictions case by case, and I don't know yet how far we will get with mv.
There was a problem hiding this comment.
Checking my old code.
I have many subdirectories of sandbox.distributions, but most only contain one or two modules
There was a problem hiding this comment.
As a first step I would also restrict this to the bivariate case. Except for Gaussian, independent and t which can easily be n-dim. Otherwise it's a too big enterprise IMO
| License: BSD-3 | ||
|
|
||
| """ | ||
|
|
There was a problem hiding this comment.
Would also make more sense to be in distributions/copula/transforms.py rather than using file names to sort of create namespace.
|
when I move dEV Pickand's dependence function into transforms, I didn't think about that they are not monotonic, they are u-shaped and we don't need inverse functions. They only have one side of the transform, we still need deriv. If we use a copula subdirectory, then we can add a separate module for ev_generators or pdep_functions. subdirectory yes or no? If we get closer to https://github.com/blent-ai/pycopula/tree/master/pycopula and https://github.com/sdv-dev/Copulas/tree/master/copulas then we need more modules Currently we only need two modules, but that limits expanding this part. Our copula is just tools, distribution code, models and applications will go somewhere else. If we do a full splitting of copulas, then we need to decide on api access paths, i.e. do we make private modules, estimation/fit:
|
|
We also still need some diagnostics module, e.g. gof and estimators for pickands dependence function related then, do we get a sandbox has multivariate normal and multivariate t, now largely superseded by scipy distributions. subdirectory I don't like large number of public modules ArchimedeanCopula and ExtremeValueCopula might need to go into the corresponding module, not in base. What does |
|
restriction to bivariate @tupui In your PR cdf and pdf use sum and products. We need to check which are valid for more than bivariate. ev copulas are only BV and more difficult to extend, left to distant future. But some of the archimedean are easier to extend to multivariate, even if we don't do it right away. e.g. |
|
continuous in #7296 with copula folder |
first commit is just a full move to keep history
no refactoring yet
planned module outline
For elliptical copulas we don't have enough generic code to add a specific base class
(this could go also in the second part after copula generating base classes
open question: do we add copulas with extra transformation, e.g. power transformed archimedean currently only
copula_power_mv_archimedeanfunction,For Archimedean and EV we might be able to use transform-the-transform classes to
transforms_copula,Power transform works on archimedean generator function, and, IIRC, there are transforms for Pickand's dependence functions for EV copulas.
I don't know if there should be generic copula (extra) transforms that work also for non-Archimedean, non-EV copulas.