twodlearn.datasets.Batch_generator module

class twodlearn.datasets.Batch_generator.BatchGenerator(X, y, batch_size, RandomShuffle=True, task='classification')[source]

Bases: object

Generates batches in form of a matrix, where each row constitutes a single sample

get_next()[source]
class twodlearn.datasets.Batch_generator.SeqBatchGenerator(data, batch_size, window_size, out_format='tensor')[source]

Bases: object

Generates batches for a single class, considering discontinuous data divided in pages.

For data that is piecewise continuous, each continuous part is called a page. Therefore the hole dataset is a list of pages.

The windows generated from the dataset contain only continuous data.

get_next_list_tensor(inc=None)[source]

Returns the next batch in a list, where each element of the list corresponds to a single sequence.

get_next_list_windows()[source]
get_next_tensor(inc=None)[source]
class twodlearn.datasets.Batch_generator.SeqMultiClassBatchGenerator(data_in, batch_size, window_size, mrk=None, y=None, out_format='tensor', input_format='')[source]

Bases: object

Generates batches of sequences for multiple classes

Atributes:
  • bg_l: list containing the batch generator for each class

  • data: datset from where the batches are generated. Is structured as data[class][page] after initialization

  • n_classes: number of classes

  • batch_size:

  • window_size:

get_next(inc=None)[source]
twodlearn.datasets.Batch_generator.one_hot(labels, n_classes)[source]

Converts a 1-D list of labels into a one-hot encoding representation