predict_dummy_regressor: dummy regressor predictor

View source: R/predict_dummy_regressor.R

predict_dummy_regressorR 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)

basemodels documentation built on Aug. 9, 2023, 9:09 a.m.