adaboost_fit1: Function that implement one weak model step of AdaBoost in...

Description Usage Arguments Value Examples

View source: R/adaboost.R

Description

Function that implement one weak model step of AdaBoost in regression

Usage

1

Arguments

fweak

- function that generates estimate from weak model based on input

data

- list of data that fweak need including x, y and last_est which is the sample weight for this step

Value

A trained model function based on the one implementation of the weak model, whose input is the independent variables.

Examples

1
2
3
4
5
6
7
fweak <- function(x, y, last_est){
  lm(y ~ -1 + x, weights = last_est)$coefficients
}
data <- list(x = matrix(rnorm(1000), 200, 5))
data$y <- data$x %*% rnorm(5) + rnorm(200, 0, 3)
data$last_est <- rep(1/length(data$y), length(data$y))
adaboost_fit1(fweak, data)

StevenBoys/Ensemblelearn documentation built on Dec. 11, 2019, 2:06 a.m.