Emit metrics guide

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

Metric line format

hpo.metrics.<key>=<json>

Example output:

stdoutcollected
hpo.metrics.sharpe=1.85
hpo.metrics.max_drawdown=0.12
hpo.metrics.total_trades=77

Python helper

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)

Choosing metrics

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.

Was this page helpful?