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

Updating split range from [0, 1] to (0, 1) in keras.utils.split_dataset #18028

Closed
wants to merge 7 commits into from

Conversation

SuryanarayanaY
Copy link
Contributor

In the tf.keras.utils.split_dataset API , that can be used to split a dataset into left and right parts, the documentation states it splits dataset into left half and right half where the parts need not be equal parts.The split can be anything in range (0, 1). Hence I thought to replace the word half with part.

Also in the Args section of documentation and exception handling in source code the range for split used as [0, 1] which is not a correct notation as 0 and 1 are actually not inclusive in the range and raises exception if we use either 0 or 1 for either of left_size or right_size for splitting the dataset. Hence I have replaced [0, 1] with (0, 1) to make it more intuitive. Thanks.

…taset to make it more intuitive

In the split_dataset API which is used to split a dataset into left and right parts. But documentation states it splits dataset into left half and right half where the parts need not be equal parts.The split can be anything in range(0, 1).Hence I think to replace the word half with part.
Also in the argument section and exception section the range for split used as [0, 1] which is not a correct notation as 0 and 1 are actually excluded in the range and raises exception if we use either 0 or 1 for either of left_size or right_size for splitting the dataset. Hence i have replaced [0, 1] with (0,1) to make it more intuitive. Thanks.
@gbaned gbaned requested a review from fchollet April 21, 2023 16:17
@google-ml-butler google-ml-butler bot added the keras-team-review-pending Pending review by a Keras team member. label Apr 21, 2023

Args:
dataset: A `tf.data.Dataset` object, or a list/tuple of arrays with the
same length.
left_size: If float (in the range `[0, 1]`), it signifies
left_size: If float (in the range `(0, 1)`), it signifies
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please keep the brackets for the range -- it mimics math notation for ranges.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am not getting your question. Actually the API raises error if split includes either 0 or 1. As per maths notation
[0, 1] means both 0 and 1 are included in the range. But here these are not valid values for argument. Hence I am proposing the range as (0, 1) . Am I understand it correctly ?

keras/utils/dataset_utils.py Show resolved Hide resolved
@fchollet fchollet removed the keras-team-review-pending Pending review by a Keras team member. label Apr 21, 2023
@gbaned
Copy link
Collaborator

gbaned commented May 4, 2023

Hi @SuryanarayanaY Can you please check @fchollet's comments ? Thank you!

@github-actions
Copy link

This PR is stale because it has been open for 14 days with no activity. It will be closed if no further activity occurs. Thank you.

@github-actions github-actions bot added the stale label May 19, 2023
@gbaned
Copy link
Collaborator

gbaned commented Jun 1, 2023

Hi @SuryanarayanaY Any update on this PR? Please. Thank you!

@github-actions github-actions bot removed the stale label Jun 2, 2023
@gbaned
Copy link
Collaborator

gbaned commented Jun 8, 2023

Hi @SuryanarayanaY Any update on this PR? Please. Thank you!

@SuryanarayanaY
Copy link
Contributor Author

Added my comments above

@gbaned gbaned added the keras-team-review-pending Pending review by a Keras team member. label Jun 21, 2023
@gbaned
Copy link
Collaborator

gbaned commented Jun 21, 2023

Hi @fchollet Can you please assist on above comments from @SuryanarayanaY. Thank you!

@fchollet
Copy link
Member

The notation (0, 1) is ambiguous and not standard. Instead, you can just say "[0, 1] (excluding the boundary values 0 and 1)" which is clearer.

Updated the range notation as requested
@sachinprasadhs sachinprasadhs removed the keras-team-review-pending Pending review by a Keras team member. label Jun 29, 2023

Args:
dataset: A `tf.data.Dataset` object, or a list/tuple of arrays with the
same length.
left_size: If float (in the range `[0, 1]`), it signifies
left_size: If float (in the range "[0, 1] (excluding the boundary values 0 and 1)"), it signifies
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  • use backticks for the [] range
  • remove " quotes
  • make sure the lines are under 80 chars

@gbaned
Copy link
Collaborator

gbaned commented Jul 17, 2023

Hi @SuryanarayanaY Can you please check @fchollet's comments and keep us posted ? Thank you!

Don e the formatting changes as requested
@SuryanarayanaY
Copy link
Contributor Author

Apologies for the delay. Done the changes as requested. Thanks

@sampathweb sampathweb added stat:awaiting keras-eng Awaiting response from Keras engineer and removed keras-team-review-pending Pending review by a Keras team member. labels Aug 10, 2023
keras/utils/dataset_utils.py Outdated Show resolved Hide resolved
left_size: If float (in the range `[0, 1]` (excluding the
boundary values 0 and 1)), it signifies the fraction of the data to
pack in the left dataset.If integer, it signifies the number of
samples to pack in the left dataset.If `None`, it uses the complement
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same as above

keras/utils/dataset_utils.py Outdated Show resolved Hide resolved
keras/utils/dataset_utils.py Outdated Show resolved Hide resolved
@gbaned
Copy link
Collaborator

gbaned commented Aug 22, 2023

Hi @SuryanarayanaY Can you please check @grasskin's comments and keep us posted ? Thank you!

Done the formatting as suggested. Thanks
@SuryanarayanaY
Copy link
Contributor Author

Apologies for the delay.Done the suggested changes.

Removed trailing whitespaces as suggested by lint.
Copy link
Member

@grasskin grasskin left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@google-ml-butler google-ml-butler bot added kokoro:force-run ready to pull Ready to be merged into the codebase labels Aug 25, 2023
@gbaned gbaned added ready to pull Ready to be merged into the codebase and removed ready to pull Ready to be merged into the codebase awaiting review labels Sep 1, 2023
@gbaned gbaned added ready to pull Ready to be merged into the codebase and removed ready to pull Ready to be merged into the codebase labels Sep 12, 2023
@sachinprasadhs
Copy link
Collaborator

Hello, Thank you for submitting a pull request.

We're currently in the process of migrating the new Keras 3 code base from keras-team/keras-core to keras-team/keras.
Consequently, merging this PR is not possible at the moment. After the migration is successfully completed, feel free to reopen this PR at keras-team/keras if you believe it remains relevant to the Keras 3 code base. If instead this PR fixes a bug or security issue in legacy tf.keras, you can instead reopen the PR at keras-team/tf-keras, which hosts the TensorFlow-only, legacy version of Keras.

@google-ml-butler google-ml-butler bot removed the ready to pull Ready to be merged into the codebase label Sep 19, 2023
@SuryanarayanaY SuryanarayanaY deleted the patch-1 branch October 23, 2023 14:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
Status: Closed/Rejected
Development

Successfully merging this pull request may close these issues.

7 participants