Experiment: effect of L1 regularization strengthUnsolved
Problem reported in interviews at
Return the mean and standard deviation (as a tuple) of the testing accuracy score (via the
scorescikit-learn method) on the handwrittetn digits dataset when training a logistic regression classifier with L1 regulariization with different regularization strengths. You will be provided a list of regularization strengths to use in the experiments as input.
Use the scikitlearn library. You can import the handwritten digits dataset and the logistic regression classifier with the following code:
from sklearn.datasets import load_digits
from sklearn.linear_model import LogisticRegression
X, y = load_digits(return_X_y=True)
Use the 'liblinear' solver for the Logistic Regression classifier. See LogisticRegression documentation here: https://scikit-learn.org/stable/modules/generated/sklearn.linear_model.LogisticRegression.html. Use a random state of 5.
This code may take a few seconds or minutes to run because the model will be trained across several conditions.
regularization_strengths: [0.1, 0.5, 0.9]
This is a premium problem, to view more details of this problem please sign up for MLPro Premium. MLPro premium offers access to actual machine learning and data science interview questions and coding challenges commonly asked at tech companies all over the world
MLPro Premium also allows you to access all our high quality MCQs which are not available on the free tier.
Not able to solve a problem? MLPro premium brings you access to solutions for all problems available on MLPro
Get access to Premium only exclusive educational content available to only Premium users.
Have an issue, the MLPro support team is available 24X7 to Premium users.
This is a premium feature.
To access this and other such features, click on upgrade below.
Log in to post a commentComments
Input Test CasePlease enter only one test case at a time
numpy has been already imported as np (import numpy as np)