introduction to machine learning and deep learning memorize the data this is referred to as rote learningthe logical extreme of overfitting this is why the capacity of the model needs to be tuned with respect to the amount of training data we have if the dataset is smallwe are better off training models with lower capacity egularization building on the ideas of model capacitygeneralizationoverfittingand underfittingthis section discusses regularization the key idea here is to penalize the complexity of the model regularized version of least squares takes the form bxwhere is vector such that is minimized and is user-defined parameter that controls the complexity hereby introducing the term we are penalizing complex models to see why this is the caseconsider fitting least squares model using polynomial of degree but the values in the vector have eight zeros and two non-zeros as against thisconsider the case where all values in the vector are non-zeros for all practical purposesthe former model is model with degree and has lower value of the term enables us to balance accuracy over the training data with the complexity of the model lower values of imply simpler model tuning the value of lwe can improve model performance over unseen data by balancing overfitting and underfitting listing - demonstrates how the model performance on unseen data changes while keeping the model coefficients constant but increasing values listing - regularization import matplotlib pyplot as plt import numpy as np #setting seed for reproducibility np random seed(