Skip to main content

FittedRecipe

A trained pipeline: applies statistics learned at fit time to new data.

Usage

Source

FittedRecipe(
    steps,
    roles=None,
    lineage=None,
    schema=None,
)

A FittedRecipe is what Recipe.fit() returns. It contains all the information it needs to be able to apply the transformations to new data:

recipe = (
    Recipe(data=credit, target="Status")
    .add(StepNormalize(s.numeric_features()))
    .add(StepDummy(s.nominal_features()))
)
fitted = recipe.fit(credit)

The repr shows the columns each step resolved to:

fitted
Recipe (trained)
  Inputs: 23 columns (22 features, 1 target)
  Steps:
    step_normalize(Seniority, Time, Age, Expenses, Income, Assets, Debt, Amount, Price)                                                                                                                                           [trained]
    step_dummy(Home, Marital, Records, Job → Home_other, Home_owner, Home_parents, Home_priv, Home_rent, Marital_married, Marital_separated, Marital_single, Marital_widow, Records_yes, Job_freelance, Job_others, Job_partime)  [trained]

Use transform() to apply the recipe to new data and summary() to inspect the resulting columns. A trained recipe can be saved and restored with to_json() and from_json() (or the dict and YAML equivalents).

Attributes

steps

The trained steps, in the order they run.

roles

The role assignments after fitting, including any columns the steps added.

lineage

How each output column was derived from the input columns, as a Lineage, or None if the recipe was built without one.

schema
The Schema of the training data, which transform() checks new data against, or None if the recipe was built without one.