Training a logistic regression model with regularization

As we briefly mentioned in the last section, the penalty parameter in the logistic regression SGDClassifier is related to model regularization. There are two basic forms of regularization, L1 and L2. In either way, the regularization is an additional term on top of the original cost function:

Where is the constant that multiplies the regularization term, and q is either 1 or 2 representing L1 or L2 regularization where:

Training a logistic regression model is a process of reducing the ...

Get Python Machine Learning By Example now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.