Helper Functions for Manipulating Base Learner Configurations

Share:

Description

Helper Functions for Manipulating Base Learner Configurations

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
make.configs(baselearner=c("nnet","rf","svm","gbm","knn","penreg")
  , config.df, type = "regression")
make.configs.knn.regression(df=expand.grid(
  kernel=c("rectangular","epanechnikov","triweight","gaussian")
  , k=c(5,10,20,40)))
make.configs.gbm.regression(df=expand.grid(
  n.trees=c(1000,2000)
  , interaction.depth=c(3,4)
  , shrinkage=c(0.001,0.01,0.1,0.5)
  , bag.fraction=0.5))
make.configs.svm.regression(df=expand.grid(
  cost=c(0.1,0.5,1.0,5.0,10,50,75,100)
  , epsilon=c(0.1,0.25)
  , kernel="radial"))
make.configs.rf.regression(df=expand.grid(
  ntree=c(100,500)
  , mtry.mult=c(1,2)
  , nodesize=c(2,5,25,100)))
make.configs.nnet.regression(df=expand.grid(
  decay=c(1e-4,1e-2,1,100)
  , size=c(5,10,20,40)
  , maxit=2000))
make.configs.penreg.regression(df = expand.grid(
  alpha = 0.0
  , lambda = 10^(-8:+7)))
make.configs.bart.regression(df = rbind(cbind(expand.grid(
  num_trees = c(50, 100), k = c(2,3,4,5)), q = 0.9, nu = 3)
  , cbind(expand.grid(
  num_trees = c(50, 100), k = c(2,3,4,5)), q = 0.75, nu = 10)
  ))
make.instances(baselearner.configs, partitions)
extract.baselearner.name(config, type="regression")

Arguments

baselearner

Name of base learner algorithm. Currently, seven base learners are included: 1) Neural Network (nnet using package nnet), 2) Random Forest (rf using package randomForest), 3) Support Vector Machine (svm using package e1071), 4) Gradient Boosting Machine (gbm using package gbm), 5) K-Nearest-Neighbors (knn using package kknn), 6) Penalized Regression (penreg using package glmnet), and Bayesian Additive Regression Trees (bart) using package bartMachine.

df,config.df

Data frame, with columns named after tuning parameters belonging to the base learner, and each row indicating a tuning-parameter combination to include in the configuration list.

type

Type of base learner. Currently, only "regression" is supported.

baselearner.configs

Base learner configuration list to use in generating instances.

partitions

A matrix whose columns define data partitions, usually the output of generate.partitions.

config

Base learner configuration object.

Value

The make.configs family of functions return a list of objects of various base learner config classes, such as KNN.Regression.Config. Function make.instances returns an object of class Instance.List. Function extract.baselearner.name returns a character object representing the name of the base learner associated with the passed-in config object. For example, for a KNN.Regression.Config object, we get back "KNN". This utility function can be used in printing base learner names based on class of a config object.

Author(s)

Alireza S. Mahani, Mansour T.A. Sharabiani

Want to suggest features or report bugs for rdrr.io? Use the GitHub issue tracker.