cv.hfr | R Documentation |
HFR is a regularized regression estimator that decomposes a least squares regression along a supervised hierarchical graph, and shrinks the edges of the estimated graph to regularize parameters. The algorithm leads to group shrinkage in the regression parameters and a reduction in the effective model degrees of freedom.
cv.hfr( x, y, weights = NULL, kappa = seq(0, 1, by = 0.1), q = NULL, intercept = TRUE, standardize = TRUE, nfolds = 10, foldid = NULL, partial_method = c("pairwise", "shrinkage"), ridge_lambda = 0, ... )
x |
Input matrix or data.frame, of dimension (N x p); each row is an observation vector. |
y |
Response variable. |
weights |
an optional vector of weights to be used in the fitting process. Should be NULL or a numeric vector. If non-NULL, weighted least squares is used for the level-specific regressions. |
kappa |
A vector of target effective degrees of freedom of the regression. |
q |
Thinning parameter representing the quantile cut-off (in terms of contributed variance) above which to consider levels in the hierarchy. This can used to reduce the number of levels in high-dimensional problems. Default is no thinning. |
intercept |
Should intercept be fitted. Default is |
standardize |
Logical flag for |
nfolds |
The number of folds for k-fold cross validation. Default is |
foldid |
An optional vector of values between |
partial_method |
Indicate whether to use pairwise partial correlations, or shrinkage partial correlations. |
ridge_lambda |
Optional penalty for level-specific regressions (useful in high-dimensional case) |
... |
Additional arguments passed to |
This function fits an HFR to a grid of kappa
hyperparameter values. The result is a
matrix of coefficients with one column for each hyperparameter. By evaluating all hyperparameters
in a single function, the speed of the cross-validation procedure is improved substantially (since
level-specific regressions are estimated only once).
When nfolds > 1
, a cross validation is performed with shuffled data. Alternatively,
test slices can be passed to the function using the foldid
argument. The result
of the cross validation is given by best_kappa
in the output object.
A 'cv.hfr' regression object.
Johann Pfitzinger
Pfitzinger, J. (2022). Cluster Regularization via a Hierarchical Feature Regression. arXiv 2107.04831[statML]
hfr
, coef
, plot
and predict
methods
x = matrix(rnorm(100 * 20), 100, 20) y = rnorm(100) fit = cv.hfr(x, y, kappa = seq(0, 1, by = 0.1)) coef(fit)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.