Skip to main content
rule

automl-hyperparameter-optimization — Cursor rule: setup guide

Enforces disciplined AutoML and hyperparameter search in Python projects. It requires fixed baselines, leakage-free validation, and explicit tracking.

Install into Cursor · Manually: put the files in place All methods and platforms ↓
.cursor/rules/automl-hyperparameter-optimization.mdc
Open on GitHub

What automl-hyperparameter-optimization does

The rule targets **/*.py, **/*.ipynb, and dependency manifests. Unguided searches waste compute. The assistant must define target metrics and establish a baseline before exploring complex models. Training logic, evaluation, and search setups stay in separate modules.

Ray Tune and Optuna serve custom loops or distributed trials. PyCaret covers fast low-code comparisons, while time-series forecasts route to AutoTS or Merlion. All runs log to MLflow or Weights & Biases. Preprocessing fits strictly on training folds to prevent data leakage.

Searches require resource limits and early stopping. Log-scale distributions apply to learning rates and regularization parameters. In the final report, the assistant must benchmark against baseline models and document inference latency. Dependency management relies on uv.

What it helps with

  • Prevent data leakage by fitting preprocessing only on training folds
  • Configure distributed hyperparameter searches in Optuna or Ray Tune
  • Benchmark AutoML candidates against simple baseline models
  • Maintain chronological splits for time-series forecasting datasets

Example prompts for the agent

  • Set up an Optuna study in tune.py with log-scale sampling for the learning rate
  • Run a PyCaret baseline comparison on data.csv and log runs to MLflow
  • Create a time-aware validation split for the forecast script without shuffling dates

How to install automl-hyperparameter-optimization

Manually: put the files in place

.cursor/rules/automl-hyperparameter-optimization.mdc

Frontmatter: description, globs, alwaysApply

Step by step, with commands for each platform: Cursor rules: .mdc files, four modes and what replaced .cursorrules

Questions about automl-hyperparameter-optimization

How do I install automl-hyperparameter-optimization in Cursor?

Save the rule text into .cursor/rules/automl-hyperparameter-optimization.mdc inside your repository root. Cursor will load these instructions automatically when you edit Python and notebook files.

What does this rule do?

It guides the assistant to structure hyperparameter tuning and AutoML workflows responsibly. Cursor will enforce baselines, stop data leakage, and configure experiment trackers.

Which hyperparameter tuning libraries are recommended?

The rule specifies Ray Tune or Optuna for custom training loops and distributed pruning. For rapid low-code model comparisons, it suggests PyCaret.

Source text

automl-hyperparameter-optimization.mdc · CC0-1.0
---
description: AutoML and hyperparameter optimization rules for Python ML projects using Ray Tune, Optuna, PyCaret, and time-series AutoML libraries
globs: ["**/*.py", "**/*.ipynb", "pyproject.toml", "requirements*.txt", "environment*.yml"]
alwaysApply: false
---

# AutoML and Hyperparameter Optimization Rules

## Scope

- Use AutoML to accelerate model exploration, not to bypass problem framing, validation design, or explainability.
- Start with a simple baseline model and fixed metric before launching a search.
- Keep training, evaluation, feature generation, and search configuration separate.
- Record datasets, splits, metric definitions, random seeds, library versions, and search spaces for every run.

## Experiment Design

- Define the target metric before selecting tooling.
- Use nested validation or a final untouched test split for model selection claims.
- Use time-aware splits for time-series problems; never shuffle across time boundaries.
- Prevent leakage by fitting preprocessing only on training folds.
- Include simple baselines such as linear models, random forests, or naive time-series forecasts.
- Use early stopping and resource limits for expensive searches.
- Prefer structured search spaces with domain-informed ranges over arbitrary broad grids.

## Tooling

- Use Ray Tune or Optuna for custom training loops, distributed trials, pruning, and scheduler control.
- Use PyCaret for quick low-code comparisons when the dataset and metric are straightforward.
- Use AutoTS, Merlion, PyAF, or project-approved time-series tooling when forecast-specific validation, seasonality, and horizon handling matter.
- Store run metadata in MLflow, Weights & Biases, TensorBoard, or a project-approved tracker.
- Use `uv` or the existing project package manager for reproducible environments.

## Search Spaces

- Keep search spaces explicit and reviewed.
- Use log-scale sampling for learning rates, regularization, tree counts, and other scale-sensitive values.
- Constrain model complexity to avoid unrealistic training time or memory use.
- Include preprocessing choices only when they can be applied without leakage.
- Do not tune on the test set.

## Reporting

- Report the selected model, metric, confidence interval or variance, validation scheme, and final test result.
- Include the best parameters and the search budget.
- Compare the chosen model against the baseline and at least one non-AutoML alternative.
- Document operational constraints such as inference latency, memory use, retraining cost, and explainability.

## Common Mistakes

- Do not treat leaderboard rank as proof of production readiness.
- Do not mix train/test data during feature engineering.
- Do not run massive searches before validating labels and data quality.
- Do not ignore class imbalance, calibration, or business cost asymmetry.
- Do not deploy an AutoML model without reproducible training code and pinned dependencies.

© PatrickJS · CC0-1.0 · PatrickJS/awesome-cursorrules

Similar IDE rules

All IDE rules for AI and ML →

From the same set210

chrome-extension-dev-js-typescript-cursorrules-pro A Cursor rule that points the agent at one set of conventions for building Chrome extensions in JavaScript and TypeScript. ★ 41,024repo stars blender-python-addon Cursor rule for writing Blender Python add-ons. Enforces clean operator lifecycles, structured panels, and safe Blender API calls. ★ 41,024repo stars beefreesdk This Cursor rule sets out Beefree SDK installation, proxy authentication, UI container setup, configuration, and callbacks for web projects. ★ 41,024repo stars beefreesdk-nocode-content-editor-cursorrules-prompt-file A Cursor rule that guides the agent when embedding Beefree SDK no-code editors for emails, pages and popups into a web app. ★ 41,024repo stars astro-typescript-cursorrules-prompt-file This Cursor rule sets working conventions for Astro, TypeScript, and TailwindCSS, with a slash command for composing Git commits. ★ 41,024repo stars ascii-simulation-game-cursorrules-prompt-file A Cursor rule that frames an observer-only ASCII simulation: 10x10 grid, turn-based play, logs for nearly everything. Useful if you are building something in the spirit of Conway's Game of Life. ★ 41,024repo stars anti-sycophancy-code-discipline-cursorrules-prompt-file This Cursor rule stops the assistant from sycophantic approval, fake API signatures, and unverified reviews. It keeps refactoring disciplined and forces evidence-based checks. ★ 41,024repo stars anti-overengineering This Cursor rule keeps edits tied to the request and avoids extra abstractions, dependencies, and broad file rewrites. ★ 41,024repo stars

Project sponsors

Companies that keep this analytics open
Gold sponsor

Impressions, clicks and code copies — open statistics. We keep the numbers public for the same reason NeBlask itself is public. Become a sponsor