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?

Apr 7, 2022 in Machine Learning by Nandini
• 5,480 points
1,325 views

1 answer to this question.

0 votes

You could try something like this:

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

Ignite Your Future with Machine Learning Training

answered Apr 11, 2022 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
11,789 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,460 points
2,637 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 4,347 views
0 votes
1 answer
0 votes
1 answer

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

You could try something like this. my_nn = ...READ MORE

answered Mar 8, 2022 in Machine Learning by Dev
• 6,000 points
1,044 views
webinar REGISTER FOR FREE WEBINAR X
REGISTER NOW
webinar_success Thank you for registering Join Edureka Meetup community for 100+ Free Webinars each month JOIN MEETUP GROUP