Skills
A skill is a package of structured files that teaches an AI coding agent how to work with a specific tool or framework. The skill below was generated by Great Docs from this project’s documentation. Install it in your agent and it will be able to run commands, edit configuration, write content, and troubleshoot problems without step-by-step guidance from you.
Any agent — install with npx:
npx skills add https://tidymodels.github.io/mlfeatures/Codex / OpenCode
Tell the agent:
Fetch the skill file at https://tidymodels.github.io/mlfeatures/skill.md and follow the instructions.Manual — download the skill file:
curl -O https://tidymodels.github.io/mlfeatures/skill.mdOr browse the SKILL.md file.
SKILL.md
--- name: mlfeatures description: > A framework for declaring, estimating, and applying feature-engineering pipelines. Use when writing Python code that uses the mlfeatures package. license: MIT compatibility: Requires Python >=3.10. --- # mlfeatures A framework for declaring, estimating, and applying feature-engineering pipelines ## Installation ```bash pip install mlfeatures ``` ## API overview ### Recipes Build a recipe, then fit and apply it. The Recipe class and its methods are flattened into this section so each method appears on the reference index. - `Recipe`: A declarative, untrained pipeline of feature-engineering steps - `Recipe.add` - `Recipe.fit` - `Recipe.set_roles` - `Recipe.add_role` - `Recipe.update_role` - `Recipe.remove_role` - `Recipe.update_role_requirements` - `Recipe.summary` ### Steps: numeric features Rescale, expand, or derive new numeric columns. - `StepNormalize`: Center and scale numeric columns to zero mean and unit variance - `StepOrderNorm`: Normalize numeric columns onto a standard normal distribution by rank - `StepRange`: Scale numeric columns to a fixed range - `StepLog`: Take the logarithm of numeric columns - `StepPolynomial`: Replace numeric columns with their orthogonal polynomial expansion - `StepSplineNatural`: Replace numeric columns with a natural cubic spline basis expansion - `StepSplineMonotone`: Replace numeric columns with a monotone (I-spline) basis expansion - `StepClassDistance`: Replace numeric columns with per-row distances to each class centroid - `StepGeoDistance`: Add the distance from each row to a fixed reference point - `StepIntercept`: Add a constant column with a fixed value - `StepInteract`: Add the pairwise product of every pair of selected columns ### Steps: categorical features Encode nominal columns as numeric ones. - `StepDummy`: Expand categorical columns into *k-1* binary indicator columns - `StepOneHot`: Expand discrete columns into *k* binary indicator columns - `StepOther`: Collapse infrequent categorical levels into a single ``"other"`` level ### Steps: date and datetime features Expand Date and Datetime columns into calendar-part feature columns. - `StepDateFeatures`: Expand Date columns into calendar-part feature columns - `StepDatetimeFeatures`: Expand Datetime columns into calendar-part feature columns - `StepHoliday`: Add binary indicator columns flagging named holidays and custom recurrences ### Steps: missing data Impute missing values, or give them an explicit level. - `StepImputeMean`: Impute missing numeric values with the column mean - `StepImputeMedian`: Impute missing numeric values with the column median - `StepImputeMode`: Impute missing values with the column mode (most frequent value) - `StepUnknown`: Recode missing categorical levels to an explicit ``"unknown"`` level - `StepIndicateNa`: Add a binary indicator column flagging missing values ### Steps: dimensionality reduction Reduce dimensionality, or filter columns that carry no signal. - `StepDropZeroVariance`: Remove columns that have a single unique value (zero variance) - `StepDropNearZeroVariance`: Remove columns that are sparse and unbalanced (near-zero variance) - `StepPca`: Project numeric columns onto their principal components - `StepPls`: Project numeric columns onto partial-least-squares components - `StepDropCorr`: Remove numeric columns whose pairwise absolute correlation is too high - `StepDrop`: Remove the selected columns ### Steps: general expressions Arbitrary row filters and column computations; escape hatches rather than a named feature-engineering method. - `StepFilter`: Remove rows that do not match a predicate - `StepMutate`: Apply arbitrary column expressions: the escape hatch ### Fitted recipes What Recipe.fit() returns: an immutable, fitted pipeline you can apply to new data. Serialization methods are listed under Serialization below. - `FittedRecipe`: A trained pipeline: applies statistics learned at fit time to new data - `FittedRecipe.transform` - `FittedRecipe.summary` ### Lineage The column-lineage DAG a fitted recipe maintains: per-column provenance and dtype history, plus the queries that back has_source. - `Lineage`: The record of where every column came from, and what happened to it - `Lineage.removed` - `Lineage.summary` - `Lineage.columns_from_source` - `Lineage.parents` - `Lineage.ancestors` - `ColumnNode`: One column's lineage record ### Serialization Save a fitted recipe to a diffable JSON or YAML format and reload it, or strip fit-only artifacts with minimize(). - `to_dict`: Serialize a `FittedRecipe` to a diffable, JSON-safe ``dict`` - `from_dict`: Reconstruct a `FittedRecipe` from the ``dict`` produced by `to_dict` - `to_json`: Serialize a `FittedRecipe` to a diffable JSON string - `from_json`: Reconstruct a `FittedRecipe` from the JSON produced by `to_json` - `to_yaml`: Serialize a `FittedRecipe` to a diffable YAML string - `from_yaml`: Reconstruct a `FittedRecipe` from the YAML produced by `to_yaml` - `minimize`: Return a `FittedRecipe` that keeps only what ``transform()`` needs - `FittedRecipe.to_dict` - `FittedRecipe.from_dict` - `FittedRecipe.to_json` - `FittedRecipe.from_json` - `FittedRecipe.to_yaml` - `FittedRecipe.from_yaml` - `FittedRecipe.minimize` ### Interop Adapters for using recipes inside other ecosystems. - `RecipeTransformer`: Wrap a `Recipe` as a scikit-learn transformer ### Types & selectors Selector DSL and the schema/type vocabulary that steps are written against. - `Selectors`: Namespace of factory methods for built-in mlfeatures column selectors - `FeaturesSelector`: Base class for all mlfeatures-native column selectors - `Selector` - `ColSchema`: Column schema: the names and dtypes a step reports for a column set - `SchemaInfo`: Schema-derived context handed to `Step.fit()` - `Roles`: Column → set of role names - `Mode`: Shape of a step's input/output relationship - `KeepOriginals`: Whether a step's ``keep_original_cols`` is fixed or up to the caller - `KeepOriginals.for_mode` - `KeepOriginals.fixed_value` - `Schema`: A structural snapshot of the training data used for boundary checks - `Schema.check` - `DataFrame`: Special type indicating an unconstrained type - `Frame` - `ANY_DTYPE`: Sentinel type for `ANY_DTYPE` (a singleton) - `NUMERIC_DTYPES`: set() -> new empty set object - `AcceptedDtypes` ### Datasets Example datasets bundled with the package, loaded on access as polars frames (`from mlfeatures.data import credit`). Used throughout the user guide and the examples. - `data` ### Developing The abstract Step base class and its lifecycle methods, for authoring new steps. Flattened so each method appears on the reference index. - `Step`: Abstract base class for a feature-engineering step - `Step.fit` - `Step.transform` - `Step.resolve_selection` - `Step.update_roles` - `Step.schema_in` - `Step.schema_out` - `Step.output_parents` - `Step.accepts_dtypes` - `Step.produces_sparse` - `Step.produced_columns` - `Step.keep_original_cols` - `Step.required_pkgs` - `Step.check_required_pkgs` - `Step.get_params` - `Step.set_params` - `Step.to_state` - `Step.from_state` - `Step.minimize` - `RowOp`: Row-altering steps - `StepError`: A failure raised while fitting or transforming a step ## Resources - [Full documentation](https://tidymodels.github.io/mlfeatures/) - [llms.txt](llms.txt) — Indexed API reference for LLMs - [llms-full.txt](llms-full.txt) — Comprehensive documentation for LLMs - [Source code](https://github.com/tidymodels/mlfeatures)