smote_variants icon indicating copy to clipboard operation
smote_variants copied to clipboard

Can smote_variants deal with 3_class data?

Open autogluonisgod opened this issue 7 months ago • 0 comments

I use Selection of the best oversampler to deal with 3_class data

`from sklearn.neighbors import KNeighborsClassifier from sklearn.tree import DecisionTreeClassifier import smote_variants as sv import sklearn.datasets as datasets

dataset= datasets.load_breast_cancer()

dataset= {'data': X_array, 'target': y_array, 'name': 'column_3C'}

classifiers = [('sklearn.neighbors', 'KNeighborsClassifier', {}), ('sklearn.tree', 'DecisionTreeClassifier', {})]

oversamplers = sv.queries.get_all_oversamplers(n_quickest=2)

os_params = sv.queries.generate_parameter_combinations(oversamplers, n_max_comb=2)

samp_obj and cl_obj contain the oversampling and classifier objects which give the

best performance together

samp_obj, cl_obj= sv.evaluation.model_selection(dataset=dataset, oversamplers=os_params, classifiers=classifiers, validator_params={'n_splits': 2, 'n_repeats': 1}, n_jobs= 5)

training the best techniques using the entire dataset

X_samp, y_samp= samp_obj.sample(dataset['data'], dataset['target']) cl_obj.fit(X_samp, y_samp)`

but I get some error, just like that: y_true and y_pred contain different number of classes 3, 2. Please provide the true labels explicitly through the labels argument. Classes found in y_true: [0 1 2] How should I do ?

autogluonisgod avatar Dec 04 '23 07:12 autogluonisgod