Skip to main content

Mode

Shape of a step’s input/output relationship.

Usage

Source

Mode

Every concrete step class declares one mode. The framework reads it for two things: how the step’s columns are recorded in the column lineage, and whether keep_original_cols is fixed or configurable (see KeepOriginals).

The members, with the value keep_original_cols takes for each:

  • ONE_TO_ONE: each input column produces exactly one output column, e.g. StepNormalize. Fixed at False.
  • ONE_TO_MANY: each input column produces one or more output columns, e.g. StepDummy. Configurable, default False.
  • MANY_TO_MANY: a set of input columns produces a new set of output columns, e.g. StepPca. Configurable, default False.
  • REMOVING: input columns are dropped and none are created, e.g. StepDropZeroVariance. Fixed at False.
  • ADDING: new columns appear with no corresponding input, e.g. StepIntercept. Fixed at True.
  • ROW_OP: no change to the columns, e.g. StepFilter. Fixed at True. Row steps only act while the recipe is fitted and are skipped by transform() on new data.
  • UNCONSTRAINED: the relationship cannot be declared in advance, e.g. StepMutate. Fixed at True.

Examples

Each step class declares its mode; for example StepDummy expands one column into many:

StepDummy.mode, [m.value for m in Mode]
(<Mode.ONE_TO_MANY: 'one_to_many'>,
 ['one_to_one',
  'one_to_many',
  'many_to_many',
  'removing',
  'adding',
  'row_op',
  'unconstrained'])