| fit_predict | R Documentation |
Train one regression model on x and y with an algorithm named as a string,
then return its predictions for newdata, their standard errors when the
algorithm provides them, and the training R-squared.
fit_predict(
x,
y,
newdata,
algorithm,
params = NULL,
se = FALSE,
verbosity = 0L
)
x |
data.frame: Features, one column per predictor. |
y |
Numeric: Outcome, one value per row of |
newdata |
data.frame: Features to predict, with the columns of |
algorithm |
Character: Supervised learning algorithm name, matched
case-insensitively, e.g. |
params |
Optional Named list: Arguments to the algorithm's setup
function, e.g. |
se |
Logical: If TRUE, compute standard errors of the fit for |
verbosity |
Integer: Verbosity level. |
This is the bridge behind fit = "<algorithm>" in rtemis.draw::draw_scatter(),
rtemis.draw::draw_fit() and rtemis.draw::draw_scatter3d(), which need a
fitted curve or surface from a name alone. For full control over training,
use train().
Named list: fitted (Numeric predictions for newdata), se
(Numeric standard errors, or NULL when se = FALSE or the algorithm has
none), rsq (Numeric training R-squared), and algorithm (Character
canonical algorithm name).
EDG
fit <- fit_predict(
mtcars["wt"], mtcars[["mpg"]],
newdata = data.frame(wt = c(2, 3, 4)),
algorithm = "GLM",
se = TRUE
)
fit[["fitted"]]
fit_predict(
mtcars["wt"], mtcars[["mpg"]],
newdata = data.frame(wt = c(2, 3, 4)),
algorithm = "LINAD",
params = list(max_leaves = 2)
)[["fitted"]]
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.