AddTask Class Reference

Generator of instances of the binary addition task. More...

Public Member Functions

 AddTask (const size_t bitLen)
 Creates an instance of the binary addition task. More...

 
void Generate (arma::field< arma::mat > &input, arma::field< arma::mat > &labels, const size_t batchSize, const 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 addition task.

The parameters are:

  • macimum binary length;

Every element of sequence is encoded as 1-dimensional vector (possible vector elements are {0, 1, 0.5} - the latter corresponds to '+' sign'). Generated datasets are compliant with mlpack format - every dataset element is shaped as a vector of length 3 * (sequence length),

Example of generated dataset (binary length = 2):

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

Definition at line 42 of file add.hpp.

Constructor & Destructor Documentation

◆ AddTask()

AddTask ( const size_t  bitLen)

Creates an instance of the binary addition task.

Parameters
bitLenMaximum binary length of added numbers.

Member Function Documentation

◆ Generate() [1/2]

void Generate ( arma::field< arma::mat > &  input,
arma::field< arma::mat > &  labels,
const size_t  batchSize,
const 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.
fixedLengthFlag that indicates whether the method should return sequences of even length.

◆ 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/add.hpp