feature-engine / feature_engine

Feature engineering package with sklearn like functionality
https://feature-engine.trainindata.com/
BSD 3-Clause "New" or "Revised" License
1.79k stars 304 forks source link

Math features migrate to numpy #774

Open olikra opened 1 week ago

olikra commented 1 week ago

I migrated the transform method in math_features from pandas.agg to native numpy functions with backward compatibility. At least all existing tests on math-feature pass.

Following key-functions are implemented:

In case a defined function is not in above collection it falls back to pandas.agg. In the Examples-section I described the way to call a custom function with numpy.apply_over_axes()

I additionally changed the deprecated

dob_datrange = pd.date_range("2020-02-24", periods=4, freq="T")

to

dob_datrange = pd.date_range("2020-02-24", periods=4, freq="min")

to avoid FutureWarnings from pandas.

Please have a look. @solegalli

codecov[bot] commented 1 week ago

Codecov Report

Attention: Patch coverage is 98.50746% with 1 line in your changes missing coverage. Please review.

Project coverage is 97.53%. Comparing base (8cfab26) to head (63f26c9).

Files Patch % Lines
feature_engine/creation/math_features.py 98.41% 0 Missing and 1 partial :warning:
Additional details and impacted files ```diff @@ Coverage Diff @@ ## main #774 +/- ## ========================================== + Coverage 97.52% 97.53% +0.01% ========================================== Files 107 108 +1 Lines 4283 4341 +58 Branches 854 866 +12 ========================================== + Hits 4177 4234 +57 Misses 62 62 - Partials 44 45 +1 ```

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.