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

Fix deterministic group_shuffle_split #1839

Merged
merged 14 commits into from
Feb 28, 2024
3 changes: 2 additions & 1 deletion torchgeo/datamodules/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -197,8 +197,9 @@ def group_shuffle_split(
)

generator = np.random.default_rng(seed=random_state)
ordered_list = sorted(list(group_vals))
adamjstewart marked this conversation as resolved.
Show resolved Hide resolved
train_group_vals = set(
generator.choice(list(group_vals), size=n_train_groups, replace=False)
generator.choice(ordered_list, size=n_train_groups, replace=False)
)

train_idxs = []
Expand Down