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... | |
Generator of instances of the binary addition task.
The parameters are:
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):
AddTask | ( | const size_t | bitLen | ) |
Creates an instance of the binary addition task.
bitLen | Maximum binary length of added numbers. |
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.
input | The variable to store input sequences. |
labels | The variable to store output sequences. |
batchSize | The dataset size. |
fixedLength | Flag that indicates whether the method should return sequences of even length. |
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. |