autoLearn: Automated machine learning training of models

Description Usage Arguments Value Author(s) Examples

View source: R/autoLearn.R

Description

Automated training, tuning and validation of machine learning models. Models are tuned and resampling validated on an experiment set and trained on the full set and validated and testing on external sets. Classification models tune the probability threshold automatically and returns the results. Each model contains information of performance, the trained model as well as some plots.

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
autoLearn(
  train,
  test = NULL,
  target = NULL,
  codeFrame = NULL,
  edaFrame = NULL,
  problemType = NULL,
  maxLevels = 100,
  testSplit = 0.1,
  validationSplit = 0.3,
  trainMode = "all",
  tuneIters = 10,
  tuneType = "random",
  perfMetric = "auto",
  performResampling = FALSE,
  resampleMethod = "CV",
  resampleIters = 5,
  topFeatures = 30,
  models = "all",
  clusters = NULL,
  cores = NULL,
  maxObs = 40000,
  verbose = TRUE,
  seed = 1991
)

Arguments

train

[data.frame | Required] Training set

test

[data.frame | Optional] Optional testing set to validate models on. If none is provided, one will be created internally. Default of NULL

target

[character | Optional] If a target is provided classification or regression models will be trained, if left as NULL unsupervised models will be trained. Default of NULL

codeFrame

[data.frame | Optional] If the code data.frame object returned from autoPreProcess is provided along with the EDA data.frame "dataSummary" then each model will modify the code to be model specific and is returned in the model object

edaFrame

[data.frame | Optional] [data.frame | Optional] If the code data.frame object returned from autoPreProcess is provided along with the EDA data.frame "dataSummary" then each model will modify the code to be model specific and is returned in the model object

problemType

[character | Optional] Machine learning problem type, options are: binary, multi, regression and cluster. If left as NULL but target feature provided, problem type is automatically detected. Default of NULL

maxLevels

[integer | Optional] Number of unique values in target feature before the problem type is seen as a regression problem. Default of 100

testSplit

[numeric | Optional] Percentage of data to allocate to the test set. Stratified sampling is done. Default of 0.1

validationSplit

[numeric | Optional] Percentage of data to allocate to the validation set. Stratified sampling is done. Default of 0.3

trainMode

[character | Optional] Specifies how to train models, options are: all, full, reduced, balanced, reducedBalanced. all will use all of the other options when suitable. full trains models on all features. reduced trains models on top n features selected by a random forest. balanced trains models on all features but with oversampling the target to 50/50 proportion when the target is binary. reducedBalanced uses the top features as well as balancing the target when the target is binary. Either one or many options can be specified

tuneIters

[integer | Optional] Number of tuning iterations to search for optimal hyper parameters. Default of 10

tuneType

[character | Optional] Tune method applied, options are: random and frace. random uses random tuning and frace uses iterated f-racing algorithm for the best solution. Default of random

perfMetric

[character | Optional] Optimization metric on which to train and validate the model. Default of NULL wuill automatically select a metric, else for avaialble metrics use the function availableMetrcs

performResampling

[logical | Optional] Should resampling be performed after tuning of the model have taken place. Default of FALSE

resampleMethod

[character | Optional] Should resampling be performed, specifies the resampling method, options are: CV, Bootstrap

resampleIters

[integer | Optional] Number of folds or bootstrap iterations to validate the model on

topFeatures

[integer | Optional] Top performing features as identified by the random forest model and used in the reduced training methods. Default of 30, if the training set has less than 30 features 50 percent of the top features will be used

models

[character | Optional] Which models to train. Default of all. Available models can be seen by calling availableLearners. Either one or many options can be specified

clusters

[integer | Optional] For unsupervised problems, the number of clusters to optimize for. Default of NULL which will search for the best optimized number of clusters

cores

[integer | Optional] Number of CPU cores available for computation. Default of NULL which uses all but one core

maxObs

[integer | Optional] Number of observations in the experiment training set on which models are trained, tuned and resampled on. Default of 40000. If the training set has less than 40k observations all will be used

verbose

[logical | Optional] Chatty function or not. Default of TRUE

seed

[integer | Optional] Random number seed for reproducible results

Value

List of trained models each containing unque information relating to the machine learning problem type

Author(s)

Xander Horn

Examples

1
mod <- autoLearn(train = iris, target = "Species")

XanderHorn/autoML documentation built on Aug. 5, 2020, 11:45 a.m.