Colab, please catch the error

import pandas as pd

from imblearn.over_sampling import SMOTE

smote = SMOTE(random_state=0)

x_train_over, y_train_over = smote.fit_sample(x_train,y_train)

print('SMOTE 적용 전 학습용 피처/레이블 데이터 세트: ',x_train.shape, y_train.shape)

print('SMOTE 적용 후 학습용 피처/레이블 데이터 세트: ',x_train_over.shape, y_train_over.shape)

print(‘SMOTE 적용 후 레이블 값 분포: \n’, pd.Series(y_train_over).value_counts())


ValueError Traceback (most recent call last)
in ()
3 from imblearn.over_sampling import SMOTE
4 smote = SMOTE(random_state=0)
----> 5 x_train_over, y_train_over = smote.fit_sample(x_train,y_train)
6 print('SMOTE 적용 전 학습용 피처/레이블 데이터 세트: ',x_train.shape, y_train.shape)
7 print('SMOTE 적용 후 학습용 피처/레이블 데이터 세트: ',x_train_over.shape, y_train_over.shape)

1 frames
/usr/local/lib/python3.7/dist-packages/imblearn/utils/_validation.py in check_sampling_strategy(sampling_strategy, y, sampling_type, **kwargs)
429 if np.unique(y).size <= 1:
430 raise ValueError(“The target ‘y’ needs to have more than 1 class.”
→ 431 " Got {} class instead".format(np.unique(y).size))
432
433 if sampling_type in (‘ensemble’, ‘bypass’):

ValueError: The target ‘y’ needs to have more than 1 class. Got 1 class instead