-
Notifications
You must be signed in to change notification settings - Fork 75
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
TM: cellsToColumns #397
TM: cellsToColumns #397
Conversation
that SDR.size matches TM.numberOfColumns
which is a convenience wrapper for TM::columnForCell()
these methods have been replaced by TM.cellsToColumns. Because the conversion method is only valid for TM's cells.
add check + print
which represents TM's output as mini-columns, and is a union of active and predictive at the current time. Used by Hotgym example, and TMRegion
* | ||
* @return SDR size(COLS) | ||
*/ | ||
sdr::SDR getOutputColumns() const; |
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.
better name?
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 dont think that this is right. I dont think the TM should ever use the union of active & predicted cells.
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.
There are two use cases for converting from cells to minicolumns, decode and anomaly. We've decided not to implement decode. I would really like to see anomaly as part of this PR.
Which of the 2 methods do you objectify to?
-
cellsToColumns
:- yes, a convenience method,
columnForCell(cell)
already exists- I propose removal of columnForCell
- or either of them can be made private
- this method is needed for
TM::anomaly()
which operates with columns. - we had the same functionality in VectorHelpers::cellsToColumns
- but I decided to move it to TM, as it's the only user and the way of conversion (plain topology) makes sense only for TM. So as not to make it confusing and tempting for other, misused usages (if in VectorHelpers)
- yes, a convenience method,
-
getOutputColumns
..TM output as union of active + predictive columns- conceptually, I think TM should output only columns (not cells)
- as cols are needed for it to be used in a hierarchy (and in anomaly, decode,...)
- what is Classifier using? It should probably use cols as well.
- cells should be an implementation detail and hidden from the user
- cells are still accessible for the likes of CP, etc.
- as cols are needed for it to be used in a hierarchy (and in anomaly, decode,...)
- I think we should provide all 3 of them:
- getColumnsActive(), Predictive(), Both()
- (both = current getOutputCols)
- or fill them in compute method
TM::compute(const SDR& input, bool learn, SDR& output)
- impl details how to well decide which mode to fill in output (enum?), default param, etc...
- Anomaly, NetworkAPI (TMRegion), Classifier(?) would work with these outputs
- getColumnsActive(), Predictive(), Both()
- conceptually, I think TM should output only columns (not cells)
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 object to getOutputColumns
. It should not mix the active & predictive cells together.
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.
It should not mix the active & predictive cells together.
why should not? A TM's minicolumn is activated by at least one active cell, be it feed forward activation, or predictive/contextual.
It's not like it's impossible to compute manually, we have access to the active, predictive cells; and will now have the cellsToColumns transformation.
- but the user (for hierarchy, classifier, TMRegion, TM's direct output) has to do exactly what is this method about.
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.
ok, I quickly double checked with https://numenta.com/assets/pdf/biological-and-machine-intelligence/BaMI-Temporal-Memory.pdf
And you're right, there's no sense in mixing active+pred columns.
- I'll remove getOutpuColumns
- TMRegion outputs that with option orOutputCols, I then say we should rm that too.
- instead, do we want to offer TM.activeCols, TM.predictiveCols ? That would be of use for anomaly
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.
@ctrl-z-9000-times ok, we agreed that mixing active + predictive cols/cells does not make sense. I'm removing the method from TM, not looking at TMRegion.
@dkeeney is it necessary for a Region to implement "bottomUpOutput"?
Currently we return either a union of cells (act+pred) or as columns, depending on a switch.
- what should we return as bottom up output? (I'd say feed-forward activation as columns)
- or should we remove the field altogether? (ideally)
- currently, NetworkAPI has now way to obtain columns (active, predicted; separately), and it probably should.
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.
@dkeeney is it necessary for a Region to implement "bottomUpOutput"?
This is its only output. I think we need something. I think we could go with columns only. We could add additional outputs for active and predicted as separate outputs.
What makes since?
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.
any combination of {active, predictive} x {cells, columns} makes sense.
I'll probably open a new PR for that, and just remove the current orOutputColumns logic
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.
* columns(binary vector). If any cell of a column is active (1), the column | ||
* is considered active. See TP for details. | ||
*/ | ||
static std::vector<UInt> cellsToColumns(const std::vector<UInt>& cellsBinary, const UInt cellsPerColumn) |
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.
moved to TM
There are two use cases for converting from cells to minicolumns, decode and anomaly. We've decided not to implement decode. I would really like to see anomaly as part of this PR. Please demonstrate how the user will interact with the TM to get the anomaly. |
Ok I read the unit tests and i think i understand how to use it. Would still like to see anomaly though, even if in psuedo code |
I tried to make smaller PRs :) Do you want to keep this separate, or add anomaly here?
|
Sorry for the conflicting advice. This PR can be just for |
I prefer A, but B is acceptable too. |
it does not make sense to mix feed-forward (active) activations with contextual (predictive)
as not supported, follows removal of TM::getColumnsOutput
there's no bug in Random, we're ok!
instead of Scalar
use seed for RDSE, SDR use addNoise instead of randomize
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 have a few comments and change requests. Overall this PR is good.
to be used for deterministic check and output
outSP SDR has to be initialized with dimensions, even if later successfully assigned (outSP = outSPglobal)
for SP local, also remove the time check for Windows CI
Added your feedback, this is now working. Ready for another round of reviews when you got time. Thanks |
I'm not sure why the Windows run would fail deterministic checks .. :( |
on Windows, fix 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.
Ok, this looks good to me.
It looks like the CI passed unit tests so I assume you figured out the problem with Windows. 👍
@@ -20,8 +20,8 @@ class BenchmarkHotgym { | |||
bool useSPglobal=true, | |||
bool useTM=true, | |||
const UInt COLS = 2048, // number of columns in SP, TP | |||
const UInt DIM_INPUT = 10000, | |||
const UInt CELLS = 10 // cells per column in TP | |||
const UInt DIM_INPUT = 1000, |
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.
Oh, good. You reduced the size of the test :)
"* 'cellsPerColumn'.", | ||
"* 'cellsPerColumn' by default; if orColumnOutputs is " | ||
"set, then this returns only numberOfCols. " | ||
"The activations come from TM::getActiveCells(). ", |
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.
Good, I see you described what output 'bottomUpOut' contains. 👍
@ctrl-z-9000-times can you review as well when you've got time? You've requested changes, so I'll need your approval |
unfortunately, I didn't. Just ifdefed Windows and delegated the fix to its dedicated issue #194 |
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 looks good to me. I can't see why the test is failing on one platform.
Thanks for your reviews! |
TM::getOutputColumns convenience method