class MetricRegistry¶
- class deeptime.clustering.MetricRegistry¶
Registry of available metrics. Per default this contains only the Euclidean metric. If a custom metric is implemented, it can be registered through a call to
register
.Note
The registry should not be instantiated directly but rather be accessed through the
metrics
singleton.Adding a new metric
A new metric may be added by linking against the deeptime clustering c++ library (directory is provided by deeptime.capi_includes(inc_clustering=True)) and subsequently exposing the clustering algorithms with your custom metric like
#include "register_clustering.h" PYBIND11_MODULE(_clustering_bindings, m) { m.doc() = "module containing clustering algorithms."; auto customModule = m.def_submodule("custom"); deeptime::clustering::registerClusteringImplementation<Custom>(customModule); }
and registering it with the deeptime library through
import deeptime import bindings # this is your compiled extension, rename as appropriate deeptime.clustering.metrics.register("custom", bindings.custom)
Attributes
List of registered metrics.
Methods
register
(name, impl)Adds a new metric to the registry.
- register(name: str, impl)¶
Adds a new metric to the registry.
- Parameters:
name (str) – The name of the metric.
impl (module) – Reference to the implementation module.
- property available: Tuple[str]¶
List of registered metrics.