Skip to content

Commit

Permalink
SP move inhibitionRadius_ updates to inhibition function
Browse files Browse the repository at this point in the history
as inhibition is always ran first, this can be computed there.
  • Loading branch information
breznak committed Jul 6, 2019
1 parent 7bfb7bc commit 0e6a63f
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions src/htm/algorithms/SpatialPooler.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -472,14 +472,9 @@ void SpatialPooler::compute(const SDR &input, const bool learn, SDR &active) {
auto &activeVector = active.getSparse();

//boosting
// boostStrength_ = 0.0;
boostOverlaps_(overlaps_, boostedOverlaps_);

//inhibition
//update inhibition radius if it's time, only changes in local inh
if(!globalInhibition_ and isUpdateRound_()) {
inhibitionRadius_ = updateInhibitionRadius_();
}
inhibitColumns_(boostedOverlaps_, activeVector);

// Notify the active SDR that its internal data vector has changed. Always
Expand Down Expand Up @@ -845,6 +840,13 @@ void SpatialPooler::calculateOverlap_(const SDR &input,

void SpatialPooler::inhibitColumns_(const vector<Real> &overlaps,
vector<CellIdx> &activeColumns) const {

//update inhibition radius if it's time, only changes in local inh
if(!globalInhibition_ and isUpdateRound_()) {
inhibitionRadius_ = updateInhibitionRadius_();
}

//compute density (desired output SDR sparsity)
Real density = localAreaDensity_;
if (numActiveColumnsPerInhArea_ > 0) {
UInt inhibitionArea =
Expand Down

0 comments on commit 0e6a63f

Please sign in to comment.