Hi @mraptor, The answer to your question can be found in temporal_memory.py, as that is where (lateral) synapses and segments are created. It proceeds in 3 stages:
1. activateCorrectlyPredictiveCells() is called to gather a list of cells that are both correctly predicted and incorrectly predicted seen here: https://github.com/numenta/nupic/blob/master/src/nupic/research/temporal_memory.py#L242 2. learnOnSegments() is called (being passed the predictedInactiveCells) which then calls #3 from here: https://github.com/numenta/nupic/blob/master/src/nupic/research/temporal_memory.py#L371 3. adaptSegment() is last called to "cull" the synapses which no longer predict activations relevant to the changing data. seen here: https://github.com/numenta/nupic/blob/master/src/nupic/research/temporal_memory.py#L587 I kind of feel like this is best left as an exercise for the reader - as it is incredibly illuminating to invest in a study of the code; leading to the eventual ability to answer any kind of question one might come up with. Granted this is very complicated stuff (I'm still learning even after being thrown in the deep end for over a year!) - but I really don't see any other way to truly grasp the algorithms in full detail? Not that you won't find a plenty of friendly people in the community eager to help - but I almost feel like that might not help as much as one might think? Anyway, always ask though! Cheers, David On Thu, Dec 3, 2015 at 2:45 PM, mraptor <[email protected]> wrote: > > > The model keeps trying to learn sequences and is creating an > increasing number of synapses and segments containing the new random > transitions that it sees. > > > > What is the mechanism/algorithm for creating/destroying segments ? And > the "attachment" of synapses ! > Couldn't find explanation for this process in the docs. > > thanks > > -------| http://ifni.co > > > On Thu, Dec 3, 2015 at 2:25 PM, Subutai Ahmad <[email protected]> wrote: > > Roberto, > > > > This is not unexpected if you are feeding in random data all the time. > The > > model keeps trying to learn sequences and is creating an increasing > number > > of synapses and segments containing the new random transitions that it > sees. > > If you feed in more predictable data (e.g. self.amplitude = > (self.amplitude > > + 1)%200 ) you should not see such a large increase in time. If you > still > > see a big increase with predictable data then there might indeed be some > > memory issue. > > > > --Subutai > > > > On Thu, Dec 3, 2015 at 9:34 AM, Roberto Becerra <[email protected] > > > > wrote: > >> > >> Hi community! > >> > >> So, I have built a very simple script just to try the speed of execution > >> of NuPIC, because I am seeing that it slows down a lot after a few > hours of > >> execution, I wonder if you have observed this or have any comments on > >> something weird I might be doing. The script goes like this: > >> > >> self.model = ModelFactory.create(model_params.MODEL_PARAMS) > >> self.model.enableInference({'predictedField': 'binAmplitude'}) > >> self.likelihood= AnomalyLikelihood() > >> self.startTime = time.time() > >> while True: > >> self.amplitude = random.randint(0,200) > >> self.result = self.model.run({"binAmplitude" : > >> self.amplitude}) > >> self.anomaly = self.result.inferences['anomalyScore'] > >> self.likelihood = > >> self.likelihood.anomalyProbability(self.amplitude, self.anomaly) > >> print 'Loop Period: ' + format(time.time() - self.startTime) > >> self.startTime = time.time() > >> > >> It is creating one model and running forever with random inputs. In the > >> beginning the Loop Period is around 0.01 seconds, or 100 Hz, but as time > >> goes on (I left it running over night) the period increased to values > that > >> are not constant, but reaching up to 4 secods, 10 seconds or even 128 > >> seconds! > >> > >> I am running quite a limited computer, but I don“t think this is the > >> cause, maybe some memory leak? or resources that are available for > python? > >> > >> OSX El Capitan (but it was happening in Yosemite as well) > >> Mac Mini Intel Core 2 Duo 2.0GHz , A1283 2GB 250GB > >> > >> What do you think of this? Thanks! > >> > >> Roberto Becerra > >> https://iobridger.wordpress.com/ > > > > > > -- *With kind regards,* David Ray Java Solutions Architect *Cortical.io <http://cortical.io/>* Sponsor of: HTM.java <https://github.com/numenta/htm.java> [email protected] http://cortical.io
