agentleFS
HarrypatriaHarrypatria/data-mining-ml/skills/feature-engineering/SKILL.md

feature-engineering

Skill2 starsChanged 12 days agoMITView on GitHub

Feature Engineering. Create, extract and select model inputs - feature extraction (PCA, SVD, TF-IDF, embeddings, signal features), feature engineering (date parts, cyclical encoding, lags, rolling windows, ratios, interactions, binning, target encoding, frequency encoding, geospatial), feature selection (mutual information, RFE, L1, stability selection), feature dictionary and ablation. Use for feature creation, feature construction, encoding categoricals, dimensionality reduction for modeling, or improving a machine learning model's inputs.

14 other projects use a version of this.

Adopted by

Most recently taken up by

Used with

Projects with it also use walk-forward-validation, edge-detection and 8 more.

Other files people use alongside this one.

Files found in the same public projects as a version of this one, more often than they turn up anywhere else. Each project counts once, large collections count for less, and this file's own repository is left out.
  • agiprolabsSkill

    walk-forward-validation

    Walk-forward validation framework for trading strategies and ML models with time-series-aware splits, overfit detection, and regime-aware validation

    Also in 6 projects that use this

  • noahowshSkill

    edge-detection

    Comparing a tennis model's probability with the market: no-vig close, expected value at the best available price, closing line value, fractional Kelly sizing, and the checks that separate an estimated edge from noise. Use when the user has a probability and wants to know whether a price is better than fair, how large a stake is reasonable, or whether an edge is real. Requires a probability the user trusts. Do not use for fetching prices: see odds-explorer. Do not use for devig math alone: see odds-analysis. Do not use for historical testing: see backtesting.

    Also in 4 projects that use this

  • noahowshSkill

    odds-analysis

    Odds math for two-way tennis markets: American to implied probability, margin, devigging (multiplicative, power, Shin), no-vig fair odds, consensus across books, favorite-longshot bias, and expected value of a price. Use when the user asks what a price implies, how to remove the vig, what the true probability is, or how to compare books. Do not use for fetching or comparing live prices: see odds-explorer. Do not use for deciding a bet against a model: see edge-detection.

    Also in 4 projects that use this

  • Yahmez3Skill

    backtesting

    Use when backtesting a trading strategy — evaluating a signal series against historical price data and computing performance metrics (Sharpe, Sortino, max drawdown, CAGR, win rate, expectancy). Triggers on "backtest this strategy", "what's the Sharpe on X", "run a walk-forward test", or "compare strategies A and B". Produces equity curves, trade logs, and tear sheets.

    Also in 4 projects that use this

  • agiprolabsSkill

    mean-reversion

    Mean-reversion strategy tools including Hurst exponent, half-life estimation, z-score signals, ADF testing, and Ornstein-Uhlenbeck modeling

    Also in 3 projects that use this

  • Bhala-SrinivashSkill

    position-sizing

    Calculate optimal position sizes for NSE/BSE equity trades using fixed fractional, ATR-based, and Kelly criterion methods. Includes portfolio constraints and leverage adjustments.

    Also in 3 projects that use this

  • +3 more from noahowsh

The file

Files
SKILL.md

Feature Engineering

Two different ideas

  • Feature extraction compresses raw or high-dimensional data into a compact representation (PCA, truncated SVD, NMF, TF-IDF, pretrained embeddings, FFT and rolling statistics). Always state what information is lost and how you inspected it: explained variance, reconstruction error, loadings.
  • Feature engineering builds informative inputs from domain knowledge (ratios, lags, cyclical time, group aggregates, flags). Every feature needs a rationale.

Rules

  1. Each engineered feature has a one-line rationale and passes the leakage question: would this value exist at prediction time?
  2. Features are computed inside the pipeline (ColumnTransformer, FunctionTransformer with a named importable function, or a custom transformer in src/<package>/transformers.py) so training and serving share code.
  3. Anything that learns from data (encoders, binning edges, selectors, PCA, target encoding) is fitted on training folds only.
  4. Lags and rolling windows use only past data: shift(k) with k above zero, trailing windows, grouped by entity, computed per snapshot.
  5. Target encoding is out-of-fold: sklearn.preprocessing.TargetEncoder (cross-fitted in fit_transform) inside the pipeline.
  6. Record a feature dictionary: name, source, transform, type, rationale, availability time. mlkit.features.feature_dictionary() writes it.

Selection

FamilyMethodsUse when
Filtervariance threshold, mutual information, chi-squared, ANOVA FMany features, quick screen
WrapperRFE, sequential selectionModerate p, model-specific
EmbeddedL1, elastic net, tree importanceSelection as part of fitting
StabilitySelection frequency across bootstrap resamplesSmall n, need trustworthy sets

Selection lives inside the pipeline and is evaluated with cross-validation. Remove leaky and near-duplicate features first.

Ablation

Report the CV metric with and without each feature group (raw, ratios, lags, encodings) with fold spread. Keep groups whose gain exceeds the fold-to-fold noise.

Output

  • Pipeline code in src/<package>/features.py, imported by the notebook and the API.
  • artifacts/feature_dictionary.csv.
  • Ablation table under a findings heading.

Recipes with code: references/feature-recipes.md.

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.