This repository has been archived by the owner on Sep 1, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 276
SP: add test for different constructor vs setter behavior #1387
Closed
Closed
Changes from all commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
aef9356
SP: add test for different constructor vs setter behavior
breznak 00b247a
SP: fix setActiveColumnsPerInhArea behavior
breznak 3514f27
SP: add setter test for potentialRadius
breznak d3d2a40
SP: add bounds check for setter PotentialPct, PotentialRadius
breznak File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -186,7 +186,7 @@ UInt SpatialPooler::getPotentialRadius() const | |
|
||
void SpatialPooler::setPotentialRadius(UInt potentialRadius) | ||
{ | ||
potentialRadius_ = potentialRadius; | ||
potentialRadius_ = std::min(potentialRadius, numInputs_); //crop to numInputs (input size) | ||
} | ||
|
||
Real SpatialPooler::getPotentialPct() const | ||
|
@@ -196,6 +196,7 @@ Real SpatialPooler::getPotentialPct() const | |
|
||
void SpatialPooler::setPotentialPct(Real potentialPct) | ||
{ | ||
NTA_ASSERT(potentialPct > 0 && potentialPct <= 1); //bounds check | ||
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. turn assert to always check? |
||
potentialPct_ = potentialPct; | ||
} | ||
|
||
|
@@ -219,7 +220,7 @@ void SpatialPooler::setNumActiveColumnsPerInhArea( | |
{ | ||
NTA_ASSERT(numActiveColumnsPerInhArea > 0); | ||
numActiveColumnsPerInhArea_ = numActiveColumnsPerInhArea; | ||
localAreaDensity_ = 0; | ||
localAreaDensity_ = -1; //disabling | ||
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. fixes incompatibility with API documentation |
||
} | ||
|
||
Real SpatialPooler::getLocalAreaDensity() const | ||
|
@@ -231,7 +232,7 @@ void SpatialPooler::setLocalAreaDensity(Real localAreaDensity) | |
{ | ||
NTA_ASSERT(localAreaDensity > 0 && localAreaDensity <= 1); | ||
localAreaDensity_ = localAreaDensity; | ||
numActiveColumnsPerInhArea_ = 0; | ||
numActiveColumnsPerInhArea_ = 0; //disabling | ||
} | ||
|
||
UInt SpatialPooler::getStimulusThreshold() const | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
this caused the difference, because constructor does implicitly crop to bounds, while setter didn't.
TODO: do implicitly, or throw NTA_ASSERT?