November 2017
Intermediate to advanced
1035 pages
11h 31m
English
As was discussed in Chapter 2, Working with Linear Models, Stochastic Gradient Descent is a fundamental technique to fit a model for regression. There are natural connections between the two techniques, as the name so obviously implies.
In regression, we minimized a cost function that penalized for bad choices on a continuous scale, but for classification, we'll minimize a cost function that penalizes for two (or more) cases.
First, let's create some very basic data:
>>> from sklearn import datasets >>> X, y = datasets.make_classification()
Next, we'll create a SGDClassifier instance:
>>> from sklearn import linear_model >>> sgd_clf = linear_model.SGDClassifier()
As usual, ...
Read now
Unlock full access