Skip to content
This repository has been archived by the owner on Sep 1, 2023. It is now read-only.

Sparse map potential #201

Merged
merged 8 commits into from
Dec 31, 2014
Merged

Sparse map potential #201

merged 8 commits into from
Dec 31, 2014

Conversation

breznak
Copy link
Member

@breznak breznak commented Oct 7, 2014

mapPotential() in SP returns a sparse array of active indices only.
Fixes c++ part of numenta/nupic-legacy#1385
Fixes #279

@breznak
Copy link
Member Author

breznak commented Oct 7, 2014

..waiting until unittests are more verbose (#200)

mask = sp.mapPotential_(2, false);
NTA_CHECK(check_vector_eq(expectedMask2, mask));

// Test with wrapAround and potentialPct = 1
sp.setPotentialPct(1.0);

UInt expectedMask3[12] = {1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 1};
UInt expectedMask3[12] = {0, 1, 2, 3, 11}; //{1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 1};
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

remove comment

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How about comment on the line before for consistency, and if this is to visualize it then no need for the commas, etc:

// 111100000001
UInt expectedMask3[12] = {0, 1, 2, 3, 11};

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How about comment on the line before for consistency, and if this is to
visualize it then no need for the commas, etc:

Well, I wanted that to be minimal work :)

@@ -1535,7 +1535,9 @@ namespace nta {
<< "Invalid row index: " << row;
NTA_ASSERT((size_type)(end - begin) == nCols())
<< "SparseBinaryMatrix::rowFromDense: "
<< "Invalid vector size";
<< "Invalid vector size "
<< (size_type)(end - begin) << " vs. "
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

extra indentation space on this line and next can be removed

@scottpurdy
Copy link
Contributor

👍

@rhyolight
Copy link
Member

@breznak Good to merge once you've addressed the remaining review comments.

@rhyolight rhyolight modified the milestone: Beta Oct 31, 2014
@rhyolight
Copy link
Member

@breznak Still in your court?

@rhyolight
Copy link
Member

@breznak Status update?

@@ -1545,6 +1547,24 @@ namespace nta {
}

//--------------------------------------------------------------------------------
template <typename InputIterator>
inline void
rowFromSparse(size_type row, InputIterator begin, InputIterator end)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There is already a method called replaceSparseRow that looks like it does the same thing

@rhyolight
Copy link
Member

@coveralls
Copy link

Coverage Status

Coverage remained the same when pulling b6c0db3 on breznak:sparse_mapPotential into 08731c8 on numenta:master.

rhyolight added a commit that referenced this pull request Dec 31, 2014
@rhyolight rhyolight merged commit fe6fd6b into numenta:master Dec 31, 2014
@breznak breznak mentioned this pull request Dec 31, 2014
rhyolight added a commit that referenced this pull request Dec 31, 2014
@breznak breznak mentioned this pull request Dec 31, 2014
rhyolight added a commit to david-ragazzi/nupic.core that referenced this pull request Jan 5, 2015
rhyolight added a commit to david-ragazzi/nupic.core that referenced this pull request Jan 5, 2015
breznak pushed a commit to breznak/nupic.core that referenced this pull request Feb 26, 2019
Fixed Collections. It is now a header only implementation
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Sp _mapPotential() should return sparse array (cpp counterpart)
4 participants