class Monomials¶
- class deeptime.basis.Monomials(p: int, d: int)¶
Monomial basis observable which transforms a number of d-dimensional datapoints \(\mathbf{x}\in\mathbb{R}^d\) into (unique) monomials of at most degree \(p\).
This means, that
\[\mathbf{x} \mapsto \left\{ \prod_{d=1}^n \mathbf{x}_d^{k_d} : \sum k_d \leq p \right\}.\]The set is returned as a numpy ndarray of shape (n_test_points, n_monomials), where n_monomials is the size of the set.
- Parameters:
p (int) – Maximum degree of the monomial basis. Must be positive.
d (int) – The dimension of the input.
Examples
Given three test points in one dimension
>>> import numpy as np >>> X = np.random.normal(size=(3, 1))
Evaluating the monomial basis up to degree two yields \(x^0, x^1, x^2\), i.e., the expected shape is (3, 3)
>>> Y = Monomials(p=2, d=1)(X) >>> Y.shape (3, 3)
and, e.g., the second monomial of the third test point is the third test point itself:
>>> np.testing.assert_almost_equal(Y[2, 1], X[2, 0])
Methods
get_feature_names
([input_features])get_feature_names_out
([input_features])Yields a list of feature names, optionally given input feature names.
transform
(data, **kwargs)Transforms the input data.
- __call__(x: ndarray)¶
Evaluation of the observable.
- Parameters:
x ((N, d) np.ndarray) – Evaluates the observable for N d-dimensional data points.
- Returns:
out – Result of the evaluation for each data point.
- Return type:
(N, p) np.ndarray
- get_feature_names(input_features: Optional[List[str]] = None) List[str] ¶
- get_feature_names_out(input_features: Optional[List[str]] = None) List[str] ¶
Yields a list of feature names, optionally given input feature names.
- Parameters:
input_features (list of str, optional, default=None) – If not None, replaces the input feature names.
- Returns:
feature_names – Feature names corresponding to each monomial.
- Return type:
list of str
- transform(data, **kwargs)¶
Transforms the input data.
- Parameters:
data (array_like) – Input data.
- Returns:
transformed – The transformed data
- Return type:
array_like