The R and Python modeling communities use different words for the same things, and mlfeatures has R recipes in its lineage while living in the Python ecosystem. This page is the translation table. mlfeatures follows scikit-learn’s vocabulary wherever the two communities disagree, because that is the ecosystem a mlfeatures recipe actually plugs into.
The three quantities
| A column used as model input |
feature |
feature |
predictor |
| The column being predicted |
target |
target, label |
outcome |
| One row of the data |
sample |
sample |
observation, case |
These are not just prose conventions: "feature" and "target" are the literal role names mlfeatures assigns to columns, so they show up in Recipe() kwargs, in Selectors methods, and in a recipe’s printed output.
df = pd.DataFrame({"price": [200.0, 250.0, 310.0], "sqft": [1.0, 2.0, 3.0]})
recipe = Recipe(data=df, target="price", features="sqft").add(
StepNormalize(s.numeric_features())
)
recipe
Recipe (untrained)
Inputs: 2 columns (1 feature, 1 target)
Steps:
step_normalize(select(role='feature', type=NumericType)) [untrained]
False friends
A few words mean something different here than you might expect, so they are worth calling out.
predictor is not a column. In scikit-learn, “predictor” means an estimator that implements predict(): TreePredictor, make_predictor(), _linear_predictor. It is never a name for an input column, which is exactly the opposite of R recipes, where all_predictors() selects input columns. mlfeatures does not use the word at all.
label is not the target. scikit-learn uses “label” as a synonym for the target, roughly as often as it uses “target” itself. mlfeatures does not, because “label” would then collide with the class values of a categorical target and with the distinct concept below. Where a single class value of a categorical target is meant, mlfeatures says class, or class label where the fuller phrase reads better. What it never does is use a bare “label” to mean the target column.
level, not label, for a category’s values. The distinct values of a categorical column are its levels, following R’s factor terminology. StepDummy and StepOneHot learn a column’s levels at fit time, and StepUnknown deals with missing ones. A level is a value within a column, which is a different thing from a role, which is a property of a column.
A table of rows and columns is a data frame. Prose says “data frame”, not a bare “frame”. The bare word survives only in code, as the internal Frame type alias and the _frame module.
sample also has its statistical sense. mlfeatures says “sample” for one row of data, but “sample standard deviation” in StepNormalize means the ddof=1 estimator, not anything about rows.
mlfeatures-specific terms
| Recipe |
The declared, not-yet-estimated pipeline |
recipe |
| step |
One feature-engineering operation |
step_*() |
| role |
A user-assigned name on a column, such as "feature" or "target" |
role |
| selector |
A description of which columns a step applies to, resolved at fit time |
all_predictors() and friends |
| untrained |
A recipe whose steps have not estimated anything yet |
unprepped |
| trained |
A recipe whose steps hold fitted state, ready to apply |
prepped |
| fit() |
Estimate every step’s state from training data |
prep() |
| transform() |
Apply the fitted steps to data |
bake() |
| Schema |
A zero-row snapshot of the training data’s columns, dtypes, and roles, used to validate data at fit() and transform() |
(no equivalent) |
| Lineage |
The record of where each column came from and how its dtype and roles changed across steps |
var_info / term_info |
Note the two lifecycle names in particular. mlfeatures deliberately does not use R recipes’ cooking analogy, so a recipe is never “prepped” or “baked”: it is untrained or trained, and you fit() then transform() it.
Roles beyond feature and target
"feature" and "target" are the two roles mlfeatures treats specially, but a role is just a string, and a column can carry more than one. "case_weights" is the third standard role, and you can register any custom role you like. See Roles for the details.
A column with the "feature" role is always required when you transform() new data; a "target" column never is, since it is unknown at serving time. That asymmetry is the main reason the two roles are mutually exclusive.