Issue
Using MLPClassifier to solve a Multiclass problem (classes represented as integer values from 0 to 11). Does it internally convert the classes to one-hot-encode format and creates a network with 12 outputs? Or it creates a network with a single output node?
Solution
MLPClassifier
inherits from BaseMultilayerPerceptron
, which uses sklearn.preprocessing.LabelBinarizer
.
This is what LabelBinarizer
's docu says:
Binarize labels in a one-vs-all fashion.
Based on this, MLPClassifier
does internally convert the classes to a one-hot encoded format for the training process, and thus, for a multiclass problem, it creates a neural network with an output layer consisting of as many nodes as there are classes—in this case, 12 nodes for classes 0 to 11. Each output node corresponds to the presence of a class. However, it's important to note that MLPClassifier
uses these nodes in conjunction with a softmax activation function to output a probability distribution for the multi-class labels, rather than training separate binary classifiers for each class.
Answered By - DataJanitor
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.