
Last chance! 50% off unlimited learning
Sale ends in
ml_prepare_response_features_intercept(x = NULL, response, features, intercept, envir = parent.frame())
ml_prepare_features(x, features, envir = parent.frame())
tbl_spark
).response
is a formula, it is used in preference to other
parameters to set the response
, features
, and intercept
parameters (if available). Currently, only simple linear combinations of
existing parameters is supposed; e.g. response ~ feature1 + feature2 + ...
.
The intercept term can be omitted by using - 1
in the model fit.response
, features
and intercept
bindings should be mutated. (Typically, the parent frame).response
is itself a formula
describing the model to be fit, thereby extracting the names
of the response
and features
to be used,
Please take heed of the last point, as while this is useful in practice, the behavior will be very surprising if you are not expecting it.
# note that ml_prepare_features, by default, mutates the 'features'
# binding in the same environment in which the function was called
local({
ml_prepare_features(features = ~ x1 + x2 + x3)
print(features) # c("x1", "x2", "x3")
})
Run the code above in your browser using DataLab