nnmnkwii.preprocessing.delta_features

nnmnkwii.preprocessing.delta_features(x, windows)[source]

Compute delta features and combine them.

This function computes delta features given delta windows, and then returns combined features (e.g., static + delta + delta-delta). Note that if you want to keep static features, you need to give static window as well as delta windows.

Parameters
Returns

static + delta features (T x (D * len(windows)).

Return type

numpy.ndarray

Examples

>>> from nnmnkwii.preprocessing import delta_features
>>> windows = [
...         (0, 0, np.array([1.0])),            # static
...         (1, 1, np.array([-0.5, 0.0, 0.5])), # delta
...         (1, 1, np.array([1.0, -2.0, 1.0])), # delta-delta
...     ]
>>> T, static_dim = 10, 24
>>> x = np.random.rand(T, static_dim)
>>> y = delta_features(x, windows)
>>> assert y.shape == (T, static_dim * len(windows))