Issue
I am currently working on a classification task with given class labels 0 and 1. For this I am using ScikitLearn's MLPClassifier
providing an output of either 0 or 1 for each training example. However, I can not find any documentation, what the output layer of the MLPClassifier is exactly doing (which activation function? encoding?).
Since there is an output of only one class I assume something like One-hot_encoding is used. Is this assumption correct? Is there any documentation tackling this question for the MLPClassifier
?
Solution
out_activation_
attribute would give you the type of activation used in the output layer of your MLPClassifier.
out_activation_ : string Name of the output activation function.
The activation
param just sets the hidden layer's activation function.
activation : {‘identity’, ‘logistic’, ‘tanh’, ‘relu’}, default ‘relu’ Activation function for the hidden layer.
The output layer is decided internally in this piece of code.
# Output for regression
if not is_classifier(self):
self.out_activation_ = 'identity'
# Output for multi class
elif self._label_binarizer.y_type_ == 'multiclass':
self.out_activation_ = 'softmax'
# Output for binary class and multi-label
else:
self.out_activation_ = 'logistic'
Hence, for binary classification it would be logistic
and for multi-class it would be softmax
.
To know more details about these activations, see here.
Answered By - Venkatachalam
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.