Exercise

Fit logistic regression with L1 regularization

You will now run a logistic regression model on scaled data with L1 regularization to perform feature selection alongside model building. In the video exercise you have seen how the different C values have an effect on your accuracy score and the number of non-zero features. In this exercise, you will set the C value to 0.025.

The LogisticRegression and accuracy_score functions from sklearn library have been loaded for you. Also, the scaled features and target variables have been loaded as train_X, train_Y for training data, and test_X, test_Y for test data.

Instructions

100 XP
  • Initialize a logistic regression with L1 regularization and C value of 0.025.
  • Fit the model on the training data.
  • Predict churn values on the test data.
  • Print the accuracy score of your predicted labels on the test data.