Hello,
I try to use HTM for solving anomaly detection problem.
I have system that produce logs during the activation process, the system work in cycling manner, one process ended and another same process begin .
Each log contains 1000 samples each sample contains 10 different features that represent the current system mode (categorical features).
I training the HTM model on 40 different valid logs (first I training the SP, than the HTM itself ) , the training be done log after log (training with the first one then with the second etch).
In the evaluation phase I take another 10 different valid logs , and apply on them the training HTM model.
I received strange result,( working with anomaly score without sliding windowâŚ)
In all 10 logs the first sample, received high anomaly score
I received high anomaly score in all the 10 evaluation logs **in the same samples **, even the logs was different one from the other in most of the features
Thanks,
MAK
I think you mean you trained the SP first, then the TM, right?
Yes you are right, you catch meâŚ
The anomaly scores should go down overall as patterns are learned.
The anomaly score is received in the validity phase , I means I finished to train the SP and the TM, and I received the high anomaly score in the same position in the validityâŚ, After I finish to training the model, on valid logs
Thanks
I donât understand the phases of your training. With temporal models like HTM, you donât have different training vs testing vs validation data. You simply have one data stream representing reality, and you can attach the HTM to it and turn learning on to learn. The model may be trained on any part of the data stream, but must be sequential.
I suggest you choose a number of data points to train HTM models on, and always start evaluating your model after they see that many points.
Hii,
I first want to examine the HTM capability in offline.
So I take 40 different logs that representing 40 different valid process (each of them contains 1000 records) . I training the SP and the TM on those dataset (learning=true).
Then I run 10 different valid streams with learning=false on the TM&SP that I created aboveâŚ
And I received the same high error score every time in the same position (different score but in the same position).
I create the validity process for character the error on the valid data.
So what I do wrong? , why I canât training the SP&TM offline? With different sequence of the same process (with different variations)
Thanks,
MAK
What do you mean by âofflineâ? This is not a term we use for HTM. It is always an âonline learning systemâ, meaning it learns with each new piece of temporal data, like brains.
When you make learning=false, you prevent learning. So is this what you mean? In this case, the way HTM works does not change, only synapse permanence values are never updated. Everything else works the same. If you make learning=false, the HTM will not train.
Could you post the first few lines of the data youâre passing in? There could be a mismatch between the way you imagine the experiment and whatâs actually happening in NuPIC.
Hii,
In offline I mean that I have logs that contains features that describe the system mode and behavior
The system working in cycles of 5 minutes (each log describe cycle) .
Each cycle describe the same process (you can look on each cycle for example as item production or card game or even as chess game)
In each cycle the same process is done, but the system behavior and the internal system mode can be different in each step.
So I want to training the HTM model with all available logs , so the HTM will expose as much information as possible and will familiar with all system patterns.
I want to check to ability of the system to recognize anomaly in the system internal modeâŚby analyze the anomaly score
So I didnât understand where is the problem in my methodology ?
Thanks,
MAK
These statements contradict each other, donât they?
If there is one process, and you have lots of data representing this process occurring over and over, this is a good thing to train an HTM model. The model will learn the structure of the temporal process, and as you give it new process data, it should be able to return useful anomaly indications. But you must reset the temporal memory algorithm at the end of each process.
If you have many different processes that each need to be learned, you need to train one HTM model on each process.
Sounds interesting and I donât know if there are any problems in your methodology, however I canât thoroughly check without seeing at least 1 line of data and the accompanying model parameters. It could be that your research concept is perfectly valid, though something in the implementation details is messing up the results.
These statements contradict each other, donât they?
No, same process (for example poker game, chess game) but with different values in each feature.
But you must reset the temporal memory algorithm
Thanks for your recommendation, I will add this instruction . and will report about the results.
P.S: can you explain please what happen in the TM internal mode when we active the reset command?
Thanks,
MAK
It basically knocks the TM out of predicting the current sequence by emptying its sets of predictive and active cells. Calling a reset means that all SP columns will burst on the next time step and the anomaly score will be 1. This is used in cases where the total sequence is composed of sub-sequences with clear ending points, so we know how long these sequences are. Take the following sequence for instance:
A â B â C â D
X â B â C â Y
A â E â F â G
X â E â F â G
If we want to frame this as a set of separate sequences weâd call reset after âDâ, âYâ and both 'Gâs. This way the TM doesnât learn the transitions from the last element of each subsequence to the first of the next. This means that the first element of any subsequence will always burst. @rhyolight shows a great example using resets on simple melodic sequences in HTM school (about 4:20 in):
The reset function:
def reset(self,):
"""
Reset the state of all cells.
This is normally used between sequences while training. All internal states
are reset to 0.
"""
if self.verbosity >= 3:
print "\n==== RESET ====="
self.lrnActiveState['t-1'].fill(0)
self.lrnActiveState['t'].fill(0)
self.lrnPredictedState['t-1'].fill(0)
self.lrnPredictedState['t'].fill(0)
self.infActiveState['t-1'].fill(0)
self.infActiveState['t'].fill(0)
self.infPredictedState['t-1'].fill(0)
self.infPredictedState['t'].fill(0)
self.cellConfidence['t-1'].fill(0)
self.cellConfidence['t'].fill(0)
# Flush the segment update queue
self.segmentUpdates = {}
self._internalStats['nInfersSinceReset'] = 0
#To be removed
self._internalStats['curPredictionScore'] = 0
#New prediction score
self._internalStats['curPredictionScore2'] = 0
self._internalStats['curFalseNegativeScore'] = 0
self._internalStats['curFalsePositiveScore'] = 0
self._internalStats['curMissing'] = 0
self._internalStats['curExtra'] = 0
# When a reset occurs, set prevSequenceSignature to the signature of the
# just-completed sequence and start accumulating histogram for the next
# sequence.
self._internalStats['prevSequenceSignature'] = None
if self.collectSequenceStats:
if self._internalStats['confHistogram'].sum() > 0:
sig = self._internalStats['confHistogram'].copy()
sig.reshape(self.numberOfCols * self.cellsPerColumn)
self._internalStats['prevSequenceSignature'] = sig
self._internalStats['confHistogram'].fill(0)
self.resetCalled = True
# Clear out input history
self._prevInfPatterns = []
self._prevLrnPatterns = []