Spaces:
Running
Running
shlomihod commited on
Commit ·
3185f7c
1
Parent(s): 1514644
Use stable version combination: imbalanced-learn 0.11.0 + scikit-learn 1.3.2
Browse files- app.py +4 -10
- requirements.txt +2 -2
app.py
CHANGED
|
@@ -463,16 +463,10 @@ def prepare_datasets(
|
|
| 463 |
df = df[[label_column] + input_columns]
|
| 464 |
|
| 465 |
if train_size is not None and test_size is not None:
|
| 466 |
-
|
| 467 |
-
|
| 468 |
-
|
| 469 |
-
|
| 470 |
-
)
|
| 471 |
-
df, df[label_column] = undersample.fit_resample(df, df[label_column])
|
| 472 |
-
except Exception as e:
|
| 473 |
-
# Log the error and continue without undersampling
|
| 474 |
-
LOGGER.warning(f"Undersampling failed: {e}. Proceeding without undersampling.")
|
| 475 |
-
|
| 476 |
sss = StratifiedShuffleSplit(
|
| 477 |
n_splits=1,
|
| 478 |
train_size=train_size,
|
|
|
|
| 463 |
df = df[[label_column] + input_columns]
|
| 464 |
|
| 465 |
if train_size is not None and test_size is not None:
|
| 466 |
+
undersample = RandomUnderSampler(
|
| 467 |
+
sampling_strategy="not minority", random_state=dataset_split_seed
|
| 468 |
+
)
|
| 469 |
+
df, df[label_column] = undersample.fit_resample(df, df[label_column])
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 470 |
sss = StratifiedShuffleSplit(
|
| 471 |
n_splits=1,
|
| 472 |
train_size=train_size,
|
requirements.txt
CHANGED
|
@@ -4,12 +4,12 @@ cohere
|
|
| 4 |
datasets
|
| 5 |
einops
|
| 6 |
huggingface_hub[inference]
|
| 7 |
-
imbalanced-learn==0.
|
| 8 |
numpy==1.23.5
|
| 9 |
pandas
|
| 10 |
matplotlib
|
| 11 |
openai
|
| 12 |
-
scikit-learn==1.
|
| 13 |
spacy
|
| 14 |
streamlit==1.20.0
|
| 15 |
tenacity
|
|
|
|
| 4 |
datasets
|
| 5 |
einops
|
| 6 |
huggingface_hub[inference]
|
| 7 |
+
imbalanced-learn==0.11.0
|
| 8 |
numpy==1.23.5
|
| 9 |
pandas
|
| 10 |
matplotlib
|
| 11 |
openai
|
| 12 |
+
scikit-learn==1.3.2
|
| 13 |
spacy
|
| 14 |
streamlit==1.20.0
|
| 15 |
tenacity
|