CopyTask Class Reference

Generator of instances of the binary sequence copy task. More...

Public Member Functions

 CopyTask (const size_t maxLength, const size_t nRepeats, const bool addSeparator=false)
 Creates an instance of the sequence copy task. More...

 
void Generate (arma::field< arma::mat > &input, arma::field< arma::mat > &labels, const size_t batchSize, bool fixedLength=false) const
 Generate dataset of a given size. More...

 
void Generate (arma::mat &input, arma::mat &labels, const size_t batchSize) const
 Generate dataset of a given size and store it in arma::mat object. More...

 

Detailed Description

Generator of instances of the binary sequence copy task.

The parameters are:

  • maximum sequence length;
  • number of sequence repetitions.

Input/output sequences are aligned to have the same length: input sequence is padded with zeros from the right end, output sequence is padded with zeros from the left end. The sequences are formed of 2-dimensional vectors of the format [sequence element, input flag], where input flag = 0 iff first vector element is a sequence element.

Generated datasets are compliant with mlpack format - every dataset element is shaped as a vector of length (elem-length) * (input sequence length + target sequence length), where elem-lemgth is 2 for input sequences and 1 for output sequences.

Example of generated dataset (sequence length = 3, repetition count = 2):

  • Input sequence: [1,0,0,0,1,0,0,1,0,1,0,1,0,1,0,1,0,1]
  • Output sequences: [0,0,0,1,0,1,1,0,1]

Definition at line 48 of file copy.hpp.

Constructor & Destructor Documentation

◆ CopyTask()

CopyTask ( const size_t  maxLength,
const size_t  nRepeats,
const bool  addSeparator = false 
)

Creates an instance of the sequence copy task.

Parameters
maxLengthMaximum length of sequence that has to be repeated by model.
nRepeatsNumber of repeates required to solve the task.
addSeparatorFlag indicating whether generator should emit separating symbol after input sequence.

Member Function Documentation

◆ Generate() [1/2]

void Generate ( arma::field< arma::mat > &  input,
arma::field< arma::mat > &  labels,
const size_t  batchSize,
bool  fixedLength = false 
) const

Generate dataset of a given size.

Parameters
inputThe variable to store input sequences.
labelsThe variable to store output sequences.
batchSizeThe dataset size.
fixedLengthSet to true to denoted fixed length dataset.

◆ Generate() [2/2]

void Generate ( arma::mat &  input,
arma::mat &  labels,
const size_t  batchSize 
) const

Generate dataset of a given size and store it in arma::mat object.

Parameters
inputThe variable to store input sequences.
labelsThe variable to store output sequences.
batchSizeThe dataset size.

The documentation for this class was generated from the following file:
  • /home/jenkins-mlpack/mlpack.org/_src/mlpack-git/src/mlpack/methods/ann/augmented/tasks/copy.hpp