Solved – How to output a logistic regression lasso penalty term used in sklearn

logisticpythonscikit learn

I am using below syntax to run a logistic regression lasso model in sklearn, I did get the coefficient but needed to know what is the alpha used or rather lasso penalty term used in the run.

clf = sklearn.linear_model.LogisticRegression(penalty='l1',n_jobs =-1,solver='liblinear').fit(X, y)

Best Answer

in the object constructor use the paramer C:

clf = sklearn.linear_model.LogisticRegression(penalty='l1',n_jobs =-1,solver='liblinear',C=1).fit(X, y).

C: float, default: 1.0Inverse of regularization strength; must be a positive float. Like in support vector machines, smaller values specify stronger regularization.

Related Question