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

Use np isclose to check split #12

Merged
merged 1 commit into from
Nov 13, 2024
Merged
Changes from all 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
2 changes: 1 addition & 1 deletion code/split_dataset.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ def hash_withhold(withheld_idxs, length=6):
def train_tune_test(ds, train_size=.90, tune_size=.1, test_size=0., withhold=None,
rseed=8, out_dir=None, overwrite=False):
""" split data into train, tune, and test sets """
if train_size + tune_size + test_size != 1:
if not np.isclose(train_size + tune_size + test_size, 1):
raise ValueError("train_size, tune_size, and test_size must add up to 1. current values are "
"tr={}, tu={}, and te={}".format(train_size, tune_size, test_size))

Expand Down
Loading