repype.benchmark

class repype.benchmark.Benchmark(filepath: PathLike)

Bases: Generic[ValueType]

Represents the benchmark data for a task.

Parameters:

filepath – The path to the file where the benchmark data is persisted.

Example

>>> import tempfile
>>> from repype.benchmark import Benchmark
>>> 
>>> with tempfile.TemporaryDirectory() as tmp_path:
...     benchmark = Benchmark[float](tmp_path + '/benchmark.csv')
...     benchmark['stage1', 'input-1'] = 10
...     benchmark.save()
...     del benchmark
...     benchmark = Benchmark[float](tmp_path + '/benchmark.csv')
...     print(benchmark['stage1', 'input-1'])
... 
10.0
__eq__(other: object) bool

Check if the benchmark data is equal to another instance.

__getitem__(where: Tuple[str, InputID]) ValueType

Get the benchmark value for a stage and an input.

__setitem__(where: Tuple[str, InputID], value: ValueType) Self

Set the benchmark value for a stage and an input.

df: DataFrame

The benchmark data dataframe.

filepath: Path

The path to the file where the benchmark data is persisted.

retain(stage_ids: Iterable[str], input_ids: Iterable[InputID]) Self

Retain only the benchmark data for the specified stage_ids and input_ids.

save() None

Persist the benchmark data to filepath.

set(other: Self) Self

Set the benchmark data to the benchmark data of another instance.

class repype.benchmark.ValueType

Represents the type of the benchmark values.

alias of TypeVar(‘ValueType’)