AutoH2oGBMMultiClass is an automated H2O modeling framework with grid-tuning and model evaluation that runs a variety of steps. First, a stratified sampling (by the target variable) is done to create train and validation sets. Then, the function will run a random grid tune over N number of models and find which model is the best (a default model is always included in that set). Once the model is identified and built, several other outputs are generated: validation data with predictions, evaluation metrics, confusion matrix, and variable importance.
AutoH2oGBMMultiClass(
OutputSelection = c("EvalMetrics", "PDFs", "Score_TrainData"),
data = NULL,
TrainOnFull = FALSE,
ValidationData = NULL,
TestData = NULL,
TargetColumnName = NULL,
FeatureColNames = NULL,
WeightsColumn = NULL,
MaxMem = { gc()
paste0(as.character(floor(as.numeric(system("awk '/MemFree/ {print $2}' /proc/meminfo",
intern = TRUE))/1e+06)), "G") },
NThreads = max(1L, parallel::detectCores() - 2L),
model_path = NULL,
metadata_path = NULL,
ModelID = "FirstModel",
NumOfParDepPlots = 3L,
ReturnModelObjects = TRUE,
SaveModelObjects = FALSE,
IfSaveModel = "mojo",
H2OShutdown = TRUE,
H2OStartUp = TRUE,
DebugMode = FALSE,
GridTune = FALSE,
GridStrategy = "Cartesian",
MaxRunTimeSecs = 60 * 60 * 24,
StoppingRounds = 10,
MaxModelsInGrid = 2,
eval_metric = "auc",
Trees = 50L,
LearnRate = 0.1,
LearnRateAnnealing = 1,
Distribution = "multinomial",
MaxDepth = 20,
SampleRate = 0.632,
MTries = -1,
ColSampleRate = 1,
ColSampleRatePerTree = 1,
ColSampleRatePerTreeLevel = 1,
MinRows = 1,
NBins = 20,
NBinsCats = 1024,
NBinsTopLevel = 1024,
HistogramType = "AUTO",
CategoricalEncoding = "AUTO"
)
You can select what type of output you want returned. Choose from c("EvalMetrics", "PDFs", "Score_TrainData")
This is your data set for training and testing your model
Set to TRUE to train on full data
This is your holdout data set used in modeling either refine your hyperparameters.
This is your holdout data set. Catboost using both training and validation data in the training process so you should evaluate out of sample performance with this data set.
Either supply the target column name OR the column number where the target is located (but not mixed types).
Either supply the feature column names OR the column number where the target is located (but not mixed types)
Column name of a weights column
Set the maximum amount of memory you'd like to dedicate to the model run. E.g. "32G"
Set to the mamimum amount of threads you want to use for this function
A character string of your path file to where you want your output saved
A character string of your path file to where you want your model evaluation output saved. If left NULL, all output will be saved to model_path.
A character string to name your model and output
Tell the function the number of partial dependence calibration plots you want to create. Calibration boxplots will only be created for numerical features (not dummy variables)
Set to TRUE to output all modeling objects (E.g. plots and evaluation metrics)
Set to TRUE to return all modeling objects to your environment
Set to "mojo" to save a mojo file, otherwise "standard" to save a regular H2O model object
Set to TRUE to shutdown H2O inside the function
Defaults to TRUE which means H2O will be started inside the function
Set to TRUE to print steps
Set to TRUE to run a grid tuning procedure. Set a number in MaxModelsInGrid to tell the procedure how many models you want to test.
Default "Cartesian"
Default 60*60*24
Number of runs
Number of models to test from grid options (1080 total possible options)
This is the metric used to identify best grid tuned model. Choose from "auc", "logloss"
The maximum number of trees you want in your models
Default 0.10
Default 1
Choose from "multinomial". Placeholder in more options get added
Default 20
Default 0.632
Default 1
Default 1
Default 1
Default 1
Default 20
Default 1024
Default 1024
Default "AUTO"
Default "AUTO"
Set to TRUE to save insights to PDF
Saves to file and returned in list: VariableImportance.csv, Model, ValidationData.csv, EvaluationMetrics.csv, GridCollect, and GridList
Other Automated Supervised Learning - Multiclass Classification:
AutoCatBoostMultiClass()
,
AutoH2oDRFMultiClass()
,
AutoH2oGAMMultiClass()
,
AutoH2oGLMMultiClass()
,
AutoH2oMLMultiClass()
,
AutoXGBoostMultiClass()
# NOT RUN {
# Create some dummy correlated data
data <- RemixAutoML::FakeDataGenerator(
Correlation = 0.85,
N = 1000,
ID = 2,
ZIP = 0,
AddDate = FALSE,
Classification = FALSE,
MultiClass = TRUE)
# Run function
TestModel <- RemixAutoML::AutoH2oGBMMultiClass(
OutputSelection = c("EvalMetrics", "PDFs", "Score_TrainData"),
data,
TrainOnFull = FALSE,
ValidationData = NULL,
TestData = NULL,
TargetColumnName = "Adrian",
FeatureColNames = names(data)[!names(data) %in% c("IDcol_1", "IDcol_2","Adrian")],
WeightsColumn = NULL,
eval_metric = "logloss",
MaxMem = {gc();paste0(as.character(floor(as.numeric(system("awk '/MemFree/ {print $2}' /proc/meminfo", intern=TRUE)) / 1000000)),"G")},
NThreads = max(1, parallel::detectCores()-2),
model_path = normalizePath("./"),
metadata_path = file.path(normalizePath("./")),
ModelID = "FirstModel",
ReturnModelObjects = TRUE,
SaveModelObjects = FALSE,
IfSaveModel = "mojo",
H2OShutdown = TRUE,
H2OStartUp = TRUE,
DebugMode = FALSE,
# Model args
GridTune = FALSE,
GridStrategy = "Cartesian",
MaxRunTimeSecs = 60*60*24,
StoppingRounds = 10,
MaxModelsInGrid = 2,
Trees = 50,
LearnRate = 0.10,
LearnRateAnnealing = 1,
eval_metric = "RMSE",
Distribution = "multinomial",
MaxDepth = 20,
SampleRate = 0.632,
ColSampleRate = 1,
ColSampleRatePerTree = 1,
ColSampleRatePerTreeLevel = 1,
MinRows = 1,
NBins = 20,
NBinsCats = 1024,
NBinsTopLevel = 1024,
HistogramType = "AUTO",
CategoricalEncoding = "AUTO")
# }
Run the code above in your browser using DataLab