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

How to use sets of families for the BicopFamily class #63

Closed
dmey opened this issue Jul 15, 2020 · 12 comments
Closed

How to use sets of families for the BicopFamily class #63

dmey opened this issue Jul 15, 2020 · 12 comments

Comments

@dmey
Copy link
Contributor

dmey commented Jul 15, 2020

I tried to set the controls for a set of family rather than its members as mentioned in the docs (https://vinecopulib.github.io/pyvinecopulib/_generate/pyvinecopulib.BicopFamily.html#pyvinecopulib.BicopFamily) as:

pv.FitControlsVinecop(family_set=[pv.BicopFamily.all])

however these families are not members of the BicopFamily and result in AttributeError: type object 'pyvinecopulib.BicopFamily' has no attribute 'all'. Is this meant to be called in a different way?

@tvatter
Copy link
Contributor

tvatter commented Jul 15, 2020

The sets are part of the main namespace of pyvinecopulib, so you can do pv.all.

image

@tnagler
Copy link
Collaborator

tnagler commented Jul 15, 2020

Ah.. We should clarify this in the documentation. Also, wouldn't it be better to have this as pv.families.all or similar?

@tvatter
Copy link
Contributor

tvatter commented Jul 15, 2020

Agreed for the clarifications. Regarding the namespace, I'm not sure that it's worth it. If anything, I would actually have pv.BicopFamily.all (i.e., an object of class BicopFamily to return a set of objects).

@dmey
Copy link
Contributor Author

dmey commented Jul 15, 2020

I see, OK and then this is set by passing e.g. family_set=pv.all to FitControlsVinecop. So in the example above this would be:

pv.FitControlsVinecop(family_set=pv.all)

Thanks for the clarification.

@tnagler
Copy link
Collaborator

tnagler commented Jul 15, 2020

Wouldn't it be confusing (if at all possible) to have an enum that holds a list of enums of the same type?

@tvatter
Copy link
Contributor

tvatter commented Jul 15, 2020

@dmey exactly! However, pv.all is the default anyway :)

@tvatter
Copy link
Contributor

tvatter commented Jul 15, 2020

@tnagler The enum would'nt "hold" the list, it would just have a method allowing to create such a list.

@tvatter
Copy link
Contributor

tvatter commented Jul 15, 2020

@dmey I just noticed that the documentation of three of those sets was incorrect, see #65 (it's just the doc, the sets are actually available)

@tvatter
Copy link
Contributor

tvatter commented Jul 23, 2021

Since the doc has been corrected for a while, I'm closing. Feel free to reopen if needed.

@tvatter tvatter closed this as completed Jul 23, 2021
@tvatter tvatter reopened this Jul 23, 2021
@tvatter
Copy link
Contributor

tvatter commented Jul 23, 2021

Actually, arguments of the controls should be better documented anyway. I'm reopening.

@kevindarby
Copy link

Perhaps related, is there a way to specify the family for each bicop and then fit them to data?

Do I have to fit each bicop separately then? If so, does the bicop.fit() just take the leftmost columns in the dataset?

For instance, I'd like to set up:

tree0 = [
pv.Bicop(pv.BicopFamily.bb7, rotation = 0), #, parameters = None),
pv.Bicop(pv.BicopFamily.bb7, rotation = 0),
pv.Bicop(pv.BicopFamily.indep, rotation = 0),
pv.Bicop(pv.BicopFamily.bb7, rotation = 0),
pv.Bicop(pv.BicopFamily.bb7, rotation = 0),
]
tree1 = [
pv.Bicop(pv.BicopFamily.bb7, rotation = 0),
pv.Bicop(pv.BicopFamily.bb7, rotation = 0),
pv.Bicop(pv.BicopFamily.bb7, rotation = 0),
pv.Bicop(pv.BicopFamily.bb7, rotation = 0),
]
...

then

order = np.arange(1, len(data.columns) + 1)
vine_struct = pv.DVineStructure(order) #eg [1,2,3...
fit = pv.Vinecop(vine_struct, pair_copulas = [tree0, tree1, tree2, tree3, tree4])

but now

fit.select(data)

can change families

and

controls = pv.FitControlsVinecop(family_set=[pv.BicopFamily.bb7, pv.BicopFamily.indep],
fit.select(data, controls = controls)

can make some bb7 and some indep,

@tvatter
Copy link
Contributor

tvatter commented Oct 23, 2024

@kevindarby Since last release, we now have a fit method, so it is indeed possible. See Vinecop.fit. I'm closing but feel free to reopen if this does not solve your issue.

@tvatter tvatter closed this as completed Oct 23, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants