-
-
Notifications
You must be signed in to change notification settings - Fork 552
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
ilof pietro #1317
ilof pietro #1317
Conversation
…into ilof-pietro
Check out this pull request on See visual diffs & provide feedback on Jupyter Notebooks. Powered by ReviewNB |
@hoanganhngo610 This is the same code of the previous pull request, that I accidentally closed (#1232 (comment)) when trying to sync my branch with the current state of river. This branch is now up to date and compatible with the latest river commit |
Thank you very much @pietro-tanure. I can see this would be an editable PR, so if possible and wherever necessary I would make the necessary changes to the code, or leave comments for further discussion. |
…core_one already assumes that one sample is taken into account at a certain time point).
@hoanganhngo610 thanks for taking care of this. Is it going well? I don't think we want to merge the notebook. What would be cool is to turn the notebook into a unit test, to show that the results are consistent with scikit-learn. Regarding the name, I would call it |
@MaxHalford Thank you so much for the comments! Moreover, regarding the name, if you prefer to go with the full name of the LOF, i.e |
Every algorithm in River is incremental, so I don't think there's a need to prepend the name with Incremental :) |
Yep got it! In this case I will change the name to |
…st (to comply with the implementation of other incremental anomaly detection algorithms)
@pietro-tanure @MaxHalford After going through the code, I am suggesting that we can have two functions, one for one instance and one for multiple instances, for the learning phase ( |
@hoanganhngo610 Thank you a lot for what you have been doing. I think that's a good idea, the original code had learn_one and learn_many functions. It had as well a score_one function with an argument window_score that represented the size of the batch to score, so it could score many points at once as well, but a score_many function might me better to make it clearer. |
Hey there! Great work to both of you. I'm aligned with |
Thank you so much @pietro-tanure @MaxHalford for the comments! In that case, I would bring back |
…ring test to take into account the newly implemented function.
… to static methods.
…file within the same module).
@pietro-tanure @MaxHalford I think I have gone extensively through this PR. Taking into account the suggestion of Max, I have removed the notebook from the PR and replaced it with a test file. However, @pietro-tanure, please rest assured that the notebook is fascinating, and I am quite sure that I will be able to demonstrate it elsewhere (will update you on that later). |
Thanks @hoanganhngo610! I can take over from here and take care of the tests. Congrats to both of you on the good work :) |
Thank you very much @hoanganhngo610 for all the work, I'm very happy with the result of the code. Thank you @MaxHalford as well for your readiness to help. |
@hoanganhngo610 @pietro-tanure FYI the tests were failing because LOF needs to be warm-started to function correctly. Indeed if you run it with a simple progressive validation for loop it breaks. from river import anomaly, utils, datasets
model = anomaly.LocalOutlierFactor()
dataset = datasets.Phishing()
for x, y in dataset:
model.learn_one(x)
model.score_one(x) This isn't ideal, so for now I've disabled the tests. I'd love to see this fixed at some point. |
@MaxHalford I also noticed this when testing the algorithm locally, and that's also why I designed the test file so that it learns a certain amount of data points before actually doing the scoring. I know that this would not be ideal, but given the nature of the algorithm, I believe it is somewhat acceptable. However, we can try to fix this in the future. |
…into ilof-pietro