class BoxDiscretization

class deeptime.clustering.BoxDiscretization(dim: int, n_boxes, v0=None, v1=None)

An n-dimensional box discretization of Euclidean space.

It spans an n-dimensional grid based on linspaces along each axis which is then used as cluster centers. The linspaces are bounded either by the user (attributes v0 and v1) or estimated from data.

Parameters:
  • dim (int) – Dimension of the box discretization.

  • n_boxes (int or list of int) – Number of boxes per dimension of - if given as single integer - for all dimensions.

  • v0 (array or None, optional, default=None) – Lower left vertex of the box discretization. If not given this is estimated from data.

  • v1 (array or None, optional, default=None) – Upper right vertex of the box discretization. If not given this is estimated from data.

Attributes

has_model

Property reporting whether this estimator contains an estimated model.

model

Shortcut to fetch_model().

Methods

fetch_model()

Yields the estimated model.

fit(data, **kwargs)

Fits data to the estimator's internal Model and overwrites it.

fit_fetch(data, **kwargs)

Fits the internal model on data and subsequently fetches it in one call.

get_params([deep])

Get the parameters.

set_params(**params)

Set the parameters of this estimator.

fetch_model() Optional[BoxDiscretizationModel]

Yields the estimated model.

Returns:

model – The model.

Return type:

BoxDiscretizationModel or None

fit(data: ndarray, **kwargs)

Fits data to the estimator’s internal Model and overwrites it. This way, every call to fetch_model() yields an autonomous model instance. Sometimes a partial_fit method is available, in which case the model can get updated by the estimator.

Parameters:
  • data (array_like) – Data that is used to fit a model.

  • **kwargs – Additional kwargs.

Returns:

self – Reference to self.

Return type:

Estimator

fit_fetch(data, **kwargs)

Fits the internal model on data and subsequently fetches it in one call.

Parameters:
  • data (array_like) – Data that is used to fit the model.

  • **kwargs – Additional arguments to fit().

Returns:

The estimated model.

Return type:

model

get_params(deep=False)

Get the parameters.

Returns:

params – Parameter names mapped to their values.

Return type:

mapping of string to any

set_params(**params)

Set the parameters of this estimator.

The method works on simple estimators as well as on nested objects (such as pipelines). The latter have parameters of the form <component>__<parameter> so that it’s possible to update each component of a nested object.

Parameters:

**params (dict) – Estimator parameters.

Returns:

self – Estimator instance.

Return type:

object

property has_model: bool

Property reporting whether this estimator contains an estimated model. This assumes that the model is initialized with None otherwise.

Type:

bool

property model

Shortcut to fetch_model().