MetricDataFrame#

Per-metric storage and pandas view of collected samples.

A MetricDataFrame holds the samples of a single metric. Run parameters are stored once per run, and to_pandas() materialises them as flat columns alongside step and value. MetricDataFrame.filter() returns a narrowed MetricDataFrame.

class krum.orchestration.dataframe.MetricDataFrame(dtype: type = <class 'float'>)[source]#

Bases: object

Compact storage and filtering for one metric’s samples.

property dtype: type#

The metric’s declared value type.

filter(**filters: Any) MetricDataFrame[source]#

Return a narrowed store whose run parameters match filters.

Parameters:

**filters – Parameter-name/value pairs that every selected run must match. Unknown names produce an empty store.

Returns:

An independent :class:`MetricDataFrame` containing matching runs.

record(params: dict[str, Any], step: int, value: Any, skip_if_exists: bool = False) None[source]#

Store one sample for the run identified by params.

Parameters:
  • params – The run’s parameter values. Stored once as an immutable key.

  • step – The step the value belongs to.

  • value – The recorded value.

  • skip_if_exists – If True, ignore the sample when this run already has a value for step.

to_pandas() DataFrame[source]#

Materialise all samples as a flat pandas.DataFrame.

Parameter columns are the ordered union of parameter names across runs. A run missing a parameter receives pandas.NA in that column. The final columns are always step and value.

Returns:

A fresh frame with parameter, ``step``, and ``value`` columns.