Comments for AI Geek Programmer https://aigeekprogrammer.com/ Machine learning / computer vision engineer and manager Sun, 15 Aug 2021 17:42:12 +0000 hourly 1 https://wordpress.org/?v=6.1.1 Comment on Logistic regression and Keras for classification by AI Geek Programmer https://aigeekprogrammer.com/binary-classification-using-logistic-regression-and-keras/#comment-92 Sun, 15 Aug 2021 17:42:12 +0000 https://aigeekprogrammer.com/?p=7839#comment-92 In reply to Anonymous.

Hi, you probably use a newer version of Keras. From 2.2.4 import was changed for layers. Try tensorflow.keras.layers instead. Also: https://stackoverflow.com/questions/55324762/the-added-layer-must-be-an-instance-of-class-layer-found-tensorflow-python-ke

]]>
Comment on Logistic regression and Keras for classification by Anonymous https://aigeekprogrammer.com/binary-classification-using-logistic-regression-and-keras/#comment-91 Sun, 15 Aug 2021 14:35:10 +0000 https://aigeekprogrammer.com/?p=7839#comment-91 model = keras.Sequential({
keras.layers.Dense(1, input_shape=(784,), activation=’sigmoid’)
})
doesn’t work. gives several errors. like “The added layer must be an instance of class Layer.” or later “TypeError: add() missing 1 required positional argument: ‘layer'” and after that “‘NoneType’ object has no attribute ‘compile'”

]]>
Comment on Logistic regression and Keras for classification by Anonymous https://aigeekprogrammer.com/binary-classification-using-logistic-regression-and-keras/#comment-55 Wed, 28 Oct 2020 13:25:39 +0000 https://aigeekprogrammer.com/?p=7839#comment-55 why I choose the 1s and 2s or other digits, the accuracy will be like 0.17 and some are much more lower.

]]>
Comment on Logistic regression and Keras for classification by AI Geek Programmer https://aigeekprogrammer.com/binary-classification-using-logistic-regression-and-keras/#comment-4 Wed, 01 Jul 2020 18:13:12 +0000 https://aigeekprogrammer.com/?p=7839#comment-4 In reply to Anonymous.

First of all, you’re right that in the MNIST dataset we have digits from 0 to 9. However, in this exercise I wanted to perform binary classification, which means choosing between two classes. I chose 0s and 1s and eliminated other digits from the MNIST dataset.
Then, as for this line of code: keras.layers.Dense(1, input_shape=(784,), activation=’sigmoid’). I used Dense layer to get input vector of 784 data points and squeeze it to a range (0;1) using sigmoid and then output one value only. The first parameter of Dense method is described as “dimensionality of the output space” – in our case is a single number, hence we have “Dense(1, …)”.
You may also wonder why we use Dense layer for logistic regression. Well, while performing a logistic regression we want to first calculate the polynomial value of: x1 * w1 + x2 * w2 + … + x784 * w784 and this is exactly what Dense layer does.

]]>
Comment on Logistic regression and Keras for classification by Anonymous https://aigeekprogrammer.com/binary-classification-using-logistic-regression-and-keras/#comment-1 Mon, 01 Jun 2020 03:55:21 +0000 https://aigeekprogrammer.com/?p=7839#comment-1 Why the dense unit is 1? Shouldn’t it be 10 since we have 0-9 output digits?

]]>