Data manipulation¶
Module for manipulating data.
-
breze.learn.data.
shuffle
(data)¶ Shuffle the first dimension of an indexable object in place.
-
breze.learn.data.
padzeros
(lst, front=True, return_mask=False)¶ Given a list of arrays, pad every array with up front zeros until they reach unit length.
Each element of lst can have a different first dimension, but has to be equal on the other dimensions.
-
breze.learn.data.
collapse_seq_borders
(arr)¶ Given an array of ndim 3, return a view of ndim 2 where the first dimension is flattened out.
-
breze.learn.data.
uncollapse_seq_borders
(arr, shape)¶ Return a view of ndim 3, given an array of ndim 2, where the first dimension is expanded to 2 dimensions of the given shape.
-
breze.learn.data.
skip
(X, n, d=1)¶ Return an array X with the same number of rows, but only each n‘th block of d consecutive columns is kept.
Crude way of reducing the dimensionality of time series.
-
breze.learn.data.
interleave
(lst)¶ Given a list of arrays, interleave the arrays in a way that the first dimension represents the first dimension of every array.
This is useful for time series, where multiple time series should be processed in a single swipe.
-
breze.learn.data.
uninterleave
(lst)¶ Given an array of interleaved arrays, return an uninterleaved version of it.
-
breze.learn.data.
interpolate
(X, n_intermediates, kind='linear')¶ Given an array of shape (j, k), return an array of size (j * n_intermediates, k) where each i * n_intermediated element refers to the i’th element in X while all the others are linearly interpolated.
-
breze.learn.data.
windowify
(X, size, offset=1)¶ Return a static array that represents a sliding window dataset of size size given by the list of arrays `.
-
breze.learn.data.
iter_windows
(X, size, offset=1)¶ Return an iterator that goes over a sequential dataset with a sliding time window.
X is expected to be a list of arrays, where each array represents a sequence along its first axis.
-
breze.learn.data.
split
(X, maxlength)¶ Return a list of sequences where each sequence has a length of at most maxlength.
Given a list of sequences X, the sequences are split accordingly.
-
breze.learn.data.
collapse
(X, n)¶ Return a list of sequences, where n consecutive timesteps have been collapsed into a single timestep by concatenation for each sequence.
Timesteps are cut off to ensure divisibility by n.
-
breze.learn.data.
uncollapse
(X, n)¶ Return a list of sequences, where each timestep is divided into n consecutive timesteps.
-
breze.learn.data.
consecutify
(seqs)¶ Given sequences of equal second dimension, put them into a consecutive memory block M and return it. Also return a list of views to that block that represent the given sequences.