htm-community / comportex

Hierarchical Temporal Memory in Clojure
154 stars 27 forks source link

decompose encoders into serializable sensors #27

Closed floybix closed 8 years ago

floybix commented 8 years ago

Fixes #19

Sensors are defined as [selector encoder]. Both selectors and encoders are serializable; so HTM models should now be fully serializable.

This requires changes to all user code to define sensors. The argument list of regions-in-series has changed.

Is it too confusing to have "sensors" as well as "senses" (the stateful output of sensors)?

What about htm-export ... thinking we might need a general export protocol to clear out any caches (e.g. encoder caches) and compress the model - e.g. removing the reverse index in SynapseGraphs which can be rebuilt ("import" protocol?)...

floybix commented 8 years ago

D'oh. fixed.

Forgot to emphasise that I changed usage of all encoders. Probably should think more about their usability / consistency.

mrcslws commented 8 years ago

Nice touch, allowing keywords and vectors as selectors via extend-protocol.

The sensor + sense distinction makes sense. Speaking for myself, I am not confused.

My gut reaction is we should remove htm-export now that the HTM is serializable. If at some later time there's a "our serialized models are too big" problem, we could address it at that point. The notebook no longer uses htm-export. I'm not super-opinionated though, I could be swayed.

One part I'm a little bit unsure of. This deals with your previous change. The PHTM methods generally return a transformed RegionNetwork. Except for sense, which is a way of applying a sensor to an input, and returning the bits. Did you consider instead having sense change the model's input bits, and htm-activate do a column activation based on the current input bits? Then sense would contain all calls to sense-activate, and htm-activate would contain all calls to region-activate. htm-step would consist of calling each of these methods in order. I might be wrong, I just now stumbled on this idea after I started this paragraph.

Just musing. This change looks good. :+1:

floybix commented 8 years ago

You are right, as usual. That ends up being much cleaner.

I really appreciate your help with design - it is hard.

Removed htm-export.