bespoke_classification()
produces a fitted "model," where the model is
simply a user-supplied function. Note that, despite appearances, the "model"
is not actually trained to fit the data; it is only put into the context of
a "fitted" model in order to play nice with other tidymodels functions. It
will, however, return a member of the training outcomes for each input during
prediction.
Usage
bespoke_classification(x, ...)
# Default S3 method
bespoke_classification(x, ...)
# S3 method for class 'data.frame'
bespoke_classification(x, y, fn, ...)
# S3 method for class 'matrix'
bespoke_classification(x, y, fn, ...)
# S3 method for class 'formula'
bespoke_classification(formula, data, fn, ...)
# S3 method for class 'recipe'
bespoke_classification(x, data, fn, ...)
Arguments
- x
Depending on the context:
A data frame of predictors.
A matrix of predictors.
A recipe specifying a set of preprocessing steps created from
recipes::recipe()
.
- ...
Additional parameters passed on to the model "function."
- y
When
x
is a data frame or matrix,y
is the outcome specified as:A data frame with 1 numeric column.
A matrix with 1 numeric column.
A numeric vector.
- fn
A function that takes a data.frame as input and returns a vector (integer, character, or factor) indicating the outcomes as output (with one value per input row). We may someday extend this for probabilities.
- formula
A formula specifying the outcome terms on the left-hand side, and the predictor terms on the right-hand side.
- data
When a recipe or formula is used,
data
is specified as:A data frame containing both the predictors and the outcome.