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
Closed
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions keras/utils/dataset_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,16 +33,16 @@
def split_dataset(
dataset, left_size=None, right_size=None, shuffle=False, seed=None
):
"""Split a dataset into a left half and a right half (e.g. train / test).
"""Split a dataset into a left part and a right part (e.g. train / test).
SuryanarayanaY marked this conversation as resolved.
Show resolved Hide resolved

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

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 to `right_size`. Defaults to `None`.
right_size: If float (in the range `[0, 1]`), it signifies
right_size: If float (in the range `(0, 1)`), it signifies
SuryanarayanaY marked this conversation as resolved.
Show resolved Hide resolved
the fraction of the data to pack in the right dataset. If integer, it
signifies the number of samples to pack in the right dataset. If
`None`, it uses the complement to `left_size`. Defaults to `None`.
Expand Down Expand Up @@ -398,7 +398,7 @@ def _rescale_dataset_split_sizes(left_size, right_size, total_length):
raise ValueError(
"`left_size` should be either a positive integer "
f"smaller than {total_length}, or a float "
"within the range `[0, 1]`. Received: left_size="
"within the range '[0, 1] (excluding the boundary values 0 and 1)'. Received: left_size="
f"{left_size}"
)

Expand All @@ -413,7 +413,7 @@ def _rescale_dataset_split_sizes(left_size, right_size, total_length):
raise ValueError(
"`right_size` should be either a positive integer "
f"and smaller than {total_length} or a float "
"within the range `[0, 1]`. Received: right_size="
"within the range '[0, 1] (excluding the boundary values 0 and 1)'. Received: right_size="
f"{right_size}"
)

Expand Down