Skip to content

Commit

Permalink
Merge pull request #441 from yahiaelgamal/main
Browse files Browse the repository at this point in the history
fix: make sampling more reproducible
  • Loading branch information
tomaarsen authored Nov 24, 2023
2 parents 49cc545 + 2997147 commit cbc01ec
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/setfit/data.py
Original file line number Diff line number Diff line change
Expand Up @@ -170,7 +170,7 @@ def sample_dataset(dataset: Dataset, label_column: str = "label", num_samples: i
df = df.groupby(label_column)

# sample num_samples, or at least as much as possible
df = df.apply(lambda x: x.sample(min(num_samples, len(x))))
df = df.apply(lambda x: x.sample(min(num_samples, len(x)), random_state=seed))
df = df.reset_index(drop=True)

all_samples = Dataset.from_pandas(df, features=dataset.features)
Expand Down

0 comments on commit cbc01ec

Please sign in to comment.