CortForest class
CortForest(
x,
p_value_for_dim_red = 0.75,
n_trees = 10,
compte_loo_weights = FALSE,
min_node_size = 1,
pseudo_data = FALSE,
number_max_dim = NULL,
verbose_lvl = 2,
force_grid = FALSE,
oob_weighting = TRUE
)
The data, must be provided as a matrix with each row as an observation.
a p_value for the localised dimension reduction test
Number of trees
Defaults to FALSE. Allows to use an automatic re-weighting of the trees in the forest, based on leave-one-out considerations.
The minimum number of observation avaliable in a leaf to initialise a split.
set to True if you are already providing data on the copula space.
The maximum number of dimension a split occurs in. Defaults to be all of the dimensions.
verbosity level : can be 0 (default) or an integer. bigger the integer bigger the output level.
boolean (default: FALSE). set to TRUE to force breakpoint to be on the n-checkerboard grid in every tree.
boolean (default : TRUE) option to weight the trees with an oob criterion (otherwise they are equally weighted)
An instance of the CortForest
S4 class. The object represent the fitted copula and can be used through several methods to query classical (r/d/p/v)Copula methods, constraint influence, etc.
Beside returning some inputted parameters, notable slots are :
trees
A list of Cort objects representing each fitted tree in the forest.
weights
The weigths of each tree.
indexes
The indexes of data points that were selected for fitting the trees
pmf
The density of each tree on data points
norm_matrix
The matrix of scalar product between trees
oob_pmf
The density of each tree on data points it did not see during fitting
oob_kl
The out-of-bag Kullback-Leibler divergence of each tree
oob_ise
The out-of-bag Integrated Square Error of each tree
More details about these slots can be found in the reference.
This class implements the bagging of CORT models, with an out-of-bag error minimisation in the weights.
See O. Laverny, V. Maume-Deschamps, E. Masiello and D. Rullière (2020) for the details of this density estimation procedure, and vignettes(package='cort')
for examples of usecases.
laverny2020cort
(CortForest(LifeCycleSavings[,1:3],number_max_dim=2,n_trees=2))
#> ======================== Computing trees...
#> ======================== Computing statistics...
#> Computing pmf...
#> Computing norm matrix...
#> Computing weights...
#>
#> Call:
#> nloptr(x0 = x0, eval_f = fn, eval_grad_f = gr, lb = lower, ub = upper,
#> eval_g_ineq = hin, eval_jac_g_ineq = hinjac, eval_g_eq = heq,
#> eval_jac_g_eq = heqjac, opts = opts)
#>
#>
#> Minimization using NLopt version 2.7.1
#>
#> NLopt solver status: 3 ( NLOPT_FTOL_REACHED: Optimization stopped because
#> ftol_rel or ftol_abs (above) was reached. )
#>
#> Number of Iterations....: 5
#> Termination conditions: stopval: -Inf xtol_rel: 1e-10 maxeval: 1e+06 ftol_rel: 1e-10 ftol_abs: 1e-10
#> Number of inequality constraints: 0
#> Number of equality constraints: 1
#> Optimal value of objective function: 0.24957689853439
#> Optimal value of controls: 0.6979554 0.3020446
#>
#>
#> Computing oob stats...
#> ======================== Done !
#> CortForest copula model: 50x3-dataset and 2 Cort trees.