Are hidden layers of sklearn's MLPClassifier() the same as Dense layer of keras/tensorflow?

Issue

Theoretically and practically, are the hidden layers of MLPclassifier (refer to hidden_layer_sizes)

mlp = MLPClassifier(hidden_layer_sizes=(4, 3, 2, 1),
                       max_iter = 100, activation = 'relu',
                       solver = 'adam', verbose = type_spec_from_value,
                       random_state = 100, learning_rate = 'invscaling',
                       early_stopping=False
                       )

the same as the Dense layers of tensorflow/keras

mlp = Sequential()
mlp.add(Dense(4))
mlp.add(Dense(3))
mlp.add(Dense(2))
mlp.add(Dense(3))

?

Solution

Yes, they are the same. In both cases, the parameters specify the number of neurons.

Answered By – lua

This Answer collected from stackoverflow, is licensed under cc by-sa 2.5 , cc by-sa 3.0 and cc by-sa 4.0

Leave a Reply

(*) Required, Your email will not be published