the-aerospace-corporation / brainblocks

Practical Tool for Building ML Applications with HTM-Like Algorithms
GNU Affero General Public License v3.0
59 stars 13 forks source link

SequenceLearner does not send seed to Block constructor #18

Closed klokare closed 2 years ago

klokare commented 3 years ago

In sequence_learner.cpp line 55, the call to Block() does not pass the seed parameter to the parent constructor.

SequenceLearner::SequenceLearner(
    const uint32_t num_c,    // number of columns
    const uint32_t num_spc,  // number or statelets per column
    const uint32_t num_dps,  // number of dendrites per statelet
    const uint32_t num_rpd,  // number of receptors per dendrite
    const uint32_t d_thresh, // dendrite threshold
    const uint8_t perm_thr,  // receptor permanence threshold
    const uint8_t perm_inc,  // receptor permanence increment
    const uint8_t perm_dec,  // receptor permanence decrement
    const uint32_t num_t,    // number of BlockOutput time steps (optional)
    const bool always_update,  // whether to only update on input changes
    const uint32_t seed)     // seed for random number generator
: Block() {

I believe the call should be

SequenceLearner::SequenceLearner(
    const uint32_t num_c,    // number of columns
    const uint32_t num_spc,  // number or statelets per column
    const uint32_t num_dps,  // number of dendrites per statelet
    const uint32_t num_rpd,  // number of receptors per dendrite
    const uint32_t d_thresh, // dendrite threshold
    const uint8_t perm_thr,  // receptor permanence threshold
    const uint8_t perm_inc,  // receptor permanence increment
    const uint8_t perm_dec,  // receptor permanence decrement
    const uint32_t num_t,    // number of BlockOutput time steps (optional)
    const bool always_update,  // whether to only update on input changes
    const uint32_t seed)     // seed for random number generator
: Block(seed) {

I can create a pull request if you like but figured it's a small enough change to just note it in an issue.

The passing of the seed to Block() is also missing from blank_block.cpp line 26, scalar_transformer.cpp line 28, persistence_transformer.cpp line 28, discrete_transformer.cpp line 24. I suspect this is intentional as there is no need for randomness in these blocks and their constructors do not have a seed argument of their own.

jacobeverist commented 3 years ago

Thanks for the report! We'll get that fixed in the next update.

jacobeverist commented 2 years ago

Fixed in a5c089e7007b2d6ec4552e6d4dbba775ff8327e6