user3567195
user3567195

Reputation: 449

Binary Classification vs. Multi Class Classification

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

Upvotes: 0

Views: 1430

Answers (2)

prosti
prosti

Reputation: 46301

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.

Upvotes: 1

Royi
Royi

Reputation: 4953

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.

Upvotes: -1

Related Questions