when using the full dataset is just by chanceanother interesting aspect of figure - is the decrease in training performance for linear regression if more data is addedit becomes harder for model to overfitor memorize the data lasso an alternative to ridge for regularizing linear regression is lasso as with ridge regressionusing the lasso also restricts coefficients to be close to zerobut in slightly different waycalled regularization the consequence of regularization is that when using the lassosome coefficients are exactly zero this means some features are entirely ignored by the model this can be seen as form of automatic feature selection having some coefficients be exactly zero often makes model easier to interpretand can reveal the most important features of your model let' apply the lasso to the extended boston housing datasetin[ ]from sklearn linear_model import lasso lasso lasso(fit(x_trainy_trainprint("training set score{ }format(lasso score(x_trainy_train))print("test set score{ }format(lasso score(x_testy_test))print("number of features used{}format(np sum(lasso coef_ ! ))out[ ]training set score test set score number of features used as you can seelasso does quite badlyboth on the training and the test set this indicates that we are underfittingand we find that it used only of the features similarly to ridgethe lasso also has regularization parameteralphathat controls how strongly coefficients are pushed toward zero in the previous examplewe used the default of alpha= to reduce underfittinglet' try decreasing alpha when we do thiswe also need to increase the default setting of max_iter (the maximum number of iterations to run) the lasso penalizes the norm of the coefficient vector--or in other wordsthe sum of the absolute values of the coefficients supervised machine learning algorithms