Skip to content
Back to skills

Optimization Workflows

ASecurity

"Core Optuna study and trial workflows: create/load/copy/delete

  • 247 stars
  • 0 votes
  • 0 copies
  • 3 views
  • Added September 8, 2026
datapythongoapi

Works with

  • cli
  • api

Security analysis

A100/100

Pro scans all 6 files and shows the line behind each finding

Scanned September 8, 2026

npx -y skills add VectorSpaceLab/AREX-Skill --skill optimization-workflows --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of Optimization Workflows?

Add the live security badge to your README. It updates with every re-scan.

Security grade badge for Optimization Workflows
[![Security: A — Skills Directory](https://www.skillsdirectory.com/api/skills/vectorspacelab-optimization-workflows-arex-skill/badge)](https://www.skillsdirectory.com/skills/vectorspacelab-optimization-workflows-arex-skill)

More formats (shields.io, HTML) on the badges page. Keep it an A: scan every change in CI with Pro.

Download with Pro
SKILL.md
---
name: optimization-workflows
description: "Core Optuna study and trial workflows: create/load/copy/delete
  studies, optimize objectives, run ask-and-tell loops, manage callbacks and
  attributes, handle fixed/reused parameters, and extract single- or
  multi-objective results."
disable-model-invocation: true
metadata:
  disco-role: operating
license: NOASSERTION
---

# Optuna Optimization Workflows

Use this sub-skill when the task is about the mechanics of running Optuna studies and trials: objective functions, `create_study`, `load_study`, `copy_study`, `delete_study`, `Study.optimize`, `Study.ask`, `Study.tell`, `Trial.suggest_*`, `Trial.report`, `Trial.should_prune`, callbacks, user attributes, fixed or reused parameters, and result extraction.

Route out of this sub-skill when the main problem is:
- Sampler or pruner algorithm selection/tuning: use `samplers-pruners`.
- Persistent storage URLs, CLI commands, or distributed workers: use `cli-and-storage`.
- Plotting, parameter importances, dashboards, or result analysis beyond basic extraction: use `analysis-visualization`.
- Artifact stores or third-party integrations: use `artifacts-integrations`.

## Fast Paths

- Start with `references/workflows.md` for copy-paste patterns covering normal optimization, ask-and-tell, callbacks, fixed parameters, and multi-objective studies.
- Use `references/api-reference.md` for exact signatures, result properties, and source-backed edge behavior.
- Use `references/troubleshooting.md` when Optuna raises direction/value mismatch, distribution compatibility, pruning/reporting, duplicate study, or callback errors.
- Run the bundled smoke checks from this directory:
  - `python scripts/basic_optimization_smoke.py`
  - `python scripts/ask_tell_smoke.py`

## Minimal Workflow

```python
import optuna


def objective(trial: optuna.Trial) -> float:
    x = trial.suggest_float("x", -10.0, 10.0)
    return (x - 2.0) ** 2


study = optuna.create_study(direction="minimize")
study.optimize(objective, n_trials=20)
print(study.best_value, study.best_params, study.best_trial.number)
```

## Key Rules

- Use `direction="minimize"` or `direction="maximize"` for single-objective studies; use `directions=[...]` only for multi-objective studies.
- `Study.optimize` expects an objective that returns one float for single-objective or one value per direction for multi-objective.
- `Study.ask()` returns a live `Trial`; finish it exactly once with `Study.tell(trial, value)` or `Study.tell(trial, state=optuna.trial.TrialState.PRUNED/FAIL)`.
- `Trial.report()` and `Trial.should_prune()` are for single-objective pruning workflows; multi-objective studies raise `NotImplementedError` for these methods.
- Use `study.best_trial`, `study.best_value`, and `study.best_params` for single-objective studies; use `study.best_trials` and each trial's `values` for multi-objective Pareto results.
- `study.best_trial` is a `FrozenTrial`; it can replay `suggest_*` calls with stored parameters, but `FrozenTrial.should_prune()` always returns `False`.

Files in this skill

  • SKILL.md3 KB
  • references/api-reference.md6.9 KB
  • references/troubleshooting.md6.3 KB
  • references/workflows.md7.6 KB
  • scripts/ask_tell_smoke.py2.5 KB
  • scripts/basic_optimization_smoke.py1.6 KB

Attribution

Is this your skill, or is something wrong with this listing? Request removal or report an issue. Author removals are honored within 72 hours.

Comments

Loading comments…

Newsletter

Get the weekly list of safe new skills, and the ones we pulled.