
Last chance! 50% off unlimited learning
Sale ends in
This function will build models for 9 different nls models, along with a non-parametric monotonic regression and a polynomial regression. The models are evaluated, a winner is picked, and the predicted values are stored in your data table.
AutoNLS(data, y, x, monotonic = TRUE)
Data is the data table you are building the modeling on
Y is the target variable name in quotes
X is the independent variable name in quotes
This is a TRUE/FALSE indicator - choose TRUE if you want monotonic regression over polynomial regression
A list containing "PredictionData" which is a data table with your original column replaced by the nls model predictions; "ModelName" the model name; "ModelObject" The winning model to later use; "EvaluationMetrics" Model metrics for models with ability to build.
Other Automated Regression: AutoCatBoostHurdleModel
,
AutoCatBoostRegression
,
AutoH2oDRFHurdleModel
,
AutoH2oDRFRegression
,
AutoH2oGBMHurdleModel
,
AutoH2oGBMRegression
,
AutoXGBoostHurdleModel
,
AutoXGBoostRegression
# NOT RUN {
# Create Growth Data
data <-
data.table::data.table(Target = seq(1, 500, 1),
Variable = rep(1, 500))
for (i in as.integer(1:500)) {
if (i == 1) {
var <- data[i, "Target"][[1]]
data.table::set(data,
i = i,
j = 2L,
value = var * (1 + runif(1) / 100))
} else {
var <- data[i - 1, "Variable"][[1]]
data.table::set(data,
i = i,
j = 2L,
value = var * (1 + runif(1) / 100))
}
}
# Add jitter to Target
data[, Target := jitter(Target,
factor = 0.25)]
# To keep original values
data1 <- data.table::copy(data)
# Merge and Model data
data11 <- AutoNLS(
data = data,
y = "Target",
x = "Variable",
monotonic = TRUE
)
# Join predictions to source data
data2 <- merge(
data1,
data11$PredictionData,
by = "Variable",
all = FALSE
)
# Plot output
ggplot2::ggplot(data2, ggplot2::aes(x = Variable)) +
ggplot2::geom_line(ggplot2::aes(y = data2[["Target.x"]],
color = "Target")) +
ggplot2::geom_line(ggplot2::aes(y = data2[["Target.y"]],
color = "Predicted")) +
RemixAutoML::ChartTheme(Size = 12) +
ggplot2::ggtitle(paste0("Growth Models AutoNLS: ",
data11$ModelName)) +
ggplot2::ylab("Target Variable") +
ggplot2::xlab("Independent Variable") +
ggplot2::scale_colour_manual("Values",
breaks = c("Target",
"Predicted"),
values = c("red",
"blue"))
summary(data11$ModelObject)
data11$EvaluationMetrics
# }
Run the code above in your browser using DataLab