I am using sklearn.tree.DecisionTreeClassifier to train 3-class classification problem.
The number of records in 3 classes are given below:
A: 122038
B: 43626
C: 6678
When I train the classifier model it fails to learn the class - C. Though efficiency comes out to be 65-70% but it completely ignores the class C.
Then I came to know about class_weight parameter but I am not sure how to use it in multiclass setting.
Here is my code: ( I used balanced but it gave more poor accuracy)
X_train, X_test, y_train, y_test = train_test_split(X, y, test_size=0.3, random_state=1)
clf = tree.DecisionTreeClassifier(criterion="gini", max_depth=3, random_state=1,class_weight='balanced')
clf = clf.fit(X_train,y_train)
y_pred = clf.predict(X_test)
How can I use weights with proportion to class distributions.
Secondly, is there any better way to address this Imbalance class problem to increase accuracy.?