Skip to content

Commit

Permalink
Merge pull request #114 from pylabel-project/dev
Browse files Browse the repository at this point in the history
Fix bug related to splitting #113 (comment)
  • Loading branch information
alexheat committed Jun 2, 2023
2 parents 15b4308 + 643b012 commit af610c0
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
8 changes: 6 additions & 2 deletions pylabel/splitter.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,9 @@ def GroupShuffleSplit(
test, and val) by applying the command twice.
"""
df_main = self.dataset.df
gss = sklearnGroupShuffleSplit(n_splits=1, train_size=train_pct)
gss = sklearnGroupShuffleSplit(
n_splits=1, train_size=train_pct, random_state=random_state
)
train_indexes, test_indexes = next(
gss.split(X=df_main, y=df_main[group_col], groups=df_main.index.values)
)
Expand All @@ -39,7 +41,9 @@ def GroupShuffleSplit(
df_test = df_main.loc[df_main["split"] == "test"]
df_test = df_test.reset_index()
second_split_pct = float(test_pct / (test_pct + val_pct))
gss2 = sklearnGroupShuffleSplit(n_splits=1, train_size=second_split_pct)
gss2 = sklearnGroupShuffleSplit(
n_splits=1, train_size=second_split_pct, random_state=random_state
)
test_indexes_2, val_indexes_2 = next(
gss2.split(X=df_test, y=df_test[group_col], groups=df_test.index.values)
)
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
setup(
name="pylabel",
packages=["pylabel"],
version="0.1.50",
version="0.1.51",
description="Transform, analyze, and visualize computer vision annotations.",
long_description=long_description,
long_description_content_type="text/markdown",
Expand Down

0 comments on commit af610c0

Please sign in to comment.