Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Can smote_variants deal with 3_class data? #82

Open
autogluonisgod opened this issue Dec 4, 2023 · 0 comments
Open

Can smote_variants deal with 3_class data? #82

autogluonisgod opened this issue Dec 4, 2023 · 0 comments

Comments

@autogluonisgod
Copy link

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 ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant