View source: R/predict_dummy_regressor.R
predict_dummy_regressor | R Documentation |
dummy regressor predictor
predict_dummy_regressor(object, X)
object |
a list from the dummy_regressor function |
X |
a data frame |
the predicted values
#' # 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)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.