-
Notifications
You must be signed in to change notification settings - Fork 75
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
add learnPattern ClassifierRegion #800
base: master
Are you sure you want to change the base?
Conversation
when I try the rest api, then ClassifierRegion learn with TM.activeCells and infer with TM.activeCells, the result is alway the same. I read the examples `hello_tm.py`, tm predict next value is predictedActiveCells. So ClassifierRegion need add an learnPattern for learning, and origin pattern for infer.
I am trying to understand why you need a 'learnPattern' . Keep in mind that the Classifier is not using a htm algorithm, instead it uses classical NN to perform the matching of bucket to pattern. This means that it takes LOTS of input for each bucket value in learn mode to learn enough to guess which bucket value would produce any 'pattern' value. |
I use ClassifierRegion to infer predictedActiveCells and learn with activeCells |
I don't think this is going to give you what you expect. For example, assume any network of SP,TM or whatever and you feed a set of buckets from the encoder into that network. Then you hook up a Classifier to some output that that you are interested in. I think predictedActiveCells output in your case but it could be any output. When the encoder passes in pattern A, the network generates pattern A'. And if it is passing bucket B to your network it returns pattern B'. If the Classifier sees enough examples of A into A' and B into B' while in learning mode then when learning is turned off it will continue to infer A was the bucket when it sees pattern A'. For this to work, the pattern passed to the classifier while learning must be the same pattern that is used by the classifier to infer. |
I guess I can see what @Lupino is trying to achieve.
In code this would be
I guess we cannot do that with the current NetworkAPI architecture (?) (we cannot do that with neither SP,TM). |
type: Real64, count: 0}, | ||
pattern: { description: "An SDR output bit pattern for a sample. Usually the output of the SP or TM. For example: activeCells from TM", | ||
type: SDR, count: 0}, | ||
learnPattern: { description: "An SDR output bit pattern for a sample. Usually the output of the SP or TM. For example: activeCells from TM", |
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.
how would this learn/infer pattern input work with async data? I mean, Say you want to learn a single pattern, and then make inference on 10 samples. What would be on learnPattern input? And will this behave correctly?
We might need (already have) a separate learn
& infer () const
, and call it separately in the ClassRegion.
But I still don't understand why you would want to train with one stream and match patters from another stream, even if the outputs are correlated. But perhaps you see a use for this... I am a little concerned that it complicates the connections for the majority of users that would want to train on the same pattern stream as that used for inference. If this change goes in, they will have to provide two connections from the TM output to the Classifier. This would break our compatibility with the NuPic API so I don't want to be two quick to change it. I would rather step back and think about this a little and see if there is another way to give you want you need without changing the API. |
tm.predictedActiveCells give the wrong pattern.size, but tm.predictiveCells is fine |
this is a valid concern.
Is it possible to re-link the inputs to a region (Classifier) at runtime? As in
...but I guess this is not the usage pattern, NetworkAPI is like a (tensorflow)graph, constructed once, and then data flow in the designed structure. (without user's active control) |
It is not quite that ridged but nearly so. The NetworkAPI does have a removeLink() function although it has not been implemented in the REST API. Although, rewiring in the middle of a run may still not do what you want. I assume you need to always do infer even while in the learning mode. So this would require that somehow there needs to be two streams of data connected to the ClassifierRegion. To avoid breaking existing code, we cannot rename or change the behavior of the 'pattern' input. I agree with @breznak that 'inferPattern' and 'learnPattern' would be logical choices but it breaks code. Perhaps a compromise is to have both a 'pattern' and a 'learnPattern' input. The latter is optional and if not present, 'pattern' is used for both inference and learning when in learn mode. I fear that this will still be confusing for folks, especially since even I still don't understand why there needs to be separate learning and inference pattern inputs. I see that it works, but why can't the leaning pattern also be the infer pattern in all cases? |
When learnPattern is set, use learnPattern. inferPattern is set, use inferPattern
I revert pattern for compat. |
I don't want you to give up just because I object. There still might be some way to get you what you need. Perhaps if I understand the need better it would present a possible solution. As I see it, tm.predictiveCells is a subset of tm.bottomUpOut and you want to train using tm.bottomUpOut because it might have more variety of the output patterns than tm.predictiveCells and therefore would train faster. Is this correct? |
can we reach some consensus on this one? I can see both pros & cons here. |
I still do not understand the need to train on one stream and then use that to infer on another stream. It seems to me that the best stream to train on would be the one on which you will be inferring on. So I must be missing something. If we need to do this... |
I guess this would work nicely, let's wait for OP if this solves the issue and is actually needed.
my guess is either 'because we can' To me this is only issue of implementation/enablement of the NetworkAPI, as in the cpp/py code you could do either with it manually. It's upto us (mostly you?) to judge if the extention does/does not overcomplicate the API ? |
Have we reached a solution, or this just dies off of lack of interest? Closing? |
3d93a23
to
2f47541
Compare
when I try the rest api, then ClassifierRegion learn with TM.activeCells and
infer with TM.activeCells, the result is alway the same.
I read the examples
hello_tm.py
, tm predict next value is predictedActiveCells.So ClassifierRegion need add an learnPattern for learning, and origin
pattern for infer.