sklearn MLPClassifier - zero hidden layers i e logistic regression

0 votes

We know that a feed forward neural network with 0 hidden layers (i.e. just an input layer and an output layer) with a sigmoid activation function at the end should be equivalent to logistic regression.

I wish to prove this to be true, but I need to fit 0 hidden layers using the sklearn MLPClassifier module specifically.

My attempt:

my_nn = MLPClassifier(hidden_layer_sizes=(0), alpha = 0, 
                        max_iter=10000)

but this results in an error message:

hidden_layer_sizes must be > 0, got [0, 0].

Is there any way to achieve this using this specific module?

Mar 4 in Machine Learning by Nandini
• 5,480 points
80 views

1 answer to this question.

0 votes
You could try something like this.

my_nn = MLPClassifier(hidden_layer_sizes=(), alpha = 0, max_iter=10000)

This might solve the error you are getting.
answered Mar 8 by Dev
• 6,000 points

Related Questions In Machine Learning

0 votes
1 answer
0 votes
1 answer

Different types of Logistic Regression

There are three main types of logistic ...READ MORE

answered May 13, 2019 in Machine Learning by Nikhil
10,303 views
0 votes
1 answer
0 votes
1 answer

Can we change the sigmoid with tanh in Logistic regression transforms??

Hi@Deepanshu, Yes, you can use tanh instead of ...READ MORE

answered May 12, 2020 in Machine Learning by MD
• 95,340 points
936 views
0 votes
2 answers
+1 vote
2 answers

how can i count the items in a list?

Syntax :            list. count(value) Code: colors = ['red', 'green', ...READ MORE

answered Jul 7, 2019 in Python by Neha
• 330 points

edited Jul 8, 2019 by Kalgi 2,756 views
0 votes
1 answer
0 votes
1 answer

sklearn MLPClassifier - zero hidden layers (i.e. logistic regression)

You could try something like this: nn = ...READ MORE

answered Apr 11 in Machine Learning by Dev
• 6,000 points
30 views
webinar REGISTER FOR FREE WEBINAR X
Send OTP
REGISTER NOW
webinar_success Thank you for registering Join Edureka Meetup community for 100+ Free Webinars each month JOIN MEETUP GROUP