Skip to content

Commit

Permalink
Use np isclose to check split
Browse files Browse the repository at this point in the history
  • Loading branch information
agitter authored Nov 8, 2024
1 parent 0aab9f4 commit 0f9f75d
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 0f9f75d

Please sign in to comment.