-
Notifications
You must be signed in to change notification settings - Fork 23
Open
Description
Thank you for the library. I encountered an error when following the examples, trying to fit to a rvine model:
import torch
import pandas as pd
import numpy as np
from sklearn.preprocessing import QuantileTransformer
from torchvinecopulib.vinecop import VineCop
# Load
real = pd.read_csv("example_csv.csv")
COND_COLS = ["X", "Y"] + [f"Covariates_{i+1}" for i in range(34)] # X, Y, Covariates_1, ..., Covariates_34
TARGET_COLS = [f"A{i+1}" for i in range(22)] # A1, A2, ..., A22
ALL_COLS = COND_COLS + TARGET_COLS
real = real[ALL_COLS]
# Transform
qt = QuantileTransformer(output_distribution="uniform")
u_re = qt.fit_transform(real) # shape (n, D)
# Fit
vine = VineCop( num_dim=u_re.shape[1],
is_cop_scale=True,
num_step_grid=128)
vine.fit( torch.tensor(u_re, dtype=torch.float64, device=DEVICE),
mtd_vine="rvine",
mtd_bidep="kendall_tau",
first_tree_vertex=(0, 1) )
Error message:
Traceback (most recent call last):
File "/env/lib/python3.13/site-packages/IPython/core/interactiveshell.py", line 3672, in run_code
exec(code_obj, self.user_global_ns, self.user_ns)
~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "<ipython-input-27-49f79aab11e3>", line 1, in <module>
vine.fit( torch.tensor(u_re, dtype=torch.float64, device=DEVICE),
~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
mtd_vine="rvine",
^^^^^^^^^^^^^^^^^
mtd_bidep="kendall_tau",
^^^^^^^^^^^^^^^^^^^^^^^^
first_tree_vertex=(0, 1) )
^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/env/lib/python3.13/site-packages/torch/utils/_contextlib.py", line 116, in decorate_context
return func(*args, **kwargs)
File "/env/lib/python3.13/site-packages/torchvinecopulib/vinecop/__init__.py", line 587, in fit
bcp.fit(
~~~~~~~^
obs=obs_bcp,
^^^^^^^^^^^^
...<3 lines>...
mtd_tll=mtd_tll,
^^^^^^^^^^^^^^^^
)
^
File "/env/lib/python3.13/site-packages/torch/utils/_contextlib.py", line 116, in decorate_context
return func(*args, **kwargs)
File "/env/lib/python3.13/site-packages/torchvinecopulib/bicop/__init__.py", line 199, in fit
).values
^^^^^^
AttributeError: 'tuple' object has no attribute 'values'
Could you please shed some light on the source of the error?
Metadata
Metadata
Assignees
Labels
No labels