Find_ridge_best_split: Find_ridge_best_split

Description Usage Arguments Value Examples

View source: R/RidgeMSE.R

Description

This is the fast impelementation of the best split function when the leaf prediciton is coming from ridge regression.

Usage

1
2
Find_ridge_best_split(feat, y, linear.idx, current.splitting.idx, lambda,
  update_A_inv = update_A_inv_R)

Arguments

feat

all features

y

outcome vector

linear.idx

feature indexes where a Ridge Regression should be fitted

current.splitting.idx

the index of the feature we are currently testing for splits.

Value

It returns a vector of two doubles which determines what the best splitting point is, and what it's MSE is.

split_val_best

the best splitting value

MSE_best

the best MSE

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
set.seed(309814)
n <- 1000
feat <- matrix(rnorm(4 * n), ncol = 4)
feat[2,] <- feat[which.min(feat[,2]),]
feat[3,] <- feat[which.min(feat[,2]),]
feat[4,] <- feat[which.min(feat[,2]),]
feat[5,] <- feat[which.min(feat[,2]),] - 1
y <- rnorm(n)
linear.idx <- 1:4
current.splitting.idx <- 2
lambda <- .2
Find_ridge_best_split_linear_MASS(feat = feat, y = y, linear.idx = linear.idx,
                                 current.splitting.idx = current.splitting.idx,
                                 lambda = lambda)
Find_ridge_best_split_slow(feat = feat, y = y, linear.idx = linear.idx,
                          current.splitting.idx = current.splitting.idx,
                          lambda = lambda)
Find_ridge_best_split(feat = feat, y = y, linear.idx = linear.idx,
                     current.splitting.idx = current.splitting.idx,
                     lambda = lambda)
# Note that fast split is not estimating the RSS or the MSE, but the RSS -
# sum(y^2).

theo-s/Rforestry_R documentation built on Dec. 23, 2021, 9:55 a.m.