Skip to content
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: Add Hamming loss function to sklearn metrics in Ivy frontends #28616

Merged
merged 2 commits into from
Mar 21, 2024

Conversation

muzakkirhussain011
Copy link
Contributor

@muzakkirhussain011 muzakkirhussain011 commented Mar 16, 2024

Pull Request - Add Hamming Loss Function for Binary Classification

Changes Proposed:

This PR introduces the Hamming loss function, a standard metric for binary classification performance evaluation, to the sklearn metrics module of Ivy frontends.

Implementation Details:

  • The hamming_loss function is implemented to compute the proportion of incorrect predictions.
  • It supports both weighted and unweighted calculations.
  • The implementation is designed to be compatible with binary classification tasks.

Benefits:

  • The addition of the Hamming loss provides Ivy users with a crucial metric for binary classification model evaluation.
  • It enhances the Ivy metrics module, offering a comprehensive suite of performance evaluation tools.

Usage:

The hamming_loss function can be utilized by passing the true and predicted binary labels, with an optional sample_weight parameter for a weighted assessment.

Example:

from ivy.functional.frontends.sklearn.metrics import hamming_loss

y_true = [1, 0, 1, 0]
y_pred = [0, 1, 1, 0]
print(hamming_loss(y_true, y_pred))

Checklist

  • Did you add a function?
  • Did you add the tests?
  • Did you run your tests and are your tests passing?
  • Did pre-commit not fail on any check?
  • Did you follow the steps we provided?

Copy link
Contributor

@github-actions github-actions bot left a 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.

@muzakkirhussain011
Copy link
Contributor Author

Hi @Ishticode ,

I hope this message finds you well.

I've submitted a PR for the addition of the Hamming loss function to the sklearn metrics in Ivy frontends, which is now ready for your review. This PR has successfully passed all backend tests as well as the CI tests, ensuring the robustness and reliability of the implementation. I've attached a screenshot of the passed backend tests for your reference.

Given your expertise and previous experience reviewing and merging the PR for the F1 score, I believe your insights would be invaluable for this PR as well.

Your timely review and feedback would be greatly appreciated. Please let me know if there are any additional details or changes required.

Thank you for your attention and support.

Best regards,

hamming_loss

@muzakkirhussain011
Copy link
Contributor Author

Hi @Ishticode ,

I’ve submitted a PR for the Hamming loss function in Ivy frontends, which has passed all tests and is ready for review. Your expertise, especially considering your experience with the F1 score PR, would be greatly valuable. I look forward to your timely feedback.

Best Regards

Copy link
Contributor

@Ishticode Ishticode left a 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 work done for Hamming Loss @muzakkirhussain011
Looks good. Will merge today. Thank you very much for the contribution :)

@Ishticode Ishticode merged commit d170439 into ivy-llc:main Mar 21, 2024
135 of 141 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants