Skip to content

Emit metrics

HyperOptimizer collects trial metrics from stdout. Print one line per metric using the exact hpo.metrics. prefix.

hpo.metrics.<key>=<json>

Example output:

stdout
hpo.metrics.sharpe=1.85
hpo.metrics.max_drawdown=0.12
hpo.metrics.total_trades=77
import json
def emit_metric(key, value):
print(f"hpo.metrics.{key}={json.dumps(value, default=str)}")
emit_metric("sharpe", 1.85)
emit_metric("max_drawdown", 0.12)
emit_metric("total_trades", 77)

Emit the objective metric plus enough supporting metrics to explain the result.

Objective

The metric used for ranking, such as sharpe, loss, or profit_factor.

Risk

Values that explain downside, such as max_drawdown, latency_ms, or error_rate.

Context

Counts and runtime signals such as total_trades, epochs, or duration_seconds.

See the metric format reference for stricter details.