Implementing standard Linear Regression is done as the follo…
Implementing standard Linear Regression is done as the following: from sklearn.linear_model import LogisticRegression lr = LogisticRegression().fit(X_train, y_train) How do you implement the Logistic Regression model using L1 and L2 regularization? A. from sklearn.linear_model import LogRegCV lr_l1 = LogRegCV(Cs=10, cv=4, penalty=’l1′, solver=’liblinear’).fit(X_train, y_train) lr_l2 = LogRegCV(Cs=10, cv=4, penalty=’l2′).fit(X_train, y_train) B. from sklearn.linear_model import LogisticRegressionCV lr_l1 = LogisticRegressionCV(Cs=10, cv=4, penalty=’l1′, solver=’liblinear’).fit(y_train) lr_l2 = LogisticRegressionCV(Cs=10, cv=4, penalty=’l2′).fit(X_train, y_train) C. from sklearn.linear_model import LogisticRegressionCV lr_l1 = LogisticRegressionCV(Cs=10, cv=4, penalty=’l1′, solver=’liblinear’).pred(X_train, y_train) lr_l2 = LogisticRegressionCV.fit(X_train, y_test) D. from sklearn.linear_model import LogisticRegressionCV lr_l1 = LogisticRegressionCV(Cs=10, cv=4, penalty=’l1′, solver=’liblinear’).fit(X_train, y_train) lr_l2 = LogisticRegressionCV(Cs=10, cv=4, penalty=’l2′).fit(X_train, y_train)
Read Details