-
Notifications
You must be signed in to change notification settings - Fork 4.3k
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
[AnomalyDetection] Add base classes and specifiable protocol #33845
base: master
Are you sure you want to change the base?
Conversation
r: @damccorm |
Stopping reviewer notifications for this pull request: review requested by someone other than the bot, ceding control. If you'd like to restart, comment |
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #33845 +/- ##
============================================
+ Coverage 59.08% 59.12% +0.03%
Complexity 3237 3237
============================================
Files 1156 1158 +2
Lines 176907 177113 +206
Branches 3391 3391
============================================
+ Hits 104532 104715 +183
- Misses 69008 69031 +23
Partials 3367 3367
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. |
bc6fa8f
to
acc6448
Compare
acc6448
to
4023c80
Compare
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.
Mostly LGTM, but had some questions. In general, docs would be really helpful here. I really like the concept
key=None, | ||
error_if_exists=True, | ||
on_demand_init=True, | ||
just_in_time_init=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 having a hard time following this - I think some of it is just indented python is hard to read, but I think it would be very helpful to have a walkthrough here of what this function is doing
I think I've mostly figured out how it is working, but it would help to have this background.
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 added some more comments. PTAL.
def run_init(self): | ||
original_init(self, **self._init_params) | ||
|
||
def new_getattr(self, name): |
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.
Maybe I'm not understanding this well, but could we just do something a bit simpler like:
def new_getattr(self, name):
if not self._initialized:
original_init()
self._initialized = True
return orig_getattr(self, name)
if we keep track of the original getattr function in orig_getattr
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.
The general idea is like this, but there are some edge cases we need to avoid. Otherwise, we will end up with an infinite loop. I refactor the code a bit to improve its readability. PTAL.
|
||
from typing_extensions import Self | ||
|
||
ACCEPTED_SPECIFIABLE_SUBSPACES = [ |
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.
Why do we start with these registered? Would it be cleaner to just register them on import?
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.
These are the accepted subspaces for the known specifiable, but not the actual specifiable classes. The purpose is to avoid using a global space for every specifiable classes.
I think they should be predefined before the true registration takes place. WDYT?
371d465
to
0b3a7ca
Compare
0b3a7ca
to
e4a32c2
Compare
@damccorm, I've added docstrings and refactored some code for readability. PTAL. Thanks! |
This is the first part of the code push for anomaly detection transform.