sciquence.sequences

Cutting & trimming

seq(array) Cut input array into sequences consisting of the same elements
nseq(array) Returns sequences consisting of zeros
pseq(array) Returns sequences consisting of ones
specseq(array, element) Return sequences consisting of specific tag
seqi(array) Get list of sequences and corresponding list of indices
nseqi(array) Get list of sequences and corresponding list of indices
pseqi(array) Get list of sequences and corresponding list of indices
chunk(array, chunk_size) Split numpy array into chunks of equal length.

Comparing

lseq_equal(lseqa, lseqb) Compare two lists of ndarrays

Input transformations

rnn_input(X, y, window_size[, step]) Prepare input for recurrent neural network.
seq2seq_input(X, y, window_size[, step, ...]) Prepare input for sequence2sequence recurrent neural network.

Searching

mslc Given a length n real sequence, finds the consecutive subsequence of length at most U with the maximum sum in O(n) time.
longest_segment Find the longest subsequence which scores above a given threshold in O(n)
max_avg_seq Given a length n real sequence, finding the consecutive subsequence of length at least L with the maximum average can be done in O(n log L) time.