min_split_improvement
¶
- Available in: GBM, DRF, XGBoost
- Hyperparameter: yes
Description¶
This option specifies the minimum relative improvement in squared error reduction in order for a split to occur. When properly tuned, this option can help reduce overfitting because the algorithm will stop splitting when all the possible splits lead to worse error measures. In addition, a single tree will stop splitting when there are no more splits that satisfy the min_rows
parameter, if it reaches max_depth
, or if there are no splits that satisfy this min_split_improvement
parameter.
This value defaults to 0.00001. Optimal values for this parameter are in the 1e-10…1e-3 range.
Example¶
- r
- python
library(h2o)
h2o.init()
# import the cars dataset:
# this dataset is used to classify whether or not a car is economical based on
# the car's displacement, power, weight, and acceleration, and the year it was made
cars <- h2o.importFile("https://s3.amazonaws.com/h2o-public-test-data/smalldata/junit/cars_20mpg.csv")
# convert response column to a factor
cars["economy_20mpg"] <- as.factor(cars["economy_20mpg"])
# set the predictor names and the response column name
predictors <- c("displacement","power","weight","acceleration","year")
response <- "economy_20mpg"
# split into train and validation sets
cars.split <- h2o.splitFrame(data = cars,ratios = 0.8, seed = 1234)
train <- cars.split[[1]]
valid <- cars.split[[2]]
# try using the `min_split_improvement` parameter:
# train your model:
cars_gbm <- h2o.gbm(x = predictors, y = response, training_frame = train,
validation_frame = valid, min_split_improvement = 1e-3, seed = 1234)
# print the auc for your model
print(h2o.auc(cars_gbm, valid = TRUE))
# Example of values to grid over for `min_split_improvement`:
hyper_params <- list( min_split_improvement = c(1e-4, 1e-5) )
# this example uses cartesian grid search because the search space is small
# and we want to see the performance of all models. For a larger search space use
# random grid search instead: list(strategy = "RandomDiscrete")
# this GBM uses early stopping once the validation AUC doesn't improve by at least 0.01% for
# 5 consecutive scoring events
grid <- h2o.grid(x = predictors, y = response, training_frame = train, validation_frame = valid,
algorithm = "gbm", grid_id = "cars_grid", hyper_params = hyper_params,
stopping_rounds = 5, stopping_tolerance = 1e-4, stopping_metric = "AUC",
search_criteria = list(strategy = "Cartesian"), seed = 1234)
## Sort the grid models by AUC
sortedGrid <- h2o.getGrid("cars_grid", sort_by = "auc", decreasing = TRUE)
sortedGrid