ml
Use when tasks need optional PyCaret model training, ML factor generation, inference wrappers, feature importance, or sparse LASSO weight generation.
Skill by quantskills
Install
Works with Claude Code, Claude apps, Codex, Cursor, Gemini CLI, GitHub Copilot, VS Code, OpenCode, Goose, Windsurf. Read the repository before you give any tool access to your data.
npx agentmarket install skill/quantskills-ml
Asks which of your tools to add it to (Claude Code, Codex, Cursor, VS Code, Windsurf, Gemini CLI, Claude Desktop) and shows the change first. See https://agentmart.dev/cli.
Get the weekly diff
The weekly diff: one email a week with new agent tools, notable updates and grade changes, plus security alerts for tools you follow. Double opt-in, one-click unsubscribe.
About
Use cases: ml
Reviews
Write a reviewNo reviews yet. Installed it? Reviews come from verified installers only. How reviews work
Permissions
What this skill can do and what it asks for, from its SKILL.md and code. Checked Oct 25, 2026.
- Tools
- No tools found
- Secrets
- None asked for
- Install scripts
- None found
- Runs as
- Python package
Network hosts it talks to 1
codeload.github.com· found in install command
Files it touches
~/.claude/skills/ml
What's inside
- Skill name
ml- Description
- Use when tasks need optional PyCaret model training, ML factor generation, inference wrappers, feature importance, or sparse LASSO weight generation.
- License
- GPL-3.0
- Instructions
- 129 lines in SKILL.md · view on GitHub
Before installing
- Ships executable scripts
Files (7)
- SKILL.md
- __init__.py
- lasso_tracker.py
- ml_engine.py
- ml_factor.py
- pca_fold.py
- walk_forward.py
SKILL.md (first lines)
# ML
ML contains reusable model training, prediction, ML factor, and sparse fitting
helpers. It should produce predictions, ranks, labels, or weight matrices; return
accounting belongs in `skills.backtest`.
Install model dependencies with `uv sync --extra ml`.
## Public API
```python
from skills.ml.ml_engine import MLEngine, ModelPredictor
from skills.ml.ml_factor import MLFactorEngine, make_precomputed_factor
from skills.ml.lasso_tracker import lasso_track
from skills.ml.pca_fold import fit_fold_transform, make_regressor
from skills.ml.walk_forward import date_level_mask, expanding_purged_folds
```
## Components
| Module | Purpose |
|--------|---------|
| `skills.ml.ml_engine` | Lazy PyCaret classification/regression engine and inference wrapper |
| `skills.ml.ml_factor` | Compress factor configs into ML-ranked cross-sectional factor pivots |
| `skills.ml.lasso_tracker` | Rolling LASSO sparse index-tracking weight generation |
| `skills.ml.pca_fold` | Train-only PCA fold transforms (no StandardScaler) and frozen regressors |
| `skills.ml.walk_forward` | Expanding walk-forward folds with label purge, plus date row masks for `(symbol, eob)` panels |
## Recipes
**ML rank factor for `ModularBacktester`**
```python
from skills.compute import indicators as I
from skills.ml.ml_factor import MLFactorEngine, make_precomputed_factor
engine = MLFactorEngine(
data=panel_df,
factor_configs=[
{"func": I.trend_score_v2, "kwargs": {"period": 24}, "name": "trend"},
{"func": I.cci, "kwargs": {"period": 48}, "name": "cci"},
],
model_type="xgboost",
train_mode="rolling",
)
rank_pivot = engine.generate()
ml_factor_fn = make_precomputed_factor(rank_pivot, name="ml_rank")
```
**Expanding purged walk-forward folds**
```python
from skills.ml.walk_forward import date_level_mask, expanding_purged_folds
dates = panel.index.get_level_values("eob").unique()
folds = expanding_purged_folds(
dates,
min_train=250,
retrain_step=370,
purge=20,
)
for fold in folds:
train_mask = date_level_mask(feature_panel.index, fold.train_dates)
pred_mask = date_level_mask(feature_panel.index, fold.pred_dates)
```
**Train-only PCA fold transform**
```python
from skills.ml.pca_fold import fit_fold_transform, make_regressor
transform = fit_fold_transform(train_X, pred_X, n_pca=50, random_state=42)
model = make_regressor("lasso") # or "ols" / "rf" / "xgboost"
model.fit(transform.train_X, train_y)
pred = model.predict(transform.pred_X)
```
**Cross-sectional expanding PCA model scores**
```python
from skills.compute.features import make_logdiff_panel_features
from strategies.cross_sectional.ml_rank import (
expanding_pca_model_scores,
expanding_pca_multi_model_scores,
)
features = make_logdiff_panel_features(panel) # reuse across horizons
# Prefer multi-model so each fold's PCA is fit once:
results = expanding_pca_multi_model_scores(
panel, models=("ols", "lasso", "rf", "xgboost"), horizon=20, features=features
)
# Or a single model:
result = expanding_pca_model_scores(panel, model="rf", horizon=20, features=features)
scores = result.scores
fold_metrics = result.fold_metrics
overall_metrics = result.overall_metrics
```
**Lesson 07 workflow (18 ETF, equal-weight Top 3)**
```bash
uv run python -m strategies.cross_sectional.workflows.run_lesson07_etf18_logdiff_pca_ml
```
**Sparse index-tracking weights**
```python
from skills.ml.lasso_tracker import lasso_track
weights = lasso_track(
etf_returns,
index_returns,
lookback=120,
alpha=1e-5,
rebalance_freq="M",
)
```
**PyCaret classification**From quantskills/agent-quantspace, GPL-3.0.
More from quantskills/agent-quantspace
- 0.667score
analyze
quantskills
Use when tasks need factor diagnostics, IC/grouped return analysis, attribution, robustness checks, deterministic factor-mining evaluation, or time-series…
SkillAFreshness: A★ 64Claude Code +9 - 0.632score
ingest
quantskills
Use when tasks need PandaData/PandaAI stock, fund, ETF, index, or futures data, reference data, adjustment factors, futures tick downloads, or symbol…
SkillBFreshness: B★ 64Claude Code +9 - 0.627score
report
quantskills
Use when tasks need complete HTML research reports, HTML dashboards, PNG chart helpers, or files under the research reports directory.
SkillBFreshness: B★ 64Claude Code +9 - 0.627score
compute
quantskills
Use when tasks need strategy-agnostic OHLCV indicators, math utilities, generic factor examples, regime slicing, resampling, or label makers.
SkillBFreshness: B★ 64Claude Code +9 - 0.627score
backtest
quantskills
Use when tasks need vectorized strategy execution, portfolio weighting, portfolio-level filters, transaction cost helpers, exit A/B analysis, overlay metrics…
SkillBFreshness: B★ 64Claude Code +9 - 0.627score
strategy
quantskills
Use when tasks need reusable strategy contracts, cross-sectional selection types, or time-series signal-to-weight helpers.
SkillBFreshness: B★ 64Claude Code +9 - 0.626score
store
quantskills
Use when tasks need local market Parquet data, factor artifacts, backtest data, or model files through DataManager.
SkillBFreshness: B★ 64Claude Code +9 - 0.623score
factor_mining
quantskills
Use when tasks need AI multi-agent factor mining research boundaries, versioned ResearchBrief/FactorSpec contracts, evaluation/review/decision objects, or…
SkillBFreshness: B★ 64Claude Code +9 - 0.621score
research
quantskills
Use when tasks need reusable research pipeline templates, factor screening, or parameter sensitivity sweeps.
SkillBFreshness: B★ 64Claude Code +9
Signals
- Stars
- 64
- Forks
- 14
- Open issues
- 2
- Last commit (this folder)
- Aug 15, 2026 (2 months ago)
From GitHub (fetched Oct 24, 2026).
Details
- License
- GPL-3.0
- Repository
- github.com/quantskills/agent-quantspace
- First seen
- Oct 24, 2026
- Last checked
- Oct 24, 2026
- Source
- GitHubgithub-graphql
More from quantskills
- 0.667score
analyze
quantskills
Use when tasks need factor diagnostics, IC/grouped return analysis, attribution, robustness checks, deterministic factor-mining evaluation, or time-series…
SkillAFreshness: A★ 64Claude Code +9 - 0.632score
ingest
quantskills
Use when tasks need PandaData/PandaAI stock, fund, ETF, index, or futures data, reference data, adjustment factors, futures tick downloads, or symbol…
SkillBFreshness: B★ 64Claude Code +9 - 0.627score
report
quantskills
Use when tasks need complete HTML research reports, HTML dashboards, PNG chart helpers, or files under the research reports directory.
SkillBFreshness: B★ 64Claude Code +9 - 0.627score
compute
quantskills
Use when tasks need strategy-agnostic OHLCV indicators, math utilities, generic factor examples, regime slicing, resampling, or label makers.
SkillBFreshness: B★ 64Claude Code +9 - 0.627score
backtest
quantskills
Use when tasks need vectorized strategy execution, portfolio weighting, portfolio-level filters, transaction cost helpers, exit A/B analysis, overlay metrics…
SkillBFreshness: B★ 64Claude Code +9 - 0.627score
strategy
quantskills
Use when tasks need reusable strategy contracts, cross-sectional selection types, or time-series signal-to-weight helpers.
SkillBFreshness: B★ 64Claude Code +9
Cite this page
ml skill. Agent Mart. https://agentmart.dev/skills/quantskills-ml (last updated 2026-10-24)