Utility functions

This module contains miscellaneous utility functions.

Array utilities

batch_arrays_by_length(arrays_x, y[, ...])

Batches a list of arrays of different sizes, grouping them by size.

clip_arrays()

Clips each array to the specified maximum sequence length.

flat_to_inst(x, slices)

Takes a concatenated 2D data array and converts it to either a contiguous 2D/3D array or a variable-length 3D array, with one feature vector/matrix per instance.

frame_array(x, frame_size, frame_shift[, ...])

Frames an array over a given axis with optional padding and copying.

frame_arrays(arrays, frame_size, frame_shift)

Creates sequences of frames from the given arrays.

inst_to_flat(x)

The inverse of flat_to_inst().

is_mono_audio(x)

Checks if an array represents mono audio data.

make_array_array(x)

Helper function to make an array of arrays.

pad_arrays()

Pads each array to the nearest multiple of pad greater than the array size.

shuffle_multiple(*arrays[, numpy_indexing, seed])

Shuffles multiple arrays or lists in sync.

transpose_time()

Transpose the time and feature axis of each array.

Generic utilities

batch_iterable(it, batch_size[, return_last])

Batches an iterable into chunks of size batch_size.

filter_kwargs(kwargs, method)

Removes incompatible keyword arguments.

itmap(s)

Returns a new map function that additionally maps tuples to tuples and lists to lists.

ordered_intersect(a, b)

Returns a list of the intersection of a and b, in the order elements appear in a.

ordered_subsets(it[, max_size])

Iterate over all ordered subsets of the iterable it, up to a given maximum size.

subsets(it[, max_size])

Iterate over all subsets of the iterable it, up to a given maximum size.

Miscellaneous utilities

TqdmMultiprocessing([total, desc, unit, ...])

TqdmParallel([total, desc, unit, leave])

Convenience class that acts identically to joblib.Parallel except it uses a tqdm progress bar.

Type definitions

PathOrStr

ScoreFunction