TorchVinecop.fit
- static TorchVinecop.fit(structure, u, fit_edge, *, context=None, x=None)
Fit pair copulas tree-by-tree along a fixed structure (returns them).
The array-agnostic (NumPy or PyTorch) analogue of
fit(), with the pair-copula fit supplied by thefit_edgecallback. It differs in one way: rather than mutating a vine in place (asfit()does), it returns the fitted pairs as a nested[tree][edge]list — sinceVinecopBaseleaves pair storage to the subclass, there is no single object to mutate. It mirrors the forward pdf traversal with the density evaluation replaced byfit_edge(tree, edge, u_e, x_e); the returned pair’shfunc1/hfunc2must be valid immediately for tree propagation. Conditional fitting is driven through this seam (afit_edgethat fits a conditional pair copula on(u_e, x_e)), withx_eassembled in the same C1 order the cascades use.- Parameters:
- structureRVineStructure
The (fixed) vine structure to fit along.
- uarray, shape (n, d), dtype float
Pseudo-observations.
- fit_edgecallable
(tree, edge, u_e, x_e) -> BicopLikefitting one edge’s pair copula.- contextConditioningContext, optional
Conditioning-context policy (default: simplified / unconditional).
- xarray, shape (n, p), or None, optional
External covariates for conditional fitting, else
None.
- Returns:
- list of list of BicopLike
Fitted pair copulas indexed
[tree][edge].
See also
pyvinecopulib.core.VinecopBase.selectSelect a structure and fit it.
pyvinecopulib.core.Vinecop.fitThe reference (in-place) fit.