-
Notifications
You must be signed in to change notification settings - Fork 5.7k
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
feat: Implement LabelEncoder methods and add fit method test #28702
Conversation
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.
PR Compliance Checks
Thank you for your Pull Request! We have run several checks on this pull request in order to make sure it's suitable for merging into this project. The results are listed in the following section.
Issue Reference
In order to be considered for merging, the pull request description must refer to a specific issue number. This is described in our contributing guide and our PR template.
This check is looking for a phrase similar to: "Fixes #XYZ" or "Resolves #XYZ" where XYZ is the issue number that this PR is meant to address.
Hi @Ishticode , Could you please review the “Enhancements to LabelEncoder” PR? Your feedback would be invaluable. Screenshots of the tests and manual verifications are attached for reference Thanks |
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.
Thank you very much @muzakkirhussain011
We should not really be adding docstring to the frontends as the actual native frameworks explain the function or classes exactly. You can see this as a NOTE on our frontends guide at https://unify.ai/docs/ivy/overview/deep_dive/ivy_frontends.html. Let me know if something is unclear. Thank you very much
Hi @Ishticode , I acknowledge the frontend documentation standards as highlighted in the guide and will ensure compliance moving forward. Thank you for bringing this to my attention. I’ve removed the docstrings from the frontends as per the guide to maintain consistency with the native frameworks’ documentation. Best regards |
Hi @Ishticode , I'm following up on this PR as it has been 5 days since it was opened. Your review would be very helpful for us to proceed. Looking forward to your feedback. Best Regards |
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.
Hi. Can we test for newly implemented functions which remove the NotImplementedError. Thansk :)
Hi @Ishticode , Manual Verification: Manual testing of the transform and fit_transform methods with direct input has been successful, indicating that the methods function correctly when the encoder is properly fitted. I have attached Screenshot of the fit method test passing. Screenshot of the transform method test failing. Screenshot of the manual test for transform and fit_transform methods passing. In the PR description. |
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.
Sure, in that case we should still add the test but make a fit call before calling the actual test call. :)
Hi @Ishticode , Test for transform method:
|
Hi @Ishticode, |
Hi @Ishticode , |
Hi @Sam-Armstrong , |
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.
Apologies for the slow review on this! The tests you wrote are all failing, please can you fix them? You can follow the precedent of the first test in this file.
pytest ivy_tests/test_ivy/test_frontends/test_sklearn/test_preprocessing/test_label.py
encoder = LabelEncoder() | ||
encoder.fit(x[0]) |
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.
You shouldn't be initializing a LabelEncoder here; see the first test in this file as an example of how to write the test.
Hi @Sam-Armstrong , Manual Verification: Manual testing of the transform and fit_transform methods with direct input has been successful, indicating that the methods function correctly when the encoder is properly fitted. I have attached Screenshot of the fit method test passing. Screenshot of the transform method test failing. Screenshot of the manual test for transform and fit_transform methods passing. In the PR description. |
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.
Ok sure, that's fine. Considering the sklearn frontend is low-priority right now, I think we don't have to worry about modifying the testing infrastructure to get these working. Please could you leave todo notes on the tests as I've indicated below, then we can get this merged. Thanks!
ivy_tests/test_ivy/test_frontends/test_sklearn/test_preprocessing/test_label.py
Outdated
Show resolved
Hide resolved
…ing/test_label.py Co-authored-by: Sam Armstrong <[email protected]>
Hi @Sam-Armstrong , |
Hi @Sam-Armstrong , |
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.
Thanks @muzakkirhussain011, will merge now 😄
PR: Enhancements to LabelEncoder
Overview
This PR introduces critical enhancements to the
LabelEncoder
class, enabling the conversion of string labels into numerical identifiers. Due to the limitation ofivy.array
not accepting string elements, we've utilized the list data type for encoding operations. This ensures compatibility across all backends and maintains the core functionality of theLabelEncoder
.Details
LabelEncoder
now uses lists to process and encode string objects into numerical identifiers. This change is due toivy.array
's inability to handle string types, which are essential for theLabelEncoder
's operation.LabelEncoder
remains functional across various computational backends, as lists are universally supported.fit
method are consistently passing, confirming the method's reliability in identifying and ordering unique labels.transform
,fit_transform
, andinverse_transform
methods are failing because these methods require theLabelEncoder
to be fitted with data first. This prerequisite is not currently met within the automated testing setup, leading to failures.transform
andfit_transform
methods with direct input has been successful, indicating that the methods function correctly when the encoder is properly fitted.Attachments
fit
method test passing.transform
method test failing.transform
andfit_transform
methods passing.This PR is a step forward in enhancing our machine learning toolkit's capabilities, ensuring more robust and versatile encoding functionalities and seamless backend integration
Closes #
Checklist