microsoft / hummingbird

Hummingbird compiles trained ML models into tensor computation for faster inference.
MIT License
3.34k stars 278 forks source link

Polynomial features will support degree from 0 to n #763

Closed giriprasad51 closed 7 months ago

giriprasad51 commented 7 months ago

273 fixed

import hummingbird import numpy as np from sklearn.preprocessing import PolynomialFeatures from hummingbird.ml import convert for degree in range(10): X = np.arange(15).reshape(3,5) y = np.random.randint(2, size=6)

poly = PolynomialFeatures(degree) poly_sk = poly.fit_transform(X) poly_convert = convert(poly, 'pytorch') poly_h = poly_convert.transform(X) if (poly_sk != poly_h).all() : print(degree)

codecov-commenter commented 7 months ago

Codecov Report

Attention: 4 lines in your changes are missing coverage. Please review.

Comparison is base (2a56526) 90.03% compared to head (bf08fea) 89.94%.

Files Patch % Lines
...rd/ml/operator_converters/sklearn/poly_features.py 78.94% 2 Missing and 2 partials :warning:
Additional details and impacted files ```diff @@ Coverage Diff @@ ## main #763 +/- ## ========================================== - Coverage 90.03% 89.94% -0.09% ========================================== Files 80 80 Lines 4695 4696 +1 Branches 861 864 +3 ========================================== - Hits 4227 4224 -3 - Misses 267 269 +2 - Partials 201 203 +2 ``` | [Flag](https://app.codecov.io/gh/microsoft/hummingbird/pull/763/flags?src=pr&el=flags&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=microsoft) | Coverage Δ | | |---|---|---| | [unittests](https://app.codecov.io/gh/microsoft/hummingbird/pull/763/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=microsoft) | `89.94% <78.94%> (-0.09%)` | :arrow_down: | Flags with carried forward coverage won't be shown. [Click here](https://docs.codecov.io/docs/carryforward-flags?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=microsoft#carryforward-flags-in-the-pull-request-comment) to find out more.

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

giriprasad51 commented 7 months ago

Hii @ksaur! As per your suggestion I made some changes in the code please go through it. Thanks!