Conversation
install htm.core detector from setup.py if installed, just skip, otherwise build from github
runable POC for community HTM detector from famous htm.core repo!
breznak
left a comment
There was a problem hiding this comment.
Review with planned work to do.
If you have time, @dkeeney @ctrl-z-9000-times please have a look at the TODOs, I'll be implementing some here, some to htm.core
|
|
||
| def getAdditionalHeaders(self): | ||
| """Returns a list of strings.""" | ||
| return ["raw_score"] #TODO add "prediction" |
There was a problem hiding this comment.
TODO output also predictions
| rawScore = 0.5 #FIXME result.inferences["anomalyScore"] | ||
|
|
||
| # Update min/max values and check if there is a spatial anomaly | ||
| spatialAnomaly = False #TODO make this computed in SP (and later improve) |
There was a problem hiding this comment.
- I like the idea of SpatialAnomaly being moved to SP itself SP return const random representation on empty input & SP anomaly htm.core#550
- I don't 100% like the current implementation of spatial anomalies, but that can be improved later.
| # Compute log(anomaly likelihood) | ||
| anomalyScore = self.anomalyLikelihood.anomalyProbability(inputData["value"], rawScore, inputData["timestamp"]) | ||
| logScore = self.anomalyLikelihood.computeLogLikelihood(anomalyScore) | ||
| finalScore = logScore #TODO returls logScore and not probability? Fix that in our Likelihood.cpp; #TODO TM to provide anomaly {none, raw, likelihood} |
There was a problem hiding this comment.
- we should probably return logScore in Likelihood by default review and refactor AnomalyLikelihood code (both c++, python) htm.core#469
- provide enum modes {none, raw, likelihood} to
TM.anomaly
|
|
||
| curr_dir = os.getcwd() | ||
| os.chdir(REPO_DIR) | ||
| os.system("git clone --depth=5 https://github.com/htm-community/htm.core") |
There was a problem hiding this comment.
when htm.core can be available on PyPI, skip all this mess htm-community/htm.core#19
| nargs="*", | ||
| type=str, | ||
| default=["numenta", "numentaTM", "htmjava", "null", "random", | ||
| default=["numenta", "numentaTM", "htmcore", "htmjava", "null", "random", |
params and initialization same as in hotgym.py example in htm.core repo. With one expection: RDSE resulotion changed to match one of numenta_detector, not the former value swarmed in hotgym.
implemented the model and runs nice! (Model same as hotgym.py)
as unused in this (cleaner) HTM model.
not so good, need to optimize parameters.
breznak
left a comment
There was a problem hiding this comment.
The new NAB detector with our community HTM implementation (htmcore) is ready.
@dkeeney @ctrl-z-9000-times please review, everything is working, additional task would be improving params for our model
| | [KNN CAD](https://github.com/htm-community/NAB/tree/master/nab/detectors/knncad)† | 58.0 | 43.4 | 64.8 | | | | ||
| | [Relative Entropy](http://www.hpl.hp.com/techreports/2011/HPL-2011-8.pdf) | 54.6 | 47.6 | 58.8 | | | | ||
| | [Random Cut Forest](http://proceedings.mlr.press/v48/guha16.pdf) **** | 51.7 | 38.4 | 59.7 | | | | ||
| | [htm.core](https://github.com/htm-community/htm.core/) | 50.83 | 49.95 | 52.64 | `htmcore` | | |
There was a problem hiding this comment.
first shot results are not really good, we have to pump it up guys! 📌
There was a problem hiding this comment.
I've pushed commit that uses numenta_detector's params, currently running benchmarks
| SPATIAL_TOLERANCE = 0.05 | ||
|
|
||
| ## parameters to initialize our HTM model (encoder, SP, TM, AnomalyLikelihood) | ||
| # TODO optional: optimize these params, either manually and/or swarming. But first keep comparable to numenta_detector |
There was a problem hiding this comment.
TODO optimize params taken from hotgym
There was a problem hiding this comment.
The parameters for the original NAB are written down, somewhere in the original nupic.
There was a problem hiding this comment.
parameters for the original NAB
yes, I've created params from the orig nab numenta_detector. But we do not score as well (localAreaDensity instead of removed numActiveColsPerInhArea, more importantly removed BacktrackingTM, which had best results on NAB,...)
There was a problem hiding this comment.
Ok, ive started looking at and playing with these parameters, and wow it runs fast! I am optimizing a few of the parameters by hand and will push the results soon. Then i can see about hooking this up to the optimization framework
There was a problem hiding this comment.
I am optimizing a few of the parameters by hand and will push the results soon
please do. I've been trying to do some hand-optimizations, but I was still getting much worse results than Numenta's HTM :/
There was a problem hiding this comment.
Here is the new current score. It's just a few points less than the target.
- "reward_low_FN_rate": 66.1922106936328,
- "reward_low_FP_rate": 58.7930712907694,
- "standard": 63.081419488725054
There was a problem hiding this comment.
new current score. It's just a few points less than the target.
that does look good! 👍 Let's merge this so we can go from there..
for information only, not used
use the same params as much as possible to have comparison, print statistics
FIXME for anomaly computation is not needed, as TM provides TM.anomaly already!
Adds
htm.corehttps://github.com/htm-community/htm.core as a detectorCurrently WIP,
please review after #2 is merged as this builds atop that.Features
native htm.core improvements
python3
installs htm.core seamlessly
finish the
HtmcoreDetectordetectorrun on all data and commit results
TODO optional in separate PRs
For numenta#337 where it should be then submitted as well
Fixes htm-community/htm.core#205