-
Notifications
You must be signed in to change notification settings - Fork 19.4k
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
Add to_ordinal
feature for ordinal regression/classification
#17419
Conversation
Thanks for your pull request! It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA). View this failed invocation of the CLA check for more information. For the most up to date status, view the checks section at the bottom of the pull request. |
line to long
@gbaned please approve the workflows. |
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 for the Pull Request!
Just a small change:
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 for the PR!
Please also update this file after the PR is merged, by adding to the tf.keras
section for new features.
@awsaf49 Seems the |
`assertTrue` fails for label shape `(3, 2, 1)` as ordinal->label creates shape `(3, 2)` hence the mismatch. Using `reshape(label)` with `ordinal` before comparison is a fix.
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.
LGTM
@awsaf49
|
@haifeng-jin my bad, forgot to put |
ValueError: The truth value of an array with more than one element is ambiguous. Use a.any() or a.all()
This PR is stuck due to
@gbaned could you please approve? |
I think this PR looks fine but is on hold for quite some time, It would be really helpful if someone could merge the PR. |
@awsaf49 I am doing some required Google internal changes since this PR touches the APIs. Sorry for the delay. |
@haifeng-jin thanks for your effort. I wasn't aware of these internal procedures. Looking forward to hearing from you... |
@awsaf49 There are more internal review comments that I need to address. So please expect some delays. Thanks. |
@haifeng-jin Thank you for letting me know. In the meantime, I would like to propose creating an example on Ordinal Regression, something like "Age Estimation with Ordinal Regression" on the keras.io/examples page. As of now, there is no mention of Ordinal Regression on the call for contribution page. May I proceed with creating a pull request for this example? cc: @fchollet |
For recently added `tf.keras.utils.to_ordinal` utility [here](keras-team/keras#17419)
@haifeng-jin as the PR has been merged, I've created a PR on TensorFlow to update the |
Imported from GitHub PR #17485 This PR will resolve two issues and add an explanation for `to_ordinal` utility, recently merged in #17419. It will, 1. Resolve a grammatical error in `Return` 2. Resolve abnormality in api_docs due to a new line in the docstring. [api_docs link](https://www.tensorflow.org/api_docs/python/tf/keras/utils/to_ordinal) <img src="https://user-images.githubusercontent.com/36858976/215018234-4e7b424d-c6df-4baf-89ba-cc561314578f.png" width=300> 3. Add a little explanation for `to_ordinal` cc: @haifeng-jin Copybara import of the project: -- db1ec98 by Awsaf <awsaf49@gmail.com>: fix grammar -- bc8929c by Awsaf <awsaf49@gmail.com>: fix for newline in api_docs] new line creates abnormality in api_docs in https://www.tensorflow.org/api_docs/python/tf/keras/utils/to_ordinal -- 3ab1d2e by Awsaf <awsaf49@gmail.com>: add little explanation Merging this change closes #17485 FUTURE_COPYBARA_INTEGRATE_REVIEW=#17485 from awsaf49:to_ordinal 3ab1d2e PiperOrigin-RevId: 505141352
This PR adds the feature
to_ordinal
for ordinal regression/classification mentioned in issue keras-team/tf-keras#321