Binary Classification vs. Multi Class Classification

五迷三道 提交于 2019-12-11 09:23:09

问题


I have a machine learning classification problem with 3 possible classes (Class A, Class b and Class C). Please let me know which one would be better approach? - Split the problem into 2 binary classification: First Identify whether it is Class A or Class 'Not A'. Then if it is Class 'Not A', then another binary classification to classify into Class B or Class C


回答1:


Binary classification may at the end use sigmoid function (goes smooth from 0 to 1). This is how we will know how to classify two values.

from keras.layers import Dense
model.add(Dense(1, input_dim=8, kernel_initializer='uniform', activation='relu'))
model.add(Dense(1, kernel_initializer='uniform', activation='relu'))
model.add(Dense(1, kernel_initializer='uniform', activation='sigmoid'))

For multi class classification you would typically use softmax at the very last layer, and the number of neurons in the next example will be 10, means 10 choices.

from keras.layers import Dropout
model.add(Dense(512,activation='relu',input_shape=(784,)))
model.add(Dropout(0.2))
model.add(Dense(10, activation='softmax'))

However, you can also use softmax with 2 neurons in the last layer for the binary classification as well:

model.add(Dense(2, activation='softmax'))

Hope this provides little intuition on classifiers.




回答2:


What you describe is one method used for Multi Class Classification.
It is called One vs. All / One vs. Rest.

The best way is to chose a good classifier framework with both options and choose the better one using Cross Validation process.



来源:https://stackoverflow.com/questions/49916294/binary-classification-vs-multi-class-classification

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!