predict_dummy_regressor {basemodels} | R Documentation |
dummy regressor predictor
Description
dummy regressor predictor
Usage
predict_dummy_regressor(object, X)
Arguments
object |
a list from the dummy_regressor function |
X |
a data frame |
Value
the predicted values
Examples
#' # Split the data into training and testing sets
set.seed(2023)
index <- sample(1:nrow(iris), nrow(iris) * 0.8)
train_data <- iris[index,]
test_data <- iris[-index,]
# Make predictions using the trained dummy regressor
reg_model <- dummy_regressor(train_data$Sepal.Length, strategy = "median")
y_hat <- predict_dummy_regressor(reg_model, test_data)
# Find mean squared error
mean((test_data$Sepal.Length-y_hat)^2)
[Package basemodels version 1.1.0 Index]