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... | |
Generator of instances of the binary sequence copy task.
The parameters are:
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):
CopyTask | ( | const size_t | maxLength, |
const size_t | nRepeats, | ||
const bool | addSeparator = false |
||
) |
Creates an instance of the sequence copy task.
maxLength | Maximum length of sequence that has to be repeated by model. |
nRepeats | Number of repeates required to solve the task. |
addSeparator | Flag indicating whether generator should emit separating symbol after input sequence. |
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.
input | The variable to store input sequences. |
labels | The variable to store output sequences. |
batchSize | The dataset size. |
fixedLength | Set to true to denoted fixed length dataset. |
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.
input | The variable to store input sequences. |
labels | The variable to store output sequences. |
batchSize | The dataset size. |