-
Notifications
You must be signed in to change notification settings - Fork 74
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
MNIST params #533
MNIST params #533
Changes from 11 commits
577c5a1
1c72681
9522acf
454f7a9
3ccadc6
1f0187f
4eefb03
62199c7
b13153e
7ab155b
c9c436e
3b6ea96
e97d10b
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -437,7 +437,7 @@ void SpatialPooler::initialize( | |
overlapDutyCycles_.assign(numColumns_, 0); | ||
activeDutyCycles_.assign(numColumns_, 0); | ||
minOverlapDutyCycles_.assign(numColumns_, 0.0); | ||
boostFactors_.assign(numColumns_, 1); | ||
boostFactors_.assign(numColumns_, 1.0); //1 is neutral value for boosting | ||
overlaps_.resize(numColumns_); | ||
overlapsPct_.resize(numColumns_); | ||
boostedOverlaps_.resize(numColumns_); | ||
|
@@ -500,6 +500,11 @@ void SpatialPooler::compute(const SDR &input, const bool learn, SDR &active) { | |
|
||
void SpatialPooler::boostOverlaps_(const vector<SynapseIdx> &overlaps, //TODO use Eigen sparse vector here | ||
vector<Real> &boosted) const { | ||
if(boostStrength_ < htm::Epsilon) { | ||
const auto begin = static_cast<const SynapseIdx*>(overlaps.data()); | ||
boosted.assign(begin, begin + overlaps.size()); | ||
return; //boost ~ 0.0, we can skip these computations. | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. this probably changed the results for the test There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Can you be a little more certain of this? Why exactly did the unit tests change? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Nevermind, I see how your unit test works. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. nitpick: |
||
} | ||
for (UInt i = 0; i < numColumns_; i++) { | ||
boosted[i] = overlaps[i] * boostFactors_[i]; | ||
} | ||
|
@@ -755,6 +760,16 @@ void SpatialPooler::updateBoostFactors_() { | |
} | ||
|
||
|
||
void applyBoosting_(const UInt i, | ||
const Real targetDensity, | ||
const vector<Real>& actualDensity, | ||
const Real boost, | ||
vector<Real>& output) { | ||
if(boost < htm::Epsilon) return; //skip for disabled boosting | ||
output[i] = exp((targetDensity - actualDensity[i]) * boost); //TODO doc this code | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. where is a doc for this exp based boosting, please? |
||
} | ||
|
||
|
||
void SpatialPooler::updateBoostFactorsGlobal_() { | ||
Real targetDensity; | ||
if (numActiveColumnsPerInhArea_ > 0) { | ||
|
@@ -767,9 +782,9 @@ void SpatialPooler::updateBoostFactorsGlobal_() { | |
} else { | ||
targetDensity = localAreaDensity_; | ||
} | ||
|
||
for (UInt i = 0; i < numColumns_; ++i) { | ||
boostFactors_[i] = exp((targetDensity - activeDutyCycles_[i]) * boostStrength_); | ||
for (UInt i = 0; i < numColumns_; ++i) { | ||
applyBoosting_(i, targetDensity, activeDutyCycles_, boostStrength_, boostFactors_); | ||
} | ||
} | ||
|
||
|
@@ -792,8 +807,7 @@ void SpatialPooler::updateBoostFactorsLocal_() { | |
} | ||
|
||
const Real targetDensity = localActivityDensity / numNeighbors; | ||
boostFactors_[i] = | ||
exp((targetDensity - activeDutyCycles_[i]) * boostStrength_); | ||
applyBoosting_(i, targetDensity, activeDutyCycles_, boostStrength_, boostFactors_); | ||
} | ||
} | ||
|
||
|
@@ -828,7 +842,7 @@ void SpatialPooler::calculateOverlapPct_(const vector<SynapseIdx> &overlaps, | |
|
||
|
||
void SpatialPooler::inhibitColumns_(const vector<Real> &overlaps, | ||
vector<UInt> &activeColumns) const { | ||
vector<CellIdx> &activeColumns) const { | ||
Real density = localAreaDensity_; | ||
if (numActiveColumnsPerInhArea_ > 0) { | ||
UInt inhibitionArea = | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I never get to decay play a role!?