-
Notifications
You must be signed in to change notification settings - Fork 75
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Anomaly likelihood py #457
Conversation
as it's not supported
as not supported
for print('hello Py2, old chap', file=std.err) we need from __future_ import print_function
Wow, this is a lot of code! This will take some time to review... |
learningPeriod + estimationSamples iterations. | ||
|
||
claLearningPeriod and learningPeriod are specifying the same variable, | ||
although claLearningPeriod is a deprecated name for it. |
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.
We should go ahead and remove this deprecated thing.
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.
I'd prefer not in this PR, this just pulls the code from python to this repo.
Actually I hope this would be an easy review :) It's basically 1:1 to numenta/nupic's code, which I take for reviewed. I just checked out the needed files, moved them around to correct locations, and made minimal fixes for py2/3,capnp. |
I was wondering why that one is not needed locally. |
This PR is large for need to bring up support for runing py unittests from nupic. Once it's inplace, porting a new test should be as simple as just copying the file. |
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.
Will finish code review when I have time.
def __init__(self, | ||
claLearningPeriod=None, | ||
learningPeriod=288, | ||
estimationSamples=100, |
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.
Arguments learningPeriod & estimationSamples do very similar things, can they be merged?
else: | ||
distributionParams = estimateNormal(dataValues[skipRecords:]) | ||
|
||
# HACK ALERT! The HTMPredictionModel currently does not handle constant |
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.
!
USAGE | ||
+++++ | ||
|
||
There are two ways to use the code: using the |
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.
Is this code actually complicated enough to justify two APIs?
|
||
|
||
|
||
def estimateNormal(sampleData, performLowerBoundCheck=True): |
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.
I'm pretty sure that numpy/scipy have library functions to do this, which return objects with all sorts of conveniences attached.
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.
First of all, I want to say I really appreciate you do deep code review where you understand the code and question the implementation! 👍
As for many of these comments, I agree, but I don't want to act on them in this PR which just brings 1:1 code from numenta's, which can be considered for sort of a standard.
I'm pretty sure that numpy/scipy have library functions to do this, which return objects with all sorts of conveniences attached.
as for the justified changes. Yes, the code could (should?) be improved. The result of your review should be fixed in nupic.py (and then brought back here?)
Q: do we want to deviate from Numenta's python implementation? (we said (only API-wise?) we'll keep strong compatibility.
Q: the nupic repo is definitely more alive than nupic.core, should we offer fix there? @rhyolight will you accept it?
Q: actually, do we want to (long term) have PY code here, shouldn't we just focus on API compat with numenta/nupic or community/nupic.py? (I think it's fine to merge all py code in this repo)
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.
see numenta/nupic-legacy#3876 -> upstream is abandoning active development of nupic, nupic.core, no changes there.
needed for unit-tests in CI, and probably numenta's use of the tests (supports default config files)
I am deeply suspicious of numenta's code. Their ideas are great, their implementations are in places half baked. However since we have a clear need for this code, and because i dont actually have the time to make this better, i will go easy on this code review and not demand too many changes. |
I have to agree on this one. I'll open a follow up issue to have a crack at AnomalyLikelihood code review when we have time. |
Maybe someday? I think most of the things that the support code does is already part of the standard library, which is preferable. - Logging is in the standard library. Nupic should not implement its own logger. - Debugging utilities, use the built in debugger `pdb` instead of make more tools. - Configuration, is mostly the users problem. Nupic should not be overly concerned about setting up the calling application.
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.
Breznak,
I deleted the support module since it was not really needed. The commit message has details about why I did this.
The rest of the code is okay to merge. At some point we should clean this up, but it's not critical. You can review my changes, and then go ahead and merge this if you'd like.
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.
👍 👍 removing the nupic.support
@@ -35,7 +35,7 @@ | |||
import unittest | |||
|
|||
from nupic.algorithms import anomaly_likelihood as an | |||
from nupic.support.unittesthelpers.testcasebase import TestCaseBase | |||
from unittest import TestCase as TestCaseBase |
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.
I like this change! Makes the diff much smaller, and I agree we should limit the scope of things we care about.
Thanks 👍
AnomalyLikelihood
available from pure-python code (/py/) + tests passingutils.py (MovingAverage)
+ testsnupic.support
for unit-testsFixes #455 , related #124 #205