nnmnkwii.preprocessing.trim_zeros_frames

nnmnkwii.preprocessing.trim_zeros_frames(x, eps=1e-07, trim='b')[source]

Remove leading and/or trailing zeros frames.

Similar to numpy.trim_zeros(), trimming trailing zeros features.

Parameters
  • x (numpy.ndarray) – Feature matrix, shape (T x D)

  • eps (float) – Values smaller than eps considered as zeros.

  • trim (string) – Representing trim from where.

Returns

Trimmed 2d feature matrix, shape (T' x D)

Return type

numpy.ndarray

Examples

>>> import numpy as np
>>> from nnmnkwii.preprocessing import trim_zeros_frames
>>> x = np.random.rand(100,10)
>>> y = trim_zeros_frames(x)