Random Forest for univariate time series forecasting

I want to forecast 1 time-step ahead with Random Forest. I am working with univariate time series. I have input with 1 column and also output with one column. I want to tune the hyperparameters of Random Forest with h2o package. But i am getting error.

My code is:
data - read.csv("example.csv", header = TRUE, sep = ",")
library(rsample) # data splitting
library(randomForest) # basic implementation
library(ranger) # a faster implementation of randomForest
library(caret) # an aggregator package for performing many machine learning models
library(h2o) # an extremely fast java-based platform

set.seed(123)
data_split - initial_split(data, prop = .7)
data_train - training(data_split)
data_test - testing(data_split)

m1- randomForest(formula = Output ~ ., data = data_train)

y - "Output"
x - setdiff(names(data_train), y)
train.h2o - as.h2o(data_train)
hyper_grid.h2o - list(ntrees = seq(50, 1000, by = 50), mtries = seq(1, 10, by = 1), sample_rate = c(.55, .632, .70, .80))

grid - h2o.grid(algorithm = "randomForest, grid_id = rf_grid, x = x, y = y, training_frame = train.h2o, hyper_params = hyper_grid.h2o, search_criteria = list(strategy = Cartesian))

I get the following error:
"Illegal argument(s) for DRF model: rf_grid_model_2. Details: ERRR on field: _mtries: Computed mtries should be -1 or -2 or in interval [1,2[ but it is 2\n".
"Illegal argument(s) for DRF model: rf_grid_model_3. Details: ERRR on field: _mtries: Computed mtries should be -1 or -2 or in interval [1,2[ but it is 3\n".

and so on.......

This topic was automatically closed 21 days after the last reply. New replies are no longer allowed.

If you have a query related to it or one of the replies, start a new topic and refer back with a link.