feature-engineering

Guides encoding, transformation, and leakage-safe feature construction for tabular machine learning.

Updated Dec 29, 2025
One-click install
npx skills add https://github.com/snoodleboot-io/discrecontinual_equations --skill feature-engineering-snoodleboot-io
Or copy as Structured Prompt for Agent▼
Please help me install this Agent Skill.
Skill: feature-engineering
Source: https://github.com/snoodleboot-io/discrecontinual_equations/tree/main/.claude/skills/feature-engineering
Command: npx skills add https://github.com/snoodleboot-io/discrecontinual_equations --skill feature-engineering-snoodleboot-io

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve? Poorly chosen encodings, leaky target statistics, and incorrectly scaled features silently degrade model performance or inflate offline metrics that collapse in production. This Skill provides concrete, code-level guidance for building tabular features correctly with scikit-learn and pandas. ## Core Features & Use Cases - Encoding Selection by Cardinality: Decision tables mapping one-hot, ordinal, target, count, hashing, and native categorical encodings to column cardinality and model family, with sklearn code for each. - Leakage Prevention: Cross-fitted, smoothed target encoding via TargetEncoder, point-in-time cutoffs for entity aggregates, and pipeline-based fitting so stateful transforms never see validation data. - Numeric and Temporal Transformation: Scaling guidance per model family, log/quantile transforms for skewed data, cyclical sin/cos time features, and guarded ratio features. - Use Case: When building a fraud model on transaction history, apply the point-in-time aggregate pattern so a user's features never include events after the label timestamp, avoiding a model that detects its own label. ## Quick Start Ask the assistant to apply the feature-engineering skill to design leakage-safe encodings and transformations for your tabular dataset.

Frequently Asked Questions about feature-engineering

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I encode high-cardinality categorical features in sklearn?▼

Use TargetEncoder with cross-fitting and smoothing, count encoding, or hashing for high-cardinality columns. One-hot encoding thousands of levels creates sparse, weak features; models like LightGBM and CatBoost also support native categorical handling.

How do I prevent target encoding leakage?▼

Compute target encodings out-of-fold using sklearn's TargetEncoder with cv=5 and smoothing enabled, placed inside a Pipeline. Naive groupby-transform means let each row's own label feed its feature, inflating validation scores.

Which models require feature scaling?▼

Penalized linear models, SVM, k-NN, k-means, neural networks, and PCA all require scaling because penalties, distances, and gradients are scale-dependent. Decision trees, random forests, and gradient boosting are invariant to monotone transforms and need no scaling.

Why is feature_importances_ misleading for feature selection?▼

Impurity-based importance is biased toward high-cardinality and continuous features because they offer more split points, so a random unique id can outrank a predictive binary flag. Use permutation importance on held-out validation data instead.

How do I avoid leakage in time-based aggregate features?▼

Filter every aggregate with a point-in-time cutoff such as events.ts < cutoff before grouping by entity. Aggregating a user's full history to predict a mid-history event lets the feature include the labeled event itself.