Skip to content

Can smote_variants deal with 3_class data? #82

@autogluonisgod

Description

@autogluonisgod

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 ?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions