getStackWeights: Generate Stack Weights

Description Usage Arguments Value Note

View source: R/stackingFunctions.R

Description

Main Stacking Procedure: Construct k folds and generate predictions from base models

Usage

1
2
3
4
getStackWeights(trainset, binaryDepVar = F, hlmFormula, lasso_vars,
  lasso_factors = NULL, forestFormula, mns_best = NULL, knnFormula,
  k_best, gbm_vars, gbm_factors = NULL, gbm_params, gbm_tune,
  nfolds = 5)

Arguments

trainset

The training dataset

binaryDepVar

A boolean denoting whether the outcome variable is binary or continuous. Used to specify tuning parameters for machine learning methods.

hlmFormula

A formula object for the hierarchical linear model

lasso_vars

The predictor variables to include in the LASSO model

lasso_factors

Which predictor variables need to be converted to factors before estimating the LASSO model

forestFormula

A formula object for the random forest model

mns_best

Optional min node size parameter for random forest model

knnFormula

A formula object for the KNN model

k_best

Optimal k parameter for KNN model

gbm_vars

The predictor variables to include in GBM model

gbm_factors

Which predictor variables need to be converted to factors before estimating the GBM

gbm_params

List of parameters for the GBM model

gbm_tune

xgb.tune object, containing the $best.iteration

nfolds

Number of cross-validation folds

Value

The optimal stacking weights (HLM, LASSO, KNN, Random Forest, GBM)

Note

trainset must include a variable called 'y', denoting the outcome


joeornstein/SRP documentation built on Oct. 15, 2020, 8:30 p.m.