Skip to content

Commit

Permalink
Merge pull request #12 from gitter-lab/split-float
Browse files Browse the repository at this point in the history
Use np isclose to check split
  • Loading branch information
samgelman authored Nov 13, 2024
2 parents 0aab9f4 + 0f9f75d commit 434e354
Showing 1 changed file with 1 addition and 1 deletion.
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

0 comments on commit 434e354

Please sign in to comment.