recpack.pipelines.registries.MetricRegistry

class recpack.pipelines.registries.MetricRegistry

Registry for easy retrieval of metric types by name.

The registry comes preregistered with all the recpack metrics.

Methods

get(key)

Retrieve the value for this key.

register(key, c)

Register a new Python type (most often a class).

get(key: str) type

Retrieve the value for this key. This value is a Python type (most often a class).

Parameters

key (str) – The key to fetch

Returns

The class type associated with the key

Return type

type

register(key: str, c: type)

Register a new Python type (most often a class).

After registration, the key can be used to fetch the Python type from the registry.

Parameters
  • key (str) – key to register the type at. Needs to be unique to the registry.

  • c (type) – class to register.