-
Notifications
You must be signed in to change notification settings - Fork 208
[ENH] implemented anomaly detection _fit_predict override output checks #2818
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
base: main
Are you sure you want to change the base?
Conversation
Thank you for contributing to
|
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.
two comments
- This is not being called anywhere, it should be called at the method at the top of the file BUT
- I think this would be better as part of the check output function, to avoid calling
fit
more than necessary.
est = LOF(leaf_size=10, n_neighbors=5, stride=2)
est1 = _clone_estimator(est, random_state=42)
est2 = _clone_estimator(est, random_state=42)
datatype = 'UnivariateSeries-None'
X = FULL_TEST_DATA_DICT[datatype]['train'][0]
y = FULL_TEST_DATA_DICT[datatype]['train'][1]
est1.fit(X, y)
y_pred = est1.predict(X)
y_pred
>>> array([0.99658101, 0.99658101, 0.98995043, 0.98995043, 0.99216063,
0.99216063, 0.98995043, 0.98995043, 0.99127655, 0.99127655,
0.98862432, 0.98862432, 0.98995043, 0.98995043, 0.98774024,
0.98774024, 0.98995043, 0.98995043, 0.98331986, 0.98331986])
y_pred2 = est2.fit_predict(X, y)
y_pred2
>>> array([1.03501792, 1.03501792, 1.02085908, 1.02085908, 1.01276639,
1.01276639, 1.00540476, 1.00540476, 1.00364001, 1.00364001,
0.99330039, 0.99330039, 0.98995043, 0.98995043, 0.98774024,
0.98774024, 0.98995043, 0.98995043, 0.98331986, 0.98331986])
np.allclose(y_pred, y_pred2)
>>> False |
Reference Issues/PRs
Fixes #2801
What does this implement/fix? Explain your changes.
Checks if
_fit_predict
is overridden by inheriting class and produces expected results asfit().predict()
Does your contribution introduce a new dependency? If yes, which one?
No
Any other comments?
PR checklist
For all contributions
For new estimators and functions
__maintainer__
at the top of relevant files and want to be contacted regarding its maintenance. Unmaintained files may be removed. This is for the full file, and you should not add yourself if you are just making minor changes or do not want to help maintain its contents.For developers with write access