add MAD outlier rule to find outliers - #499
Conversation
Small refactoring to get rid of repetitive calculations, addition of MAD (median absolute deviation) rule
solegalli
left a comment
There was a problem hiding this comment.
Hi @glevv
Really, really good implementation of the outlier handlers. Thank you very much for taking the time to re-write almost the entire logic. Very elegant. I appreciate it a lot!
I also learned a lot.
There are a couple of tests failing.
Stylechecks is complaining about numpy imported but being unused, see below:
stylechecks run-test: commands[0] | flake8 feature_engine tests
feature_engine/outliers/base_outlier.py:3:1: F401 'numpy as np' imported but unused
feature_engine/outliers/base_outlier.py:179:89: E501 line too long (89 > 88 characters)
feature_engine/outliers/base_outlier.py:195:89: E501 line too long (91 > 88 characters)
feature_engine/outliers/base_outlier.py:218:89: E501 line too long (90 > 88 characters)
feature_engine/outliers/trimmer.py:4:1: F401 'numpy as np' imported but unused
tests/test_outliers/test_outlier_trimmer.py:4:1: F401 'numpy as np' imported but unused
The Python tests are failing because of the error to catch when scale
This test is also failing:
I believe they should all be small fixes. Would you be able to have a look at it?
I think once the tests pass this is ready to go!
Thank you very much!
|
Fixes implemented |
|
Hey @glevv This implementation is great. Thank you so much! Code-wise, this is good to go. If I may ask a little bit more from you, could you please add the Mad rule to the user guide? In this 2 files: https://github.com/feature-engine/feature_engine/blob/main/docs/user_guide/outliers/Winsorizer.rst Thank you! |
PR for #496
Added MAD outlier rule
Refactored base code and tests
Extend outlier detection functionality of OutlierTrimmer and Winsorizer.