This equation does not lead to a nice analytical equation as in either Ridge regression or ordinary least squares. This equation can however be solved by using standard convex optimization algorithms.We will discuss how to code the above methods using gardient descent methods.
+
This equation does not lead to a nice analytical equation as in either Ridge regression or ordinary least squares. This equation can however be solved by using standard convex optimization algorithms.We will discuss how to code the above methods using gradient descent methods.
Material for lab sessions sessions Tuesday and Wednesday
+
Optimization and gradient descent, the central part of any Machine Learning algortithm
-
The material here contains a summary of the lecture on Monday and discussion of SVD, Ridge and Lasso regression with examples
+
Almost every problem in machine learning and data science starts with
+a dataset \( X \), a model \( g(\theta) \), which is a function of the
+parameters \( \theta \) and a cost function \( C(X, g(\theta)) \) that allows
+us to judge how well the model \( g(\theta) \) explains the observations
+\( X \). The model is fit by finding the values of \( \theta \) that minimize
+the cost function. Ideally we would be able to solve for \( \theta \)
+analytically, however this is not possible in general and we must use
+some approximative/numerical method to compute the minimum.
+
where the tilde-matrix \( \tilde{\boldsymbol{\Sigma}} \) is a matrix of dimension \( p\times p \) containing only the singular values \( \sigma_i \), that is
Let us quickly remind ourselves how we derive the above method.
+
Perhaps the most celebrated of all one-dimensional root-finding
+routines is Newton's method, also called the Newton-Raphson
+method. This method requires the evaluation of both the
+function \( f \) and its derivative \( f' \) at arbitrary points.
+If you can only calculate the derivative
+numerically and/or your function is not of the smooth type, we
+normally discourage the use of this method.
+
This means the vectors \( \boldsymbol{v}_i \) of the orthogonal matrix \( \boldsymbol{V} \)
-are the eigenvectors of the matrix \( \boldsymbol{X}^T\boldsymbol{X} \) with eigenvalues
-given by the singular values squared, that is
+
The Newton-Raphson formula consists geometrically of extending the
+tangent line at a current point until it crosses zero, then setting
+the next guess to the abscissa of that zero-crossing. The mathematics
+behind this method is rather simple. Employing a Taylor expansion for
+\( x \) sufficiently close to the solution \( s \), we have
In other words, each non-zero singular value of \( \boldsymbol{X} \) is a positive
-square root of an eigenvalue of \( \boldsymbol{X}^T\boldsymbol{X} \). It means also that
-the columns of \( \boldsymbol{V} \) are the eigenvectors of
-\( \boldsymbol{X}^T\boldsymbol{X} \). Since we have ordered the singular values of
-\( \boldsymbol{X} \) in a descending order, it means that the column vectors
-\( \boldsymbol{v}_i \) are hierarchically ordered by how much correlation they
-encode from the columns of \( \boldsymbol{X} \).
+
For small enough values of the function and for well-behaved
+functions, the terms beyond linear are unimportant, hence we obtain
-
Note that these are also the eigenvectors and eigenvalues of the
-Hessian matrix.
-
+$$
+ f(x)+(s-x)f'(x)\approx 0,
+$$
+
+
yielding
+$$
+ s\approx x-\frac{f(x)}{f'(x)}.
+$$
+
+
Having in mind an iterative procedure, it is natural to start iterating with
Let us remind ourselves about the expression for the standard Mean Squared Error (MSE) which we used to define our cost function and the equations for the ordinary least squares (OLS) method, that is
-our optimization problem is
+
The above is Newton-Raphson's method. It has a simple geometric
+interpretation, namely \( x_{n+1} \) is the point where the tangent from
+\( (x_n,f(x_n)) \) crosses the \( x \)-axis. Close to the solution,
+Newton-Raphson converges fast to the desired result. However, if we
+are far from a root, where the higher-order terms in the series are
+important, the Newton-Raphson formula can give grossly inaccurate
+results. For instance, the initial guess for the root might be so far
+from the true root as to let the search interval include a local
+maximum or minimum of the function. If an iteration places a trial
+guess near such a local extremum, so that the first derivative nearly
+vanishes, then Newton-Raphson may fail totally
By minimizing the above equation with respect to the parameters
-\( \boldsymbol{\beta} \) we could then obtain an analytical expression for the
-parameters \( \boldsymbol{\beta} \). We can add a regularization parameter \( \lambda \) by
-defining a new cost function to be optimized, that is
+
Newton's method can be generalized to systems of several non-linear equations
+and variables. Consider the case with two equations
+
We need thus to compute the inverse of the Jacobian matrix and it
+is to understand that difficulties may
+arise in case \( {\bf \boldsymbol{J}} \) is nearly singular.
which leads to the Ridge regression minimization problem where we
-require that \( \vert\vert \boldsymbol{\beta}\vert\vert_2^2\le t \), where \( t \) is
-a finite number larger than zero. We do not include such a constraints in the discussions here.
+
It is rather straightforward to extend the above scheme to systems of
+more than two non-linear equations. In our case, the Jacobian matrix is given by the Hessian that represents the second derivative of cost function.
Using the matrix-vector expression for Ridge regression and dropping the parameter \( 1/n \) in front of the standard means squared error equation, we have
and
-taking the derivatives with respect to \( \boldsymbol{\beta} \) we obtain then
-a slightly modified matrix inversion problem which for finite values
-of \( \lambda \) does not suffer from singularity problems. We obtain
-the optimal parameters
+
The basic idea of gradient descent is
+that a function \( F(\mathbf{x}) \),
+\( \mathbf{x} \equiv (x_1,\cdots,x_n) \), decreases fastest if one goes from \( \bf {x} \) in the
+direction of the negative gradient \( -\nabla F(\mathbf{x}) \).
with \( \boldsymbol{I} \) being a \( p\times p \) identity matrix with the constraint that
+
with \( \gamma_k > 0 \).
-$$
-\sum_{i=0}^{p-1} \beta_i^2 \leq t,
-$$
-
-
with \( t \) a finite positive number.
+
For \( \gamma_k \) small enough, then \( F(\mathbf{x}_{k+1}) \leq
+F(\mathbf{x}_k) \). This means that for a sufficiently small \( \gamma_k \)
+we are always moving towards smaller function values, i.e a minimum.
+
Note well that a library like Scikit-Learn does not include the \( 1/n \) factor in the expression for the mean-squared error. If you include it, the optimal parameter \( \beta \) becomes
+
The previous observation is the basis of the method of steepest
+descent, which is also referred to as just gradient descent (GD). One
+starts with an initial guess \( \mathbf{x}_0 \) for a minimum of \( F \) and
+computes new approximations according to
+
which can lead to singular matrices. However, with the SVD, we can always compute the inverse of the matrix \( \boldsymbol{X}^T\boldsymbol{X} \).
+
Ideally the sequence \( \{\mathbf{x}_k \}_{k=0} \) converges to a global
+minimum of the function \( F \). In general we do not know if we are in a
+global or local minimum. In the special case when \( F \) is a convex
+function, all local minima are also global minima, so in this case
+gradient descent can converge to the global solution. The advantage of
+this scheme is that it is conceptually simple and straightforward to
+implement. However the method in this form has some severe
+limitations:
+
-
We see that Ridge regression is nothing but the standard OLS with a
-modified diagonal term added to \( \boldsymbol{X}^T\boldsymbol{X} \). The consequences, in
-particular for our discussion of the bias-variance tradeoff are rather
-interesting. We will see that for specific values of \( \lambda \), we may
-even reduce the variance of the optimal parameters \( \boldsymbol{\beta} \). These topics and other related ones, will be discussed after the more linear algebra oriented analysis here.
+
In machine learing we are often faced with non-convex high dimensional
+cost functions with many local minima. Since GD is deterministic we
+will get stuck in a local minimum, if the method converges, unless we
+have a very good intial guess. This also implies that the scheme is
+sensitive to the chosen initial condition.
+
+
+
Note that the gradient is a function of \( \mathbf{x} =
+(x_1,\cdots,x_n) \) which makes it expensive to compute numerically.
@@ -291,7 +389,7 @@ even reduce the variance of the optimal parameters \( \boldsymbol{\beta} \). The
Using our insights about the SVD of the design matrix \( \boldsymbol{X} \)
-We have already analyzed the OLS solutions in terms of the eigenvectors (the columns) of the right singular value matrix \( \boldsymbol{U} \) as
+
The gradient descent method
+is sensitive to the choice of learning rate \( \gamma_k \). This is due
+to the fact that we are only guaranteed that \( F(\mathbf{x}_{k+1}) \leq
+F(\mathbf{x}_k) \) for sufficiently small \( \gamma_k \). The problem is to
+determine an optimal learning rate. If the learning rate is chosen too
+small the method will take a long time to converge and if it is too
+large we can experience erratic behavior.
with the vectors \( \boldsymbol{u}_j \) being the columns of \( \boldsymbol{U} \) from the SVD of the matrix \( \boldsymbol{X} \).
+
Many of these shortcomings can be alleviated by introducing
+randomness. One such method is that of Stochastic Gradient Descent
+(SGD), to be discussed next week.
+
Ridge regression finds the coordinates of \( \boldsymbol{y} \) with respect to the
-orthonormal basis \( \boldsymbol{U} \), it then shrinks the coordinates by
-\( \frac{\sigma_j^2}{\sigma_j^2+\lambda} \). Recall that the SVD has
-eigenvalues ordered in a descending way, that is \( \sigma_i \geq
-\sigma_{i+1} \).
+
First we give the definition of a convex set: A set \( C \) in
+\( \mathbb{R}^n \) is said to be convex if, for all \( x \) and \( y \) in \( C \) and
+all \( t \in (0,1) \) , the point \( (1 − t)x + ty \) also belongs to
+C. Geometrically this means that every point on the line segment
+connecting \( x \) and \( y \) is in \( C \) as discussed below.
-
For small eigenvalues \( \sigma_i \) it means that their contributions become less important, a fact which can be used to reduce the number of degrees of freedom.
+
The convex subsets of \( \mathbb{R} \) are the intervals of
+\( \mathbb{R} \). Examples of convex sets of \( \mathbb{R}^2 \) are the
+regular polygons (triangles, rectangles, pentagons, etc...).
+
@@ -293,7 +382,7 @@ eigenvalues ordered in a descending way, that is \( \sigma_i \geq
that is the Ridge estimator scales the OLS estimator by the inverse of a factor \( 1+\lambda \), and
-the Ridge estimator converges to zero when the hyperparameter goes to
-infinity.
-
-
-
We will come back to more interpreations after we have gone through some of the statistical analysis part.
Convex function: Let \( X \subset \mathbb{R}^n \) be a convex set. Assume that the function \( f: X \rightarrow \mathbb{R} \) is continuous, then \( f \) is said to be convex if $$f(tx_1 + (1-t)x_2) \leq tf(x_1) + (1-t)f(x_2) $$ for all \( x_1, x_2 \in X \) and for all \( t \in [0,1] \). If \( \leq \) is replaced with a strict inequaltiy in the definition, we demand \( x_1 \neq x_2 \) and \( t\in(0,1) \) then \( f \) is said to be strictly convex. For a single variable function, convexity means that if you draw a straight line connecting \( f(x_1) \) and \( f(x_2) \), the value of the function on the interval \( [x_1,x_2] \) is always below the line as illustrated below.
Using the matrix-vector expression for Lasso regression, we have the following cost function
+
In the following we state first and second-order conditions which
+ensures convexity of a function \( f \). We write \( D_f \) to denote the
+domain of \( f \), i.e the subset of \( R^n \) where \( f \) is defined. For more
+details and proofs we refer to: S. Boyd and L. Vandenberghe. Convex Optimization. Cambridge University Press.
+
Suppose \( f \) is differentiable (i.e \( \nabla f(x) \) is well defined for
+all \( x \) in the domain of \( f \)). Then \( f \) is convex if and only if \( D_f \)
+is a convex set and $$f(y) \geq f(x) + \nabla f(x)^T (y-x) $$ holds
+for all \( x,y \in D_f \). This condition means that for a convex function
+the first order Taylor expansion (right hand side above) at any point
+a global under estimator of the function. To convince yourself you can
+make a drawing of \( f(x) = x^2+1 \) and draw the tangent line to \( f(x) \) and
+note that it is always below the graph.
+
+
+
-
Taking the derivative with respect to \( \boldsymbol{\beta} \) and recalling that the derivative of the absolute value is (we drop the boldfaced vector symbol for simplicity)
we have that the derivative of the cost function is
+
+
+
+
Assume that \( f \) is twice
+differentiable, i.e the Hessian matrix exists at each point in
+\( D_f \). Then \( f \) is convex if and only if \( D_f \) is a convex set and its
+Hessian is positive semi-definite for all \( x\in D_f \). For a
+single-variable function this reduces to \( f''(x) \geq 0 \). Geometrically this means that \( f \) has nonnegative curvature
+everywhere.
+
This equation does not lead to a nice analytical equation as in Ridge regression or ordinary least squares. We have absorbed the factor \( 2/n \) in a redefinition of the parameter \( \lambda \). We will solve this type of problems using libraries like scikit-learn and using our own gradient descent code in project 1.
+
This condition is particularly useful since it gives us an procedure for determining if the function under consideration is convex, apart from using the definition.
Simple example to illustrate Ordinary Least Squares, Ridge and Lasso Regression
+
More on convex functions
-
Let us assume that our design matrix is given by unit (identity) matrix, that is a square diagonal matrix with ones only along the
-diagonal. In this case we have an equal number of rows and columns \( n=p \).
+
The next result is of great importance to us and the reason why we are
+going on about convex functions. In machine learning we frequently
+have to minimize a loss/cost function in order to find the best
+parameters for the model we are considering.
-
Our model approximation is just \( \tilde{\boldsymbol{y}}=\boldsymbol{\beta} \) and the mean squared error and thereby the cost function for ordinary least sqquares (OLS) is then (we drop the term \( 1/n \))
Ideally we want the
+global minimum (for high-dimensional models it is hard to know
+if we have local or global minimum). However, if the cost/loss function
+is convex the following result provides invaluable information:
+
-
and minimizing we have that
-$$
-\hat{\beta}_i^{\mathrm{OLS}} = y_i.
-$$
+
+
+
+
Consider the problem of finding \( x \in \mathbb{R}^n \) such that \( f(x) \)
+is minimal, where \( f \) is convex and differentiable. Then, any point
+\( x^* \) that satisfies \( \nabla f(x^*) = 0 \) is a global minimum.
+
+
+
+
This result means that if we know that the cost/loss function is convex and we are able to find a minimum, we are guaranteed that it is a global minimum.
Show that \( f(x)=x^2 \) is convex for \( x \in \mathbb{R} \) using the definition of convexity. Hint: If you re-write the definition, \( f \) is convex if the following holds for all \( x,y \in D_f \) and any \( \lambda \in [0,1] \) $\lambda f(x)+(1-\lambda)f(y)-f(\lambda x + (1-\lambda) y ) \geq 0$.
+
Using the second order condition show that the following functions are convex on the specified domain.
+
+
\( f(x) = e^x \) is convex for \( x \in \mathbb{R} \).
+
\( g(x) = -\ln(x) \) is convex for \( x \in (0,\infty) \).
+
+
Let \( f(x) = x^2 \) and \( g(x) = e^x \). Show that \( f(g(x)) \) and \( g(f(x)) \) is convex for \( x \in \mathbb{R} \). Also show that if \( f(x) \) is any convex function than \( h(x) = e^{f(x)} \) is convex.
+
A norm is any function that satisfy the following properties
+
+
\( f(\alpha x) = |\alpha| f(x) \) for all \( \alpha \in \mathbb{R} \).
+
\( f(x+y) \leq f(x) + f(y) \)
+
\( f(x) \leq 0 \) for all \( x \in \mathbb{R}^n \) with equality if and only if \( x = 0 \)
+
+
+
Using the definition of convexity, try to show that a function satisfying the properties above is convex (the third condition is not needed to show this).
We will use linear regression as a case study for the gradient descent
+methods. Linear regression is a great test case for the gradient
+descent methods discussed in the lectures since it has several
+desirable properties such as:
+
+
+
+
An analytical solution (recall homework sets for week 35).
+
The gradient can be computed analytically.
+
The cost function is convex which guarantees that gradient descent converges for small enough learning rates
+
+
We revisit an example similar to what we had in the first homework set. We had a function of the type
+
+
+
+
+
+
+
+
+
x =2*np.random.rand(m,1)
+y =4+3*x+np.random.randn(m,1)
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
with \( x_i \in [0,1] \) is chosen randomly using a uniform distribution. Additionally we have a stochastic noise chosen according to a normal distribution \( \cal {N}(0,1) \).
+The linear regression model is given by
+
Plotting these results shows clearly that Lasso regression suppresses (sets to zero) values of \( \beta_i \) for specific values of \( \lambda \). Ridge regression reduces on the other hand the values of \( \beta_i \) as function of \( \lambda \).
Let us assume we have a data set with outputs/targets given by the vector
+
Let \( \mathbf{y} = (y_1,\cdots,y_n)^T \), \( \mathbf{\boldsymbol{y}} = (\boldsymbol{y}_1,\cdots,\boldsymbol{y}_n)^T \) and \( \theta = (\theta_0, \theta_1)^T \)
+
It is convenient to write \( \mathbf{\boldsymbol{y}} = X\theta \) where \( X \in \mathbb{R}^{100 \times 2} \) is the design matrix given by (we keep the intercept here)
meaning that we have two features and two unknown parameters \( \beta_0 \) and \( \beta_1 \) to be determined either by ordinary least squares, Ridge or Lasso regression.
+
and we want to find \( \theta \) such that \( C(\theta) \) is minimized.
For ordinary least squares (OLS) we know that the optimal solution is
+
The derivative of the cost/loss function
+
Computing \( \partial C(\theta) / \partial \theta_0 \) and \( \partial C(\theta) / \partial \theta_1 \) we can show that the gradient can be written as
There is normally a constraint on the value of \( \vert\vert \boldsymbol{\beta}\vert\vert_2 \) via the parameter \( \lambda \).
-Let us for simplicity assume that \( \beta_0^2+\beta_1^2=1 \) as constraint. This will allow us to find an expression for the optimal values of \( \beta \) and \( \lambda \).
-
-
-
To see this, let us write the cost function for Ridge regression.
+
This result implies that \( C(\theta) \) is a convex function since the matrix \( X^T X \) always is positive semi-definite.
@@ -292,6 +373,11 @@ Let us for simplicity assume that \( \beta_0^2+\beta_1^2=1 \) as constraint. Thi
We can use the expression we computed for the gradient and let use a
+\( \theta_0 \) be chosen randomly and let \( \gamma = 0.001 \). Stop iterating
+when \( ||\nabla_\theta C(\theta_k) || \leq \epsilon = 10^{-8} \). Note that the code below does not include the latter stop criterion.
+
For Lasso we need now, keeping a constraint on \( \vert\beta_0\vert+\vert\beta_1\vert=1 \), to take the derivative of the absolute values of \( \beta_0 \)
-and \( \beta_1 \). This gives us the following derivatives of the cost function
-
Using the constraint on \( \beta_0 \) and \( \beta_1 \) we can then find the optimal value of \( \lambda \) for the different cases. We leave this as an exercise to you.
Here we set up the OLS, Ridge and Lasso functionality in order to study the above example. Note that here we have opted for a set of values of \( \lambda \), meaning that we need to perform a search in order to find the optimal values.
+
We have also discussed Ridge regression where the loss function contains a regularized term given by the \( L_2 \) norm of \( \theta \),
importos
-importnumpyasnp
-importpandasaspd
-importmatplotlib.pyplotasplt
-
-defR2(y_data, y_model):
- return1- np.sum((y_data - y_model) **2) / np.sum((y_data - np.mean(y_data)) **2)
-defMSE(y_data,y_model):
- n = np.size(y_model)
- return np.sum((y_data-y_model)**2)/n
-
-
-# A seed just to ensure that the random numbers are the same for every run.
-# Useful for eventual debugging.
-
-X = np.array( [ [ 2, 0], [0, 1], [0,0]])
-y = np.array( [4, 2, 3])
-
-
-# matrix inversion to find beta
-OLSbeta = np.linalg.inv(X.T @ X) @ X.T @ y
-print(OLSbeta)
-# and then make the prediction
-ytildeOLS = X @ OLSbeta
-print("Training MSE for OLS")
-print(MSE(y,ytildeOLS))
-ypredictOLS = X @ OLSbeta
-
-# Repeat now for Ridge regression and various values of the regularization parameter
-I = np.eye(2,2)
-# Decide which values of lambda to use
-nlambdas =100
-MSEPredict = np.zeros(nlambdas)
-lambdas = np.logspace(-4, 4, nlambdas)
-for i inrange(nlambdas):
- lmb = lambdas[i]
- Ridgebeta = np.linalg.inv(X.T @ X+lmb*I) @ X.T @ y
-# print(Ridgebeta)
- # and then make the prediction
- ypredictRidge = X @ Ridgebeta
- MSEPredict[i] = MSE(y,ypredictRidge)
-# print(MSEPredict[i])
- # Now plot the results
-plt.figure()
-plt.plot(np.log10(lambdas), MSEPredict, 'r--', label ='MSE Ridge Train')
-plt.xlabel('log10(lambda)')
-plt.ylabel('MSE')
-plt.legend()
-plt.show()
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
We see here that we reach a plateau. What is actually happening?
This implies that the Hessian matrix is positive definite, hence the stationary point is a
+minimum.
+Note that the Ridge cost function is convex being a sum of two convex
+functions. Therefore, the stationary point is a global
+minimum of this function.
+
importos
-importnumpyasnp
-importpandasaspd
-importmatplotlib.pyplotasplt
-fromsklearn.model_selectionimport train_test_split
-fromsklearnimport linear_model
-
-defR2(y_data, y_model):
- return1- np.sum((y_data - y_model) **2) / np.sum((y_data - np.mean(y_data)) **2)
-defMSE(y_data,y_model):
- n = np.size(y_model)
- return np.sum((y_data-y_model)**2)/n
-
-
-# A seed just to ensure that the random numbers are the same for every run.
-# Useful for eventual debugging.
-np.random.seed(3155)
-
-x = np.random.rand(100)
-y =2.0+5*x*x+0.1*np.random.randn(100)
-
-# number of features p (here degree of polynomial
-p =3
-# The design matrix now as function of a given polynomial
-X = np.zeros((len(x),p))
-X[:,0] =1.0
-X[:,1] = x
-X[:,2] = x*x
-# We split the data in test and training data
-X_train, X_test, y_train, y_test = train_test_split(X, y, test_size=0.2)
-
-# matrix inversion to find beta
-OLSbeta = np.linalg.inv(X_train.T @ X_train) @ X_train.T @ y_train
-print(OLSbeta)
-# and then make the prediction
-ytildeOLS = X_train @ OLSbeta
-print("Training MSE for OLS")
-print(MSE(y_train,ytildeOLS))
-ypredictOLS = X_test @ OLSbeta
-print("Test MSE OLS")
-print(MSE(y_test,ypredictOLS))
-
-# Repeat now for Lasso and Ridge regression and various values of the regularization parameter
-I = np.eye(p,p)
-# Decide which values of lambda to use
-nlambdas =100
-MSEPredict = np.zeros(nlambdas)
-MSETrain = np.zeros(nlambdas)
-MSELassoPredict = np.zeros(nlambdas)
-MSELassoTrain = np.zeros(nlambdas)
-lambdas = np.logspace(-4, 4, nlambdas)
-for i inrange(nlambdas):
- lmb = lambdas[i]
- Ridgebeta = np.linalg.inv(X_train.T @ X_train+lmb*I) @ X_train.T @ y_train
- # include lasso using Scikit-Learn
- RegLasso = linear_model.Lasso(lmb,fit_intercept=False)
- RegLasso.fit(X_train,y_train)
- # and then make the prediction
- ytildeRidge = X_train @ Ridgebeta
- ypredictRidge = X_test @ Ridgebeta
- ytildeLasso = RegLasso.predict(X_train)
- ypredictLasso = RegLasso.predict(X_test)
- MSEPredict[i] = MSE(y_test,ypredictRidge)
- MSETrain[i] = MSE(y_train,ytildeRidge)
- MSELassoPredict[i] = MSE(y_test,ypredictLasso)
- MSELassoTrain[i] = MSE(y_train,ytildeLasso)
-
-# Now plot the results
-plt.figure()
-plt.plot(np.log10(lambdas), MSETrain, label ='MSE Ridge train')
-plt.plot(np.log10(lambdas), MSEPredict, 'r--', label ='MSE Ridge Test')
-plt.plot(np.log10(lambdas), MSELassoTrain, label ='MSE Lasso train')
-plt.plot(np.log10(lambdas), MSELassoPredict, 'r--', label ='MSE Lasso Test')
-
-plt.xlabel('log10(lambda)')
-plt.ylabel('MSE')
-plt.legend()
-plt.show()
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
Using gradient descent methods, limitations
+
+
Gradient descent (GD) finds local minima of our function. Since the GD algorithm is deterministic, if it converges, it will converge to a local minimum of our cost/loss/risk function. Because in ML we are often dealing with extremely rugged landscapes with many local minima, this can lead to poor performance.
+
GD is sensitive to initial conditions. One consequence of the local nature of GD is that initial conditions matter. Depending on where one starts, one will end up at a different local minima. Therefore, it is very important to think about how one initializes the training process. This is true for GD as well as more complicated variants of GD.
+
Gradients are computationally expensive to calculate for large datasets. In many cases in statistics and ML, the cost/loss/risk function is a sum of terms, with one term for each data point. For example, in linear regression, \( E \propto \sum_{i=1}^n (y_i - \mathbf{w}^T\cdot\mathbf{x}_i)^2 \); for logistic regression, the square error is replaced by the cross entropy. To calculate the gradient we have to sum over all \( n \) data points. Doing this at every GD step becomes extremely computationally expensive. An ingenious solution to this, is to calculate the gradients using small subsets of the data called "mini batches". This has the added benefit of introducing stochasticity into our algorithm.
+
GD is very sensitive to choices of learning rates. GD is extremely sensitive to the choice of learning rates. If the learning rate is very small, the training process take an extremely long time. For larger learning rates, GD can diverge and give poor results. Furthermore, depending on what the local landscape looks like, we have to modify the learning rates to ensure convergence. Ideally, we would adaptively choose the learning rates to match the landscape.
+
GD treats all directions in parameter space uniformly. Another major drawback of GD is that unlike Newton's method, the learning rate for GD is the same in all directions in parameter space. For this reason, the maximum learning rate is set by the behavior of the steepest direction and this can significantly slow down training. Ideally, we would like to take large steps in flat directions and small steps in steep directions. Since we are exploring rugged landscapes where curvatures change, this requires us to keep track of not only the gradient but second derivatives. The ideal scenario would be to calculate the Hessian but this proves to be too computationally expensive.
+
GD can take exponential time to escape saddle points, even with random initialization. As we mentioned, GD is extremely sensitive to initial condition since it determines the particular local minimum GD would eventually reach. However, even with a good initialization scheme, through the introduction of randomness, GD can still take exponential time to escape saddle points.
diff --git a/doc/pub/week36/html/._week36-bs049.html b/doc/pub/week36/html/._week36-bs049.html
index a812bca12..99fd6075c 100644
--- a/doc/pub/week36/html/._week36-bs049.html
+++ b/doc/pub/week36/html/._week36-bs049.html
@@ -8,8 +8,8 @@ doconce format html week36.do.txt --html_style=bootstrap --pygments_html_style=d
-
-Week 36: Statistical interpretation of Linear Regression and Resampling techniques
+
+Week 36: Linear Regression and Gradient descent
@@ -37,28 +37,144 @@ doconce format html week36.do.txt --html_style=bootstrap --pygments_html_style=d
@@ -197,7 +251,7 @@ MathJax.Hub.Config({
- Week 36: Statistical interpretation of Linear Regression and Resampling techniques
+ Week 36: Linear Regression and Gradient descent
Material for lab sessions sessions Tuesday and Wednesday
-
To derive the Lasso cost function, we simply replace the Gaussian prior with an exponential distribution (Laplace in this case) with zero mean value, that is
diff --git a/doc/pub/week36/html/._week36-bs050.html b/doc/pub/week36/html/._week36-bs050.html
index f71264ab0..acc6038e8 100644
--- a/doc/pub/week36/html/._week36-bs050.html
+++ b/doc/pub/week36/html/._week36-bs050.html
@@ -8,8 +8,8 @@ doconce format html week36.do.txt --html_style=bootstrap --pygments_html_style=d
-
-Week 36: Statistical interpretation of Linear Regression and Resampling techniques
+
+Week 36: Linear Regression and Gradient descent
@@ -37,33 +37,144 @@ doconce format html week36.do.txt --html_style=bootstrap --pygments_html_style=d
@@ -198,7 +251,7 @@ MathJax.Hub.Config({
- Week 36: Statistical interpretation of Linear Regression and Resampling techniques
+ Week 36: Linear Regression and Gradient descent
To derive the Lasso cost function, we simply replace the Gaussian prior with an exponential distribution (Laplace in this case) with zero mean value, that is
+
Linear Regression and the SVD
+
We used the SVD to analyse the matrix to invert in ordinary lineat regression
Taking the negative
-logarithm of the posterior probability and leaving out the
-constants terms that do not depend on \( \beta \), we have
-
+
where the tilde-matrix \( \tilde{\boldsymbol{\Sigma}} \) is a matrix of dimension \( p\times p \) containing only the singular values \( \sigma_i \), that is
diff --git a/doc/pub/week36/html/._week36-bs051.html b/doc/pub/week36/html/._week36-bs051.html
index 993271ae5..46759c5eb 100644
--- a/doc/pub/week36/html/._week36-bs051.html
+++ b/doc/pub/week36/html/._week36-bs051.html
@@ -8,8 +8,8 @@ doconce format html week36.do.txt --html_style=bootstrap --pygments_html_style=d
-
-Week 36: Statistical interpretation of Linear Regression and Resampling techniques
+
+Week 36: Linear Regression and Gradient descent
@@ -37,28 +37,144 @@ doconce format html week36.do.txt --html_style=bootstrap --pygments_html_style=d
@@ -217,7 +251,7 @@ MathJax.Hub.Config({
- Week 36: Statistical interpretation of Linear Regression and Resampling techniques
+ Week 36: Linear Regression and Gradient descent
The quantity \( p(Y\vert X) \) on the right-hand side of the theorem is
-evaluated for the observed data \( Y \) and can be viewed as a function of
-the parameter space represented by \( X \). This function is not
-necesseraly normalized and is normally called the likelihood function.
+
This means the vectors \( \boldsymbol{v}_i \) of the orthogonal matrix \( \boldsymbol{V} \)
+are the eigenvectors of the matrix \( \boldsymbol{X}^T\boldsymbol{X} \) with eigenvalues
+given by the singular values squared, that is
-
The function \( p(X) \) on the right hand side is called the prior while the function on the left hand side is the called the posterior probability. The denominator on the right hand side serves as a normalization factor for the posterior distribution.
Let us try to illustrate Bayes' theorem through an example.
+
In other words, each non-zero singular value of \( \boldsymbol{X} \) is a positive
+square root of an eigenvalue of \( \boldsymbol{X}^T\boldsymbol{X} \). It means also that
+the columns of \( \boldsymbol{V} \) are the eigenvectors of
+\( \boldsymbol{X}^T\boldsymbol{X} \). Since we have ordered the singular values of
+\( \boldsymbol{X} \) in a descending order, it means that the column vectors
+\( \boldsymbol{v}_i \) are hierarchically ordered by how much correlation they
+encode from the columns of \( \boldsymbol{X} \).
+
+
+
Note that these are also the eigenvectors and eigenvalues of the
+Hessian matrix.
+
@@ -329,6 +387,10 @@ necesseraly normalized and is normally called the likelihood function.
diff --git a/doc/pub/week36/html/._week36-bs052.html b/doc/pub/week36/html/._week36-bs052.html
index 64f292ff0..8b9f7a759 100644
--- a/doc/pub/week36/html/._week36-bs052.html
+++ b/doc/pub/week36/html/._week36-bs052.html
@@ -8,8 +8,8 @@ doconce format html week36.do.txt --html_style=bootstrap --pygments_html_style=d
-
-Week 36: Statistical interpretation of Linear Regression and Resampling techniques
+
+Week 36: Linear Regression and Gradient descent
@@ -37,28 +37,144 @@ doconce format html week36.do.txt --html_style=bootstrap --pygments_html_style=d
@@ -217,7 +251,7 @@ MathJax.Hub.Config({
- Week 36: Statistical interpretation of Linear Regression and Resampling techniques
+ Week 36: Linear Regression and Gradient descent
Let us suppose that you are undergoing a series of mammography scans in
-order to rule out possible breast cancer cases. We define the
-sensitivity for a positive event by the variable \( X \). It takes binary
-values with \( X=1 \) representing a positive event and \( X=0 \) being a
-negative event. We reserve \( Y \) as a classification parameter for
-either a negative or a positive breast cancer confirmation. (Short note on wordings: positive here means having breast cancer, although none of us would consider this being a positive thing).
+
Let us remind ourselves about the expression for the standard Mean Squared Error (MSE) which we used to define our cost function and the equations for the ordinary least squares (OLS) method, that is
+our optimization problem is
-
-
We let \( Y=1 \) represent the the case of having breast cancer and \( Y=0 \) as not.
-
-
Let us assume that if you have breast cancer, the test will be positive with a probability of \( 0.8 \), that is we have
This obviously sounds scary since many would conclude that if the test is positive, there is a likelihood of \( 80\% \) for having cancer.
-It is however not correct, as the following Bayesian analysis shows.
-
@@ -338,6 +383,11 @@ It is however not correct, as the following Bayesian analysis shows.
diff --git a/doc/pub/week36/html/._week36-bs053.html b/doc/pub/week36/html/._week36-bs053.html
index 242731eb8..fd61dc475 100644
--- a/doc/pub/week36/html/._week36-bs053.html
+++ b/doc/pub/week36/html/._week36-bs053.html
@@ -8,8 +8,8 @@ doconce format html week36.do.txt --html_style=bootstrap --pygments_html_style=d
-
-Week 36: Statistical interpretation of Linear Regression and Resampling techniques
+
+Week 36: Linear Regression and Gradient descent
@@ -37,28 +37,144 @@ doconce format html week36.do.txt --html_style=bootstrap --pygments_html_style=d
@@ -217,7 +251,7 @@ MathJax.Hub.Config({
- Week 36: Statistical interpretation of Linear Regression and Resampling techniques
+ Week 36: Linear Regression and Gradient descent
If we look at various national surveys on breast cancer, the general likelihood of developing breast cancer is a very small number.
-Let us assume that the prior probability in the population as a whole is
+
By minimizing the above equation with respect to the parameters
+\( \boldsymbol{\theta} \) we could then obtain an analytical expression for the
+parameters \( \boldsymbol{\theta} \). We can add a regularization parameter \( \lambda \) by
+defining a new cost function to be optimized, that is
We need also to account for the fact that the test may produce a false positive result (false alarm). Let us here assume that we have
-$$
-p(X=1\vert Y=0) =0.1.
-$$
+
which leads to the Ridge regression minimization problem where we
+require that \( \vert\vert \boldsymbol{\theta}\vert\vert_2^2\le t \), where \( t \) is
+a finite number larger than zero. We do not include such a constraints in the discussions here.
+
-
Using Bayes' theorem we can then find the posterior probability that the person has breast cancer in case of a positive test, that is we can compute
diff --git a/doc/pub/week36/html/._week36-bs054.html b/doc/pub/week36/html/._week36-bs054.html
index 9fb68e006..78806ccd5 100644
--- a/doc/pub/week36/html/._week36-bs054.html
+++ b/doc/pub/week36/html/._week36-bs054.html
@@ -8,8 +8,8 @@ doconce format html week36.do.txt --html_style=bootstrap --pygments_html_style=d
-
-Week 36: Statistical interpretation of Linear Regression and Resampling techniques
+
+Week 36: Linear Regression and Gradient descent
@@ -37,28 +37,144 @@ doconce format html week36.do.txt --html_style=bootstrap --pygments_html_style=d
@@ -217,7 +251,7 @@ MathJax.Hub.Config({
- Week 36: Statistical interpretation of Linear Regression and Resampling techniques
+ Week 36: Linear Regression and Gradient descent
Hitherto we have discussed Ridge and Lasso regression in terms of a
-linear analysis. This may to many of you feel rather technical and
-perhaps not that intuitive. The question is whether we can develop a
-more intuitive way of understanding what Ridge and Lasso express.
+
Using the matrix-vector expression for Ridge regression and dropping the parameter \( 1/n \) in front of the standard means squared error equation, we have
and
+taking the derivatives with respect to \( \boldsymbol{\theta} \) we obtain then
+a slightly modified matrix inversion problem which for finite values
+of \( \lambda \) does not suffer from singularity problems. We obtain
+the optimal parameters
diff --git a/doc/pub/week36/html/._week36-bs055.html b/doc/pub/week36/html/._week36-bs055.html
index 5073e52ea..a6829bd69 100644
--- a/doc/pub/week36/html/._week36-bs055.html
+++ b/doc/pub/week36/html/._week36-bs055.html
@@ -8,8 +8,8 @@ doconce format html week36.do.txt --html_style=bootstrap --pygments_html_style=d
-
-Week 36: Statistical interpretation of Linear Regression and Resampling techniques
+
+Week 36: Linear Regression and Gradient descent
@@ -37,28 +37,144 @@ doconce format html week36.do.txt --html_style=bootstrap --pygments_html_style=d
@@ -217,7 +251,7 @@ MathJax.Hub.Config({
- Week 36: Statistical interpretation of Linear Regression and Resampling techniques
+ Week 36: Linear Regression and Gradient descent
Test Function for what happens with OLS, Ridge and Lasso
+
Note on Scikit-Learn
-
We will play around with a study of the values for the optimal
-parameters \( \boldsymbol{\beta} \) using OLS, Ridge and Lasso regression. For
-OLS, you will notice as function of the noise and polynomial degree,
-that the parameters \( \beta \) will fluctuate from order to order in the
-polynomial fit and that for larger and larger polynomial degrees of freedom, the parameters will tend to increase in value for OLS.
-
+
Note well that a library like Scikit-Learn does not include the \( 1/n \) factor in the expression for the mean-squared error. If you include it, the optimal parameter \( \theta \) becomes
-
For Ridge and Lasso regression, the higher order parameters will typically be reduced, providing thereby less fluctuations from one order to another one.
diff --git a/doc/pub/week36/html/._week36-bs056.html b/doc/pub/week36/html/._week36-bs056.html
index d675aa3bc..f4c7f9e12 100644
--- a/doc/pub/week36/html/._week36-bs056.html
+++ b/doc/pub/week36/html/._week36-bs056.html
@@ -8,8 +8,8 @@ doconce format html week36.do.txt --html_style=bootstrap --pygments_html_style=d
-
-Week 36: Statistical interpretation of Linear Regression and Resampling techniques
+
+Week 36: Linear Regression and Gradient descent
@@ -37,28 +37,144 @@ doconce format html week36.do.txt --html_style=bootstrap --pygments_html_style=d
@@ -217,7 +251,7 @@ MathJax.Hub.Config({
- Week 36: Statistical interpretation of Linear Regression and Resampling techniques
+ Week 36: Linear Regression and Gradient descent
which can lead to singular matrices. However, with the SVD, we can always compute the inverse of the matrix \( \boldsymbol{X}^T\boldsymbol{X} \).
-
In Bayes' theorem this function plays the role of the so-called likelihood. We could now ask the question what is the posterior probability of a parameter set \( \boldsymbol{\beta} \) given a domain of events \( \boldsymbol{D} \)? That is, how can we define the posterior probability
We have a model for \( p(\boldsymbol{D}\vert\boldsymbol{\beta}) \) but need one for the prior \( p(\boldsymbol{\beta} \)!
+
We see that Ridge regression is nothing but the standard OLS with a
+modified diagonal term added to \( \boldsymbol{X}^T\boldsymbol{X} \). The consequences, in
+particular for our discussion of the bias-variance tradeoff are rather
+interesting. We will see that for specific values of \( \lambda \), we may
+even reduce the variance of the optimal parameters \( \boldsymbol{\theta} \). These topics and other related ones, will be discussed after the more linear algebra oriented analysis here.
+
diff --git a/doc/pub/week36/html/._week36-bs057.html b/doc/pub/week36/html/._week36-bs057.html
index aa93d7987..b47e7d3f7 100644
--- a/doc/pub/week36/html/._week36-bs057.html
+++ b/doc/pub/week36/html/._week36-bs057.html
@@ -8,8 +8,8 @@ doconce format html week36.do.txt --html_style=bootstrap --pygments_html_style=d
-
-Week 36: Statistical interpretation of Linear Regression and Resampling techniques
+
+Week 36: Linear Regression and Gradient descent
@@ -37,28 +37,144 @@ doconce format html week36.do.txt --html_style=bootstrap --pygments_html_style=d
@@ -217,7 +251,7 @@ MathJax.Hub.Config({
- Week 36: Statistical interpretation of Linear Regression and Resampling techniques
+ Week 36: Linear Regression and Gradient descent
With the posterior probability defined by a likelihood which we have
-already modeled and an unknown prior, we are now ready to make
-additional models for the prior.
+
Using our insights about the SVD of the design matrix \( \boldsymbol{X} \)
+We have already analyzed the OLS solutions in terms of the eigenvectors (the columns) of the right singular value matrix \( \boldsymbol{U} \) as
-
-
We can, based on our discussions of the variance of \( \boldsymbol{\beta} \) and the mean value, assume that the prior for the values \( \boldsymbol{\beta} \) is given by a Gaussian with mean value zero and variance \( \tau^2 \), that is
We can now optimize this quantity with respect to \( \boldsymbol{\beta} \). As we
-did for OLS, this is most conveniently done by taking the negative
-logarithm of the posterior probability. Doing so and leaving out the
-constants terms that do not depend on \( \beta \), we have
-
diff --git a/doc/pub/week36/html/._week36-bs058.html b/doc/pub/week36/html/._week36-bs058.html
index 75d994099..36865f85d 100644
--- a/doc/pub/week36/html/._week36-bs058.html
+++ b/doc/pub/week36/html/._week36-bs058.html
@@ -8,8 +8,8 @@ doconce format html week36.do.txt --html_style=bootstrap --pygments_html_style=d
-
-Week 36: Statistical interpretation of Linear Regression and Resampling techniques
+
+Week 36: Linear Regression and Gradient descent
@@ -37,28 +37,144 @@ doconce format html week36.do.txt --html_style=bootstrap --pygments_html_style=d
@@ -217,7 +251,7 @@ MathJax.Hub.Config({
- Week 36: Statistical interpretation of Linear Regression and Resampling techniques
+ Week 36: Linear Regression and Gradient descent
To derive the Lasso cost function, we simply replace the Gaussian prior with an exponential distribution (Laplace in this case) with zero mean value, that is
+
Since \( \lambda \geq 0 \), it means that compared to OLS, we have
Taking the negative
-logarithm of the posterior probability and leaving out the
-constants terms that do not depend on \( \beta \), we have
+
Ridge regression finds the coordinates of \( \boldsymbol{y} \) with respect to the
+orthonormal basis \( \boldsymbol{U} \), it then shrinks the coordinates by
+\( \frac{\sigma_j^2}{\sigma_j^2+\lambda} \). Recall that the SVD has
+eigenvalues ordered in a descending way, that is \( \sigma_i \geq
+\sigma_{i+1} \).
For small eigenvalues \( \sigma_i \) it means that their contributions become less important, a fact which can be used to reduce the number of degrees of freedom.
-
and replacing \( 1/\tau \) with \( \lambda \) we have
The assumption we have made is
-that there exists a function \( f(\boldsymbol{x}) \) and a normal distributed error \( \boldsymbol{\varepsilon}\sim \mathcal{N}(0, \sigma^2) \)
-which describes our data
-
We then approximate this function with our model from the solution of the linear regression equations (ordinary least squares OLS), that is our
-function \( f \) is approximated by \( \boldsymbol{\tilde{y}} \) where we minimized \( (\boldsymbol{y}-\boldsymbol{\tilde{y}})^2 \), with
-
Hence, \( y_i \sim \mathcal{N}( \mathbf{X}_{i, \ast} \, \boldsymbol{\beta}, \sigma^2) \), that is \( \boldsymbol{y} \) follows a normal distribution with
-mean value \( \boldsymbol{X}\boldsymbol{\beta} \) and variance \( \sigma^2 \).
-
-
-
-
-
-
-b)
-With the OLS expressions for the parameters \( \boldsymbol{\beta} \) show that
-
This exercise is a continuation of the exercises from week 35.
-
-
We will
-use the same function to generate our data set, still staying with a
-simple function \( y(x) \) which we want to fit using linear regression,
-but now extending the analysis to include the Ridge and the Lasso
-regression methods.
-
-
-
We will thus again generate our own dataset for a function \( y(x) \) where
-\( x \in [0,1] \) and defined by random numbers computed with the uniform
-distribution. The function \( y \) is a quadratic polynomial in \( x \) with
-added stochastic noise according to the normal distribution \( \cal{N}(0,1) \).
-
-
-
The following simple Python instructions define our \( x \) and \( y \) values (with 100 data points).
-
-
-
-
-
-
-
-
x = np.random.rand(100)
-y =2.0+5*x*x+0.1*np.random.randn(100)
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-a)
-Write your own code for the Ridge method (see chapter 3.4 of Hastie et al., equations (3.43) and (3.44)) and compute the parametrization for different values of \( \lambda \). Study the dependence on \( \lambda \) while also varying the strength of the noise in your expression for \( y(x) \).
-
-
-
-
-
-
-b)
-Our next step is to study the variance of the parameters \( \beta_1 \) and \( \beta_2 \) (assuming that we are parameterizing our function with a second-order polynomial). We will use standard linear regression and the Ridge regression. You can now opt for either writing your own function or using Scikit-Learn to find the parameters \( \beta \). From your results calculate the variance of these parameters (recall that this is equal to the diagonal elements of the matrix \( (\hat{X}^T\hat{X})+\lambda\hat{I})^{-1} \)). Discuss the results of these variances as functions of \( \lambda \). In particular, try to link your discussion with the discussion in Hastie et al. and their figures 3.10 and 3.11. Scikit-Learn may not provide the variance of the parameters \( \beta \). This needs to be checked. With your own code you can however do so.
-
-
-
-
-
@@ -476,6 +373,18 @@ Our next step is to study the variance of the parameters \( \beta_1 \) and \( \b
diff --git a/doc/pub/week36/html/._week36-bs059.html b/doc/pub/week36/html/._week36-bs059.html
index 69da68999..eaa1a7b4a 100644
--- a/doc/pub/week36/html/._week36-bs059.html
+++ b/doc/pub/week36/html/._week36-bs059.html
@@ -8,8 +8,8 @@ doconce format html week36.do.txt --html_style=bootstrap --pygments_html_style=d
-
-Week 36: Statistical interpretation of Linear Regression and Resampling techniques
+
+Week 36: Linear Regression and Gradient descent
@@ -37,29 +37,144 @@ doconce format html week36.do.txt --html_style=bootstrap --pygments_html_style=d
@@ -218,7 +251,7 @@ MathJax.Hub.Config({
- Week 36: Statistical interpretation of Linear Regression and Resampling techniques
+ Week 36: Linear Regression and Gradient descent
To derive the Lasso cost function, we simply replace the Gaussian prior with an exponential distribution (Laplace in this case) with zero mean value, that is
+
For the sake of simplicity, let us assume that the design matrix is orthonormal, that is
that is the Ridge estimator scales the OLS estimator by the inverse of a factor \( 1+\lambda \), and
+the Ridge estimator converges to zero when the hyperparameter goes to
+infinity.
The assumption we have made is
-that there exists a function \( f(\boldsymbol{x}) \) and a normal distributed error \( \boldsymbol{\varepsilon}\sim \mathcal{N}(0, \sigma^2) \)
-which describes our data
-
We then approximate this function with our model from the solution of the linear regression equations (ordinary least squares OLS), that is our
-function \( f \) is approximated by \( \boldsymbol{\tilde{y}} \) where we minimized \( (\boldsymbol{y}-\boldsymbol{\tilde{y}})^2 \), with
-
Hence, \( y_i \sim \mathcal{N}( \mathbf{X}_{i, \ast} \, \boldsymbol{\beta}, \sigma^2) \), that is \( \boldsymbol{y} \) follows a normal distribution with
-mean value \( \boldsymbol{X}\boldsymbol{\beta} \) and variance \( \sigma^2 \).
+
This exercise is a continuation of the exercises from week 35.
-
-
We will
-use the same function to generate our data set, still staying with a
-simple function \( y(x) \) which we want to fit using linear regression,
-but now extending the analysis to include the Ridge and the Lasso
-regression methods.
-
-
-
We will thus again generate our own dataset for a function \( y(x) \) where
-\( x \in [0,1] \) and defined by random numbers computed with the uniform
-distribution. The function \( y \) is a quadratic polynomial in \( x \) with
-added stochastic noise according to the normal distribution \( \cal{N}(0,1) \).
-
-
-
The following simple Python instructions define our \( x \) and \( y \) values (with 100 data points).
-
-
-
-
-
-
-
-
x = np.random.rand(100)
-y =2.0+5*x*x+0.1*np.random.randn(100)
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-a)
-Write your own code for the Ridge method (see chapter 3.4 of Hastie et al., equations (3.43) and (3.44)) and compute the parametrization for different values of \( \lambda \). Study the dependence on \( \lambda \) while also varying the strength of the noise in your expression for \( y(x) \).
-
-
-
-
-
-
-b)
-Our next step is to study the variance of the parameters \( \beta_1 \) and \( \beta_2 \) (assuming that we are parameterizing our function with a second-order polynomial). We will use standard linear regression and the Ridge regression. You can now opt for either writing your own function or using Scikit-Learn to find the parameters \( \beta \). From your results calculate the variance of these parameters (recall that this is equal to the diagonal elements of the matrix \( (\hat{X}^T\hat{X})+\lambda\hat{I})^{-1} \)). Discuss the results of these variances as functions of \( \lambda \). In particular, try to link your discussion with the discussion in Hastie et al. and their figures 3.10 and 3.11. Scikit-Learn may not provide the variance of the parameters \( \beta \). This needs to be checked. With your own code you can however do so.
-
-
-
-
-
@@ -478,6 +386,18 @@ Our next step is to study the variance of the parameters \( \beta_1 \) and \( \b
-Bootstrapping is a nonparametric approach to statistical inference
-that substitutes computation for more traditional distributional
-assumptions and asymptotic results. Bootstrapping offers a number of
-advantages:
+
Using the matrix-vector expression for Lasso regression, we have the following cost function
-
-
The bootstrap is quite general, although there are some cases in which it fails.
-
Because it does not require distributional assumptions (such as normally distributed errors), the bootstrap can provide more accurate inferences when the data are not well behaved or when the sample size is small.
-
It is possible to apply the bootstrap to statistics with sampling distributions that are difficult to derive, even asymptotically.
-
It is relatively simple to apply the bootstrap to complex data-collection plans (such as stratified and clustered samples).
Taking the derivative with respect to \( \boldsymbol{\theta} \) and recalling that the derivative of the absolute value is (we drop the boldfaced vector symbol for simplicity)
This equation does not lead to a nice analytical equation as in Ridge regression or ordinary least squares. We have absorbed the factor \( 2/n \) in a redefinition of the parameter \( \lambda \). We will solve this type of problems using libraries like scikit-learn and using our own gradient descent code in project 1.
Simple example to illustrate Ordinary Least Squares, Ridge and Lasso Regression
-
Resampling methods: Bootstrap background
+
Let us assume that our design matrix is given by unit (identity) matrix, that is a square diagonal matrix with ones only along the
+diagonal. In this case we have an equal number of rows and columns \( n=p \).
+
+
+
Our model approximation is just \( \tilde{\boldsymbol{y}}=\boldsymbol{\theta} \) and the mean squared error and thereby the cost function for ordinary least sqquares (OLS) is then (we drop the term \( 1/n \))
-Since \( \widehat{\theta} = \widehat{\theta}(\boldsymbol{X}) \) is a function of random variables,
-\( \widehat{\theta} \) itself must be a random variable. Thus it has
-a pdf, call this function \( p(\boldsymbol{t}) \). The aim of the bootstrap is to
-estimate \( p(\boldsymbol{t}) \) by the relative frequency of
-\( \widehat{\theta} \). You can think of this as using a histogram
-in the place of \( p(\boldsymbol{t}) \). If the relative frequency closely
-resembles \( p(\vec{t}) \), then using numerics, it is straight forward to
-estimate all the interesting parameters of \( p(\boldsymbol{t}) \) using point
-estimators.
-
-In the case that \( \widehat{\theta} \) has
-more than one component, and the components are independent, we use the
-same estimator on each component separately. If the probability
-density function of \( X_i \), \( p(x) \), had been known, then it would have
-been straight forward to do this by:
+
Drawing lots of numbers from \( p(x) \), suppose we call one such set of numbers \( (X_1^*, X_2^*, \cdots, X_n^*) \).
-
Then using these numbers, we could compute a replica of \( \widehat{\theta} \) called \( \widehat{\theta}^* \).
-
-By repeated use of (1) and (2), many
-estimates of \( \widehat{\theta} \) could have been obtained. The
-idea is to use the relative frequency of \( \widehat{\theta}^* \)
-(think of a histogram) as an estimate of \( p(\boldsymbol{t}) \).
-
-
@@ -430,29 +379,22 @@ idea is to use the relative frequency of \( \widehat{\theta}^* \)
-But
-unless there is enough information available about the process that
-generated \( X_1,X_2,\cdots,X_n \), \( p(x) \) is in general
-unknown. Therefore, Efron in 1979 asked the
-question: What if we replace \( p(x) \) by the relative frequency
-of the observation \( X_i \); if we draw observations in accordance with
-the relative frequency of the observations, will we obtain the same
-result in some asymptotic sense? The answer is yes.
+
-Instead of generating the histogram for the relative
-frequency of the observation \( X_i \), just draw the values
-\( (X_1^*,X_2^*,\cdots,X_n^*) \) with replacement from the vector
-\( \boldsymbol{X} \).
+
Plotting these results shows clearly that Lasso regression suppresses (sets to zero) values of \( \theta_i \) for specific values of \( \lambda \). Ridge regression reduces on the other hand the values of \( \theta_i \) as function of \( \lambda \).
-
@@ -428,30 +386,21 @@ frequency of the observation \( X_i \), just draw the values
Let us assume we have a data set with outputs/targets given by the vector
-
-The independent bootstrap works like this:
+$$
+\boldsymbol{y}=\begin{bmatrix}4 \\ 2 \\3\end{bmatrix},
+$$
-
-
Draw with replacement \( n \) numbers for the observed variables \( \boldsymbol{x} = (x_1,x_2,\cdots,x_n) \).
-
Define a vector \( \boldsymbol{x}^* \) containing the values which were drawn from \( \boldsymbol{x} \).
-
Using the vector \( \boldsymbol{x}^* \) compute \( \widehat{\theta}^* \) by evaluating \( \widehat \theta \) under the observations \( \boldsymbol{x}^* \).
-
Repeat this process \( k \) times.
-
+
and our inputs as a \( 3\times 2 \) design matrix
+$$
+\boldsymbol{X}=\begin{bmatrix}2 & 0\\ 0 & 1 \\ 0 & 0\end{bmatrix},
+$$
-When you are done, you can draw a histogram of the relative frequency
-of \( \widehat \theta^* \). This is your estimate of the probability
-distribution \( p(t) \). Using this probability distribution you can
-estimate any statistics thereof. In principle you never draw the
-histogram of the relative frequency of \( \widehat{\theta}^* \). Instead
-you use the estimators corresponding to the statistic of interest. For
-example, if you are interested in estimating the variance of \( \widehat
-\theta \), apply the etsimator \( \widehat \sigma^2 \) to the values
-\( \widehat \theta ^* \).
+
meaning that we have two features and two unknown parameters \( \theta_0 \) and \( \theta_1 \) to be determined either by ordinary least squares, Ridge or Lasso regression.
-
@@ -431,31 +379,21 @@ example, if you are interested in estimating the variance of \( \widehat
For ordinary least squares (OLS) we know that the optimal solution is
-
-The following code starts with a Gaussian distribution with mean value
-\( \mu =100 \) and variance \( \sigma=15 \). We use this to generate the data
-used in the bootstrap analysis. The bootstrap analysis returns a data
-set after a given number of bootstrap operations (as many as we have
-data points). This data set consists of estimated mean values for each
-bootstrap operation. The histogram generated by the bootstrap method
-shows that the distribution for these mean values is also a Gaussian,
-centered around the mean value \( \mu=100 \) but with standard deviation
-\( \sigma/\sqrt{n} \), where \( n \) is the number of bootstrap samples (in
-this case the same as the number of original data points). The value
-of the standard deviation is what we expect from the central limit
-theorem.
+$$
+\hat{\boldsymbol{\theta}}^{\mathrm{OLS}}=\left( \boldsymbol{X}^T\boldsymbol{X}\right)^{-1}\boldsymbol{X}^T\boldsymbol{y}.
+$$
-
+
Inserting the above values we obtain that
-
-
fromnumpyimport*
-fromnumpy.randomimport randint, randn
-fromtimeimport time
-importmatplotlib.mlabasmlab
-importmatplotlib.pyplotasplt
+$$
+\hat{\boldsymbol{\theta}}^{\mathrm{OLS}}=\begin{bmatrix}2 \\ 2\end{bmatrix},
+$$
-# Returns mean of bootstrap samples
-defstat(data):
- return mean(data)
+
The code which implements this simpler case is presented after the discussion of Ridge and Lasso.
-# Bootstrap algorithm
-defbootstrap(data, statistic, R):
- t = zeros(R); n =len(data); inds = arange(n); t0 = time()
- # non-parametric bootstrap
- for i inrange(R):
- t[i] = statistic(data[randint(0,n,n)])
-
- # analysis
- print("Runtime: %g sec"% (time()-t0)); print("Bootstrap Statistics :")
- print("original bias std. error")
- print("%8g%8g%14g%15g"% (statistic(data), std(data),mean(t),std(t)))
- return t
-
-
-mu, sigma =100, 15
-datapoints =10000
-x = mu + sigma*random.randn(datapoints)
-# bootstrap returns the data sample
-t = bootstrap(x, stat, datapoints)
-# the histogram of the bootstrapped data
-n, binsboot, patches = plt.hist(t, 50, normed=1, facecolor='red', alpha=0.75)
-
-# add a 'best fit' line
-y = mlab.normpdf( binsboot, mean(t), std(t))
-lt = plt.plot(binsboot, y, 'r--', linewidth=1)
-plt.xlabel('Smarts')
-plt.ylabel('Probability')
-plt.axis([99.5, 100.6, 0, 3.0])
-plt.grid(True)
-
-plt.show()
-
-When the repetitive splitting of the data set is done randomly,
-samples may accidently end up in a fast majority of the splits in
-either training or test set. Such samples may have an unbalanced
-influence on either model building or prediction evaluation. To avoid
-this \( k \)-fold cross-validation structures the data splitting. The
-samples are divided into \( k \) more or less equally sized exhaustive and
-mutually exclusive subsets. In turn (at each split) one of these
-subsets plays the role of the test set while the union of the
-remaining subsets constitutes the training set. Such a splitting
-warrants a balanced representation of each sample in both training and
-test set over the splits. Still the division into the \( k \) subsets
-involves a degree of randomness. This may be fully excluded when
-choosing \( k=n \). This particular case is referred to as leave-one-out
-cross-validation (LOOCV).
+$$
+\hat{\boldsymbol{\theta}}^{\mathrm{Ridge}}=\left( \boldsymbol{X}^T\boldsymbol{X}+\lambda\boldsymbol{I}\right)^{-1}\boldsymbol{X}^T\boldsymbol{y}.
+$$
+
+
There is normally a constraint on the value of \( \vert\vert \boldsymbol{\theta}\vert\vert_2 \) via the parameter \( \lambda \).
+Let us for simplicity assume that \( \theta_0^2+\theta_1^2=1 \) as constraint. This will allow us to find an expression for the optimal values of \( \theta \) and \( \lambda \).
+
+
+
To see this, let us write the cost function for Ridge regression.
How to set up the cross-validation for Ridge and/or Lasso
-
-
-
Define a range of interest for the penalty parameter.
-
Divide the data set into training and test set comprising samples \( \{1, \ldots, n\} \setminus i \) and \( \{ i \} \), respectively.
-
Fit the linear regression model by means of ridge estimation for each \( \lambda \) in the grid using the training set, and the corresponding estimate of the error variance \( \boldsymbol{\sigma}_{-i}^2(\lambda) \), as
-
+
+
Writing the Cost Function
+
We define the MSE without the \( 1/n \) factor and have then, using that
Evaluate the prediction performance of these models on the test set by \( \log\{L[y_i, \boldsymbol{X}_{i, \ast}; \boldsymbol{\beta}_{-i}(\lambda), \boldsymbol{\sigma}_{-i}^2(\lambda)]\} \). Or, by the prediction error \( |y_i - \boldsymbol{X}_{i, \ast} \boldsymbol{\beta}_{-i}(\lambda)| \), the relative error, the error squared or the R2 score function.
-
Repeat the first three steps such that each sample plays the role of the test set once.
-
Average the prediction performances of the test sets at each grid point of the penalty bias/parameter. It is an estimate of the prediction performance of the model corresponding to this value of the penalty parameter on novel data. It is defined as
For Lasso we need now, keeping a constraint on \( \vert\theta_0\vert+\vert\theta_1\vert=1 \), to take the derivative of the absolute values of \( \theta_0 \)
+and \( \theta_1 \). This gives us the following derivatives of the cost function
+
-For the various values of \( k \)
+$$
+\frac{\partial C(\boldsymbol{\theta})}{\partial \theta_0}=-4(4-2\theta_0)+\lambda\mathrm{sgn}(\theta_0)=0,
+$$
+
+
-# A seed just to ensure that the random numbers are the same for every run.
-# Useful for eventual debugging.
-np.random.seed(3155)
+$$
+\theta_0=\frac{16+\lambda}{8},
+$$
-# Generate the data.
-nsamples =100
-x = np.random.randn(nsamples)
-y =3*x**2+ np.random.randn(nsamples)
+
and
+$$
+\theta_1=\frac{4+\lambda}{2}.
+$$
-## Cross-validation on Ridge regression using KFold only
+
Using the constraint on \( \theta_0 \) and \( \theta_1 \) we can then find the optimal value of \( \lambda \) for the different cases. We leave this as an exercise to you.
-# Decide degree on polynomial to fit
-poly = PolynomialFeatures(degree =6)
-
-# Decide which values of lambda to use
-nlambdas =500
-lambdas = np.logspace(-3, 5, nlambdas)
-
-# Initialize a KFold instance
-k =5
-kfold = KFold(n_splits = k)
-
-# Perform the cross-validation to estimate MSE
-scores_KFold = np.zeros((nlambdas, k))
-
-i =0
-for lmb in lambdas:
- ridge = Ridge(alpha = lmb)
- j =0
- for train_inds, test_inds in kfold.split(x):
- xtrain = x[train_inds]
- ytrain = y[train_inds]
-
- xtest = x[test_inds]
- ytest = y[test_inds]
-
- Xtrain = poly.fit_transform(xtrain[:, np.newaxis])
- ridge.fit(Xtrain, ytrain[:, np.newaxis])
-
- Xtest = poly.fit_transform(xtest[:, np.newaxis])
- ypred = ridge.predict(Xtest)
-
- scores_KFold[i,j] = np.sum((ypred - ytest[:, np.newaxis])**2)/np.size(ypred)
-
- j +=1
- i +=1
-
-
-estimated_mse_KFold = np.mean(scores_KFold, axis =1)
-
-## Cross-validation using cross_val_score from sklearn along with KFold
-
-# kfold is an instance initialized above as:
-# kfold = KFold(n_splits = k)
-
-estimated_mse_sklearn = np.zeros(nlambdas)
-i =0
-for lmb in lambdas:
- ridge = Ridge(alpha = lmb)
-
- X = poly.fit_transform(x[:, np.newaxis])
- estimated_mse_folds = cross_val_score(ridge, X, y[:, np.newaxis], scoring='neg_mean_squared_error', cv=kfold)
-
- # cross_val_score return an array containing the estimated negative mse for every fold.
- # we have to the the mean of every array in order to get an estimate of the mse of the model
- estimated_mse_sklearn[i] = np.mean(-estimated_mse_folds)
-
- i +=1
-
-## Plot and compare the slightly different ways to perform cross-validation
-
-plt.figure()
-
-plt.plot(np.log10(lambdas), estimated_mse_sklearn, label ='cross_val_score')
-plt.plot(np.log10(lambdas), estimated_mse_KFold, 'r--', label ='KFold')
-
-plt.xlabel('log10(lambda)')
-plt.ylabel('mse')
-
-plt.legend()
-
-plt.show()
-
Here we set up the OLS, Ridge and Lasso functionality in order to study the above example. Note that here we have opted for a set of values of \( \lambda \), meaning that we need to perform a search in order to find the optimal values.
-
-We will discuss the bias-variance tradeoff in the context of
-continuous predictions such as regression. However, many of the
-intuitions and ideas discussed here also carry over to classification
-tasks. Consider a dataset \( \mathcal{L} \) consisting of the data
-\( \mathbf{X}_\mathcal{L}=\{(y_j, \boldsymbol{x}_j), j=0\ldots n-1\} \).
+
First we study and compare the OLS and Ridge results. The next code compares all three methods.
-
-Let us assume that the true data is generated from a noisy model
-$$
-\boldsymbol{y}=f(\boldsymbol{x}) + \boldsymbol{\epsilon}
-$$
+
+
-where \( \epsilon \) is normally distributed with mean zero and standard deviation \( \sigma^2 \).
+defR2(y_data, y_model):
+ return1- np.sum((y_data - y_model) **2) / np.sum((y_data - np.mean(y_data)) **2)
+defMSE(y_data,y_model):
+ n = np.size(y_model)
+ return np.sum((y_data-y_model)**2)/n
-
-In our derivation of the ordinary least squares method we defined then
-an approximation to the function \( f \) in terms of the parameters
-\( \boldsymbol{\beta} \) and the design matrix \( \boldsymbol{X} \) which embody our model,
-that is \( \boldsymbol{\tilde{y}}=\boldsymbol{X}\boldsymbol{\beta} \).
-
-Thereafter we found the parameters \( \boldsymbol{\beta} \) by optimizing the means squared error via the so-called cost function
-$$
-C(\boldsymbol{X},\boldsymbol{\beta}) =\frac{1}{n}\sum_{i=0}^{n-1}(y_i-\tilde{y}_i)^2=\mathbb{E}\left[(\boldsymbol{y}-\boldsymbol{\tilde{y}})^2\right].
-$$
+# A seed just to ensure that the random numbers are the same for every run.
+# Useful for eventual debugging.
-
-We can rewrite this as
-$$
-\mathbb{E}\left[(\boldsymbol{y}-\boldsymbol{\tilde{y}})^2\right]=\frac{1}{n}\sum_i(f_i-\mathbb{E}\left[\boldsymbol{\tilde{y}}\right])^2+\frac{1}{n}\sum_i(\tilde{y}_i-\mathbb{E}\left[\boldsymbol{\tilde{y}}\right])^2+\sigma^2.
-$$
+X = np.array( [ [ 2, 0], [0, 1], [0,0]])
+y = np.array( [4, 2, 3])
-
-The three terms represent the square of the bias of the learning
-method, which can be thought of as the error caused by the simplifying
-assumptions built into the method. The second term represents the
-variance of the chosen model and finally the last terms is variance of
-the error \( \boldsymbol{\epsilon} \).
-
-To derive this equation, we need to recall that the variance of \( \boldsymbol{y} \) and \( \boldsymbol{\epsilon} \) are both equal to \( \sigma^2 \). The mean value of \( \boldsymbol{\epsilon} \) is by definition equal to zero. Furthermore, the function \( f \) is not a stochastics variable, idem for \( \boldsymbol{\tilde{y}} \).
-We use a more compact notation in terms of the expectation value
-$$
-\mathbb{E}\left[(\boldsymbol{y}-\boldsymbol{\tilde{y}})^2\right]=\mathbb{E}\left[(\boldsymbol{f}+\boldsymbol{\epsilon}-\boldsymbol{\tilde{y}})^2\right],
-$$
+# matrix inversion to find beta
+OLSbeta = np.linalg.inv(X.T @ X) @ X.T @ y
+print(OLSbeta)
+# and then make the prediction
+ytildeOLS = X @ OLSbeta
+print("Training MSE for OLS")
+print(MSE(y,ytildeOLS))
+ypredictOLS = X @ OLSbeta
-and adding and subtracting \( \mathbb{E}\left[\boldsymbol{\tilde{y}}\right] \) we get
-$$
-\mathbb{E}\left[(\boldsymbol{y}-\boldsymbol{\tilde{y}})^2\right]=\mathbb{E}\left[(\boldsymbol{f}+\boldsymbol{\epsilon}-\boldsymbol{\tilde{y}}+\mathbb{E}\left[\boldsymbol{\tilde{y}}\right]-\mathbb{E}\left[\boldsymbol{\tilde{y}}\right])^2\right],
-$$
+# Repeat now for Ridge regression and various values of the regularization parameter
+I = np.eye(2,2)
+# Decide which values of lambda to use
+nlambdas =100
+MSEPredict = np.zeros(nlambdas)
+lambdas = np.logspace(-4, 4, nlambdas)
+for i inrange(nlambdas):
+ lmb = lambdas[i]
+ Ridgebeta = np.linalg.inv(X.T @ X+lmb*I) @ X.T @ y
+# print(Ridgebeta)
+ # and then make the prediction
+ ypredictRidge = X @ Ridgebeta
+ MSEPredict[i] = MSE(y,ypredictRidge)
+# print(MSEPredict[i])
+ # Now plot the results
+plt.figure()
+plt.plot(np.log10(lambdas), MSEPredict, 'r--', label ='MSE Ridge Train')
+plt.xlabel('log10(lambda)')
+plt.ylabel('MSE')
+plt.legend()
+plt.show()
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-which, using the abovementioned expectation values can be rewritten as
-$$
-\mathbb{E}\left[(\boldsymbol{y}-\boldsymbol{\tilde{y}})^2\right]=\mathbb{E}\left[(\boldsymbol{y}-\mathbb{E}\left[\boldsymbol{\tilde{y}}\right])^2\right]+\mathrm{Var}\left[\boldsymbol{\tilde{y}}\right]+\sigma^2,
-$$
+
We see here that we reach a plateau. What is actually happening?
-that is the rewriting in terms of the so-called bias, the variance of the model \( \boldsymbol{\tilde{y}} \) and the variance of \( \boldsymbol{\epsilon} \).
-
-
@@ -466,33 +437,21 @@ that is the rewriting in terms of the so-called bias, the variance of the model
importosimportnumpyasnp
-fromsklearn.linear_modelimport LinearRegression, Ridge, Lasso
-fromsklearn.preprocessingimport PolynomialFeatures
-fromsklearn.model_selectionimport train_test_split
-fromsklearn.pipelineimport make_pipeline
-fromsklearn.utilsimport resample
+importpandasaspd
+importmatplotlib.pyplotasplt
+fromsklearnimport linear_model
-np.random.seed(2018)
+defR2(y_data, y_model):
+ return1- np.sum((y_data - y_model) **2) / np.sum((y_data - np.mean(y_data)) **2)
+defMSE(y_data,y_model):
+ n = np.size(y_model)
+ return np.sum((y_data-y_model)**2)/n
-n =500
-n_boostraps =100
-degree =18# A quite high value, just to show.
-noise =0.1
-# Make data set.
-x = np.linspace(-1, 3, n).reshape(-1, 1)
-y = np.exp(-x**2) +1.5* np.exp(-(x-2)**2) + np.random.normal(0, 0.1, x.shape)
+# A seed just to ensure that the random numbers are the same for every run.
+# Useful for eventual debugging.
-# Hold out some test data that is never used in training.
-x_train, x_test, y_train, y_test = train_test_split(x, y, test_size=0.2)
+X = np.array( [ [ 2, 0], [0, 1], [0,0]])
+y = np.array( [4, 2, 3])
-# Combine x transformation and model into one operation.
-# Not neccesary, but convenient.
-model = make_pipeline(PolynomialFeatures(degree=degree), LinearRegression(fit_intercept=False))
-# The following (m x n_bootstraps) matrix holds the column vectors y_pred
-# for each bootstrap iteration.
-y_pred = np.empty((y_test.shape[0], n_boostraps))
-for i inrange(n_boostraps):
- x_, y_ = resample(x_train, y_train)
+# matrix inversion to find beta
+OLSbeta = np.linalg.inv(X.T @ X) @ X.T @ y
+print(OLSbeta)
+# and then make the prediction
+ytildeOLS = X @ OLSbeta
+print("Training MSE for OLS")
+print(MSE(y,ytildeOLS))
+ypredictOLS = X @ OLSbeta
- # Evaluate the new model on the same test data each time.
- y_pred[:, i] = model.fit(x_, y_).predict(x_test).ravel()
-
-# Note: Expectations and variances taken w.r.t. different training
-# data sets, hence the axis=1. Subsequent means are taken across the test data
-# set in order to obtain a total value, but before this we have error/bias/variance
-# calculated per data point in the test set.
-# Note 2: The use of keepdims=True is important in the calculation of bias as this
-# maintains the column vector form. Dropping this yields very unexpected results.
-error = np.mean( np.mean((y_test - y_pred)**2, axis=1, keepdims=True) )
-bias = np.mean( (y_test - np.mean(y_pred, axis=1, keepdims=True))**2 )
-variance = np.mean( np.var(y_pred, axis=1, keepdims=True) )
-print('Error:', error)
-print('Bias^2:', bias)
-print('Var:', variance)
-print('{} >= {} + {} = {}'.format(error, bias, variance, bias+variance))
-
-plt.plot(x[::5, :], y[::5, :], label='f(x)')
-plt.scatter(x_test, y_test, label='Data points')
-plt.scatter(x_test, np.mean(y_pred, axis=1), label='Pred')
+# Repeat now for Ridge regression and various values of the regularization parameter
+I = np.eye(2,2)
+# Decide which values of lambda to use
+nlambdas =100
+MSERidgePredict = np.zeros(nlambdas)
+MSELassoPredict = np.zeros(nlambdas)
+lambdas = np.logspace(-4, 4, nlambdas)
+for i inrange(nlambdas):
+ lmb = lambdas[i]
+ Ridgebeta = np.linalg.inv(X.T @ X+lmb*I) @ X.T @ y
+ print(Ridgebeta)
+ # and then make the prediction
+ ypredictRidge = X @ Ridgebeta
+ MSERidgePredict[i] = MSE(y,ypredictRidge)
+ RegLasso = linear_model.Lasso(lmb,fit_intercept=False)
+ RegLasso.fit(X,y)
+ ypredictLasso = RegLasso.predict(X)
+ print(RegLasso.coef_)
+ MSELassoPredict[i] = MSE(y,ypredictLasso)
+# Now plot the results
+plt.figure()
+plt.plot(np.log10(lambdas), MSERidgePredict, 'r--', label ='MSE Ridge Train')
+plt.plot(np.log10(lambdas), MSELassoPredict, 'r--', label ='MSE Lasso Train')
+plt.xlabel('log10(lambda)')
+plt.ylabel('MSE')
plt.legend()
plt.show()
-
This equation does not lead to a nice analytical equation as in either Ridge regression or ordinary least squares. This equation can however be solved by using standard convex optimization algorithms.We will discuss how to code the above methods using gardient descent methods.
+
This equation does not lead to a nice analytical equation as in either Ridge regression or ordinary least squares. This equation can however be solved by using standard convex optimization algorithms.We will discuss how to code the above methods using gradient descent methods.
+
+
+
+
Optimization and gradient descent, the central part of any Machine Learning algortithm
+
+
Almost every problem in machine learning and data science starts with
+a dataset \( X \), a model \( g(\theta) \), which is a function of the
+parameters \( \theta \) and a cost function \( C(X, g(\theta)) \) that allows
+us to judge how well the model \( g(\theta) \) explains the observations
+\( X \). The model is fit by finding the values of \( \theta \) that minimize
+the cost function. Ideally we would be able to solve for \( \theta \)
+analytically, however this is not possible in general and we must use
+some approximative/numerical method to compute the minimum.
+
+
+
+
+
Reminder on Newton-Raphson's method
+
+
Let us quickly remind ourselves how we derive the above method.
+
+
Perhaps the most celebrated of all one-dimensional root-finding
+routines is Newton's method, also called the Newton-Raphson
+method. This method requires the evaluation of both the
+function \( f \) and its derivative \( f' \) at arbitrary points.
+If you can only calculate the derivative
+numerically and/or your function is not of the smooth type, we
+normally discourage the use of this method.
+
+
+
+
+
The equations
+
+
The Newton-Raphson formula consists geometrically of extending the
+tangent line at a current point until it crosses zero, then setting
+the next guess to the abscissa of that zero-crossing. The mathematics
+behind this method is rather simple. Employing a Taylor expansion for
+\( x \) sufficiently close to the solution \( s \), we have
+
For small enough values of the function and for well-behaved
+functions, the terms beyond linear are unimportant, hence we obtain
+
+
+
+$$
+ f(x)+(s-x)f'(x)\approx 0,
+$$
+
+
+
yielding
+
+$$
+ s\approx x-\frac{f(x)}{f'(x)}.
+$$
+
+
+
Having in mind an iterative procedure, it is natural to start iterating with
+
+$$
+ x_{n+1}=x_n-\frac{f(x_n)}{f'(x_n)}.
+$$
+
+
+
+
+
Simple geometric interpretation
+
+
The above is Newton-Raphson's method. It has a simple geometric
+interpretation, namely \( x_{n+1} \) is the point where the tangent from
+\( (x_n,f(x_n)) \) crosses the \( x \)-axis. Close to the solution,
+Newton-Raphson converges fast to the desired result. However, if we
+are far from a root, where the higher-order terms in the series are
+important, the Newton-Raphson formula can give grossly inaccurate
+results. For instance, the initial guess for the root might be so far
+from the true root as to let the search interval include a local
+maximum or minimum of the function. If an iteration places a trial
+guess near such a local extremum, so that the first derivative nearly
+vanishes, then Newton-Raphson may fail totally
+
+
+
+
+
Extending to more than one variable
+
+
Newton's method can be generalized to systems of several non-linear equations
+and variables. Consider the case with two equations
+
We need thus to compute the inverse of the Jacobian matrix and it
+is to understand that difficulties may
+arise in case \( {\bf \boldsymbol{J}} \) is nearly singular.
+
+
+
It is rather straightforward to extend the above scheme to systems of
+more than two non-linear equations. In our case, the Jacobian matrix is given by the Hessian that represents the second derivative of cost function.
+
+
+
+
+
Steepest descent
+
+
The basic idea of gradient descent is
+that a function \( F(\mathbf{x}) \),
+\( \mathbf{x} \equiv (x_1,\cdots,x_n) \), decreases fastest if one goes from \( \bf {x} \) in the
+direction of the negative gradient \( -\nabla F(\mathbf{x}) \).
+
For \( \gamma_k \) small enough, then \( F(\mathbf{x}_{k+1}) \leq
+F(\mathbf{x}_k) \). This means that for a sufficiently small \( \gamma_k \)
+we are always moving towards smaller function values, i.e a minimum.
+
+
+
+
+
More on Steepest descent
+
+
The previous observation is the basis of the method of steepest
+descent, which is also referred to as just gradient descent (GD). One
+starts with an initial guess \( \mathbf{x}_0 \) for a minimum of \( F \) and
+computes new approximations according to
+
The parameter \( \gamma_k \) is often referred to as the step length or
+the learning rate within the context of Machine Learning.
+
+
+
+
+
The ideal
+
+
Ideally the sequence \( \{\mathbf{x}_k \}_{k=0} \) converges to a global
+minimum of the function \( F \). In general we do not know if we are in a
+global or local minimum. In the special case when \( F \) is a convex
+function, all local minima are also global minima, so in this case
+gradient descent can converge to the global solution. The advantage of
+this scheme is that it is conceptually simple and straightforward to
+implement. However the method in this form has some severe
+limitations:
+
+
+
In machine learing we are often faced with non-convex high dimensional
+cost functions with many local minima. Since GD is deterministic we
+will get stuck in a local minimum, if the method converges, unless we
+have a very good intial guess. This also implies that the scheme is
+sensitive to the chosen initial condition.
+
+
+
Note that the gradient is a function of \( \mathbf{x} =
+(x_1,\cdots,x_n) \) which makes it expensive to compute numerically.
+
+
+
+
+
The sensitiveness of the gradient descent
+
+
The gradient descent method
+is sensitive to the choice of learning rate \( \gamma_k \). This is due
+to the fact that we are only guaranteed that \( F(\mathbf{x}_{k+1}) \leq
+F(\mathbf{x}_k) \) for sufficiently small \( \gamma_k \). The problem is to
+determine an optimal learning rate. If the learning rate is chosen too
+small the method will take a long time to converge and if it is too
+large we can experience erratic behavior.
+
+
+
Many of these shortcomings can be alleviated by introducing
+randomness. One such method is that of Stochastic Gradient Descent
+(SGD), to be discussed next week.
+
+
+
+
+
Convex functions
+
+
Ideally we want our cost/loss function to be convex(concave).
+
+
First we give the definition of a convex set: A set \( C \) in
+\( \mathbb{R}^n \) is said to be convex if, for all \( x \) and \( y \) in \( C \) and
+all \( t \in (0,1) \) , the point \( (1 − t)x + ty \) also belongs to
+C. Geometrically this means that every point on the line segment
+connecting \( x \) and \( y \) is in \( C \) as discussed below.
+
+
+
The convex subsets of \( \mathbb{R} \) are the intervals of
+\( \mathbb{R} \). Examples of convex sets of \( \mathbb{R}^2 \) are the
+regular polygons (triangles, rectangles, pentagons, etc...).
+
+
+
+
+
Convex function
+
+
Convex function: Let \( X \subset \mathbb{R}^n \) be a convex set. Assume that the function \( f: X \rightarrow \mathbb{R} \) is continuous, then \( f \) is said to be convex if
for all \( x_1, x_2 \in X \) and for all \( t \in [0,1] \). If \( \leq \) is replaced with a strict inequaltiy in the definition, we demand \( x_1 \neq x_2 \) and \( t\in(0,1) \) then \( f \) is said to be strictly convex. For a single variable function, convexity means that if you draw a straight line connecting \( f(x_1) \) and \( f(x_2) \), the value of the function on the interval \( [x_1,x_2] \) is always below the line as illustrated below.
+
+
+
+
Conditions on convex functions
+
+
In the following we state first and second-order conditions which
+ensures convexity of a function \( f \). We write \( D_f \) to denote the
+domain of \( f \), i.e the subset of \( R^n \) where \( f \) is defined. For more
+details and proofs we refer to: S. Boyd and L. Vandenberghe. Convex Optimization. Cambridge University Press.
+
+
+
+First order condition
+
+
Suppose \( f \) is differentiable (i.e \( \nabla f(x) \) is well defined for
+all \( x \) in the domain of \( f \)). Then \( f \) is convex if and only if \( D_f \)
+is a convex set and
+$$f(y) \geq f(x) + \nabla f(x)^T (y-x) $$
+
holds
+for all \( x,y \in D_f \). This condition means that for a convex function
+the first order Taylor expansion (right hand side above) at any point
+a global under estimator of the function. To convince yourself you can
+make a drawing of \( f(x) = x^2+1 \) and draw the tangent line to \( f(x) \) and
+note that it is always below the graph.
+
+
+
+
+
+Second order condition
+
+
Assume that \( f \) is twice
+differentiable, i.e the Hessian matrix exists at each point in
+\( D_f \). Then \( f \) is convex if and only if \( D_f \) is a convex set and its
+Hessian is positive semi-definite for all \( x\in D_f \). For a
+single-variable function this reduces to \( f''(x) \geq 0 \). Geometrically this means that \( f \) has nonnegative curvature
+everywhere.
+
+
+
+
This condition is particularly useful since it gives us an procedure for determining if the function under consideration is convex, apart from using the definition.
+
+
+
+
More on convex functions
+
+
The next result is of great importance to us and the reason why we are
+going on about convex functions. In machine learning we frequently
+have to minimize a loss/cost function in order to find the best
+parameters for the model we are considering.
+
+
+
Ideally we want the
+global minimum (for high-dimensional models it is hard to know
+if we have local or global minimum). However, if the cost/loss function
+is convex the following result provides invaluable information:
+
+
+
+Any minimum is global for convex functions
+
+
Consider the problem of finding \( x \in \mathbb{R}^n \) such that \( f(x) \)
+is minimal, where \( f \) is convex and differentiable. Then, any point
+\( x^* \) that satisfies \( \nabla f(x^*) = 0 \) is a global minimum.
+
+
+
+
This result means that if we know that the cost/loss function is convex and we are able to find a minimum, we are guaranteed that it is a global minimum.
+
+
+
+
Some simple problems
+
+
+
Show that \( f(x)=x^2 \) is convex for \( x \in \mathbb{R} \) using the definition of convexity. Hint: If you re-write the definition, \( f \) is convex if the following holds for all \( x,y \in D_f \) and any \( \lambda \in [0,1] \) $\lambda f(x)+(1-\lambda)f(y)-f(\lambda x + (1-\lambda) y ) \geq 0$.
+
Using the second order condition show that the following functions are convex on the specified domain.
+
+
\( f(x) = e^x \) is convex for \( x \in \mathbb{R} \).
+
\( g(x) = -\ln(x) \) is convex for \( x \in (0,\infty) \).
+
+
+
Let \( f(x) = x^2 \) and \( g(x) = e^x \). Show that \( f(g(x)) \) and \( g(f(x)) \) is convex for \( x \in \mathbb{R} \). Also show that if \( f(x) \) is any convex function than \( h(x) = e^{f(x)} \) is convex.
+
A norm is any function that satisfy the following properties
+
+
\( f(\alpha x) = |\alpha| f(x) \) for all \( \alpha \in \mathbb{R} \).
+
\( f(x+y) \leq f(x) + f(y) \)
+
\( f(x) \leq 0 \) for all \( x \in \mathbb{R}^n \) with equality if and only if \( x = 0 \)
+
+
+
+
+
Using the definition of convexity, try to show that a function satisfying the properties above is convex (the third condition is not needed to show this).
+
+
+
+
Revisiting Ordinary Least Squares
+
+
We will use linear regression as a case study for the gradient descent
+methods. Linear regression is a great test case for the gradient
+descent methods discussed in the lectures since it has several
+desirable properties such as:
+
+
+
+
An analytical solution (recall homework sets for week 35).
+
The gradient can be computed analytically.
+
The cost function is convex which guarantees that gradient descent converges for small enough learning rates
+
+
+
We revisit an example similar to what we had in the first homework set. We had a function of the type
+
+
+
+
+
+
+
+
+
x = 2*np.random.rand(m,1)
+y = 4+3*x+np.random.randn(m,1)
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
with \( x_i \in [0,1] \) is chosen randomly using a uniform distribution. Additionally we have a stochastic noise chosen according to a normal distribution \( \cal {N}(0,1) \).
+The linear regression model is given by
+
Let \( \mathbf{y} = (y_1,\cdots,y_n)^T \), \( \mathbf{\boldsymbol{y}} = (\boldsymbol{y}_1,\cdots,\boldsymbol{y}_n)^T \) and \( \theta = (\theta_0, \theta_1)^T \)
+
+
It is convenient to write \( \mathbf{\boldsymbol{y}} = X\theta \) where \( X \in \mathbb{R}^{100 \times 2} \) is the design matrix given by (we keep the intercept here)
and we want to find \( \theta \) such that \( C(\theta) \) is minimized.
+
+
+
+
The derivative of the cost/loss function
+
+
Computing \( \partial C(\theta) / \partial \theta_0 \) and \( \partial C(\theta) / \partial \theta_1 \) we can show that the gradient can be written as
We can use the expression we computed for the gradient and let use a
+\( \theta_0 \) be chosen randomly and let \( \gamma = 0.001 \). Stop iterating
+when \( ||\nabla_\theta C(\theta_k) || \leq \epsilon = 10^{-8} \). Note that the code below does not include the latter stop criterion.
+
+
+
And finally we can compare our solution for \( \theta \) with the analytic result given by
+\( \theta= (X^TX)^{-1} X^T \mathbf{y} \).
+
This implies that the Hessian matrix is positive definite, hence the stationary point is a
+minimum.
+Note that the Ridge cost function is convex being a sum of two convex
+functions. Therefore, the stationary point is a global
+minimum of this function.
+
+
+
+
+
Program example for gradient descent with Ridge Regression
Gradient descent (GD) finds local minima of our function. Since the GD algorithm is deterministic, if it converges, it will converge to a local minimum of our cost/loss/risk function. Because in ML we are often dealing with extremely rugged landscapes with many local minima, this can lead to poor performance.
+
GD is sensitive to initial conditions. One consequence of the local nature of GD is that initial conditions matter. Depending on where one starts, one will end up at a different local minima. Therefore, it is very important to think about how one initializes the training process. This is true for GD as well as more complicated variants of GD.
+
Gradients are computationally expensive to calculate for large datasets. In many cases in statistics and ML, the cost/loss/risk function is a sum of terms, with one term for each data point. For example, in linear regression, \( E \propto \sum_{i=1}^n (y_i - \mathbf{w}^T\cdot\mathbf{x}_i)^2 \); for logistic regression, the square error is replaced by the cross entropy. To calculate the gradient we have to sum over all \( n \) data points. Doing this at every GD step becomes extremely computationally expensive. An ingenious solution to this, is to calculate the gradients using small subsets of the data called "mini batches". This has the added benefit of introducing stochasticity into our algorithm.
+
GD is very sensitive to choices of learning rates. GD is extremely sensitive to the choice of learning rates. If the learning rate is very small, the training process take an extremely long time. For larger learning rates, GD can diverge and give poor results. Furthermore, depending on what the local landscape looks like, we have to modify the learning rates to ensure convergence. Ideally, we would adaptively choose the learning rates to match the landscape.
+
GD treats all directions in parameter space uniformly. Another major drawback of GD is that unlike Newton's method, the learning rate for GD is the same in all directions in parameter space. For this reason, the maximum learning rate is set by the behavior of the steepest direction and this can significantly slow down training. Ideally, we would like to take large steps in flat directions and small steps in steep directions. Since we are exploring rugged landscapes where curvatures change, this requires us to keep track of not only the gradient but second derivatives. The ideal scenario would be to calculate the Hessian but this proves to be too computationally expensive.
+
GD can take exponential time to escape saddle points, even with random initialization. As we mentioned, GD is extremely sensitive to initial condition since it determines the particular local minimum GD would eventually reach. However, even with a good initialization scheme, through the introduction of randomness, GD can still take exponential time to escape saddle points.
+
@@ -1379,15 +2121,15 @@ our optimization problem is
By minimizing the above equation with respect to the parameters
-\( \boldsymbol{\beta} \) we could then obtain an analytical expression for the
-parameters \( \boldsymbol{\beta} \). We can add a regularization parameter \( \lambda \) by
+\( \boldsymbol{\theta} \) we could then obtain an analytical expression for the
+parameters \( \boldsymbol{\theta} \). We can add a regularization parameter \( \lambda \) by
defining a new cost function to be optimized, that is
which leads to the Ridge regression minimization problem where we
-require that \( \vert\vert \boldsymbol{\beta}\vert\vert_2^2\le t \), where \( t \) is
+require that \( \vert\vert \boldsymbol{\theta}\vert\vert_2^2\le t \), where \( t \) is
a finite number larger than zero. We do not include such a constraints in the discussions here.
@@ -1424,15 +2166,15 @@ a finite number larger than zero. We do not include such a constraints in the di
and
-taking the derivatives with respect to \( \boldsymbol{\beta} \) we obtain then
+taking the derivatives with respect to \( \boldsymbol{\theta} \) we obtain then
a slightly modified matrix inversion problem which for finite values
of \( \lambda \) does not suffer from singularity problems. We obtain
the optimal parameters
Note well that a library like Scikit-Learn does not include the \( 1/n \) factor in the expression for the mean-squared error. If you include it, the optimal parameter \( \beta \) becomes
+
Note well that a library like Scikit-Learn does not include the \( 1/n \) factor in the expression for the mean-squared error. If you include it, the optimal parameter \( \theta \) becomes
@@ -1509,7 +2251,7 @@ $$
modified diagonal term added to \( \boldsymbol{X}^T\boldsymbol{X} \). The consequences, in
particular for our discussion of the bias-variance tradeoff are rather
interesting. We will see that for specific values of \( \lambda \), we may
-even reduce the variance of the optimal parameters \( \boldsymbol{\beta} \). These topics and other related ones, will be discussed after the more linear algebra oriented analysis here.
+even reduce the variance of the optimal parameters \( \boldsymbol{\theta} \). These topics and other related ones, will be discussed after the more linear algebra oriented analysis here.
@@ -1521,7 +2263,7 @@ We have already analyzed the OLS solutions in terms of the eigenvectors (the col
This equation does not lead to a nice analytical equation as in either Ridge regression or ordinary least squares. This equation can however be solved by using standard convex optimization algorithms.We will discuss how to code the above methods using gardient descent methods.
+
This equation does not lead to a nice analytical equation as in either Ridge regression or ordinary least squares. This equation can however be solved by using standard convex optimization algorithms.We will discuss how to code the above methods using gradient descent methods.
+
+
Optimization and gradient descent, the central part of any Machine Learning algortithm
+
+
Almost every problem in machine learning and data science starts with
+a dataset \( X \), a model \( g(\theta) \), which is a function of the
+parameters \( \theta \) and a cost function \( C(X, g(\theta)) \) that allows
+us to judge how well the model \( g(\theta) \) explains the observations
+\( X \). The model is fit by finding the values of \( \theta \) that minimize
+the cost function. Ideally we would be able to solve for \( \theta \)
+analytically, however this is not possible in general and we must use
+some approximative/numerical method to compute the minimum.
+
+
+
+
Reminder on Newton-Raphson's method
+
+
Let us quickly remind ourselves how we derive the above method.
+
+
Perhaps the most celebrated of all one-dimensional root-finding
+routines is Newton's method, also called the Newton-Raphson
+method. This method requires the evaluation of both the
+function \( f \) and its derivative \( f' \) at arbitrary points.
+If you can only calculate the derivative
+numerically and/or your function is not of the smooth type, we
+normally discourage the use of this method.
+
+
+
+
The equations
+
+
The Newton-Raphson formula consists geometrically of extending the
+tangent line at a current point until it crosses zero, then setting
+the next guess to the abscissa of that zero-crossing. The mathematics
+behind this method is rather simple. Employing a Taylor expansion for
+\( x \) sufficiently close to the solution \( s \), we have
+
The above is Newton-Raphson's method. It has a simple geometric
+interpretation, namely \( x_{n+1} \) is the point where the tangent from
+\( (x_n,f(x_n)) \) crosses the \( x \)-axis. Close to the solution,
+Newton-Raphson converges fast to the desired result. However, if we
+are far from a root, where the higher-order terms in the series are
+important, the Newton-Raphson formula can give grossly inaccurate
+results. For instance, the initial guess for the root might be so far
+from the true root as to let the search interval include a local
+maximum or minimum of the function. If an iteration places a trial
+guess near such a local extremum, so that the first derivative nearly
+vanishes, then Newton-Raphson may fail totally
+
+
+
+
Extending to more than one variable
+
+
Newton's method can be generalized to systems of several non-linear equations
+and variables. Consider the case with two equations
+
We need thus to compute the inverse of the Jacobian matrix and it
+is to understand that difficulties may
+arise in case \( {\bf \boldsymbol{J}} \) is nearly singular.
+
+
+
It is rather straightforward to extend the above scheme to systems of
+more than two non-linear equations. In our case, the Jacobian matrix is given by the Hessian that represents the second derivative of cost function.
+
+
+
+
Steepest descent
+
+
The basic idea of gradient descent is
+that a function \( F(\mathbf{x}) \),
+\( \mathbf{x} \equiv (x_1,\cdots,x_n) \), decreases fastest if one goes from \( \bf {x} \) in the
+direction of the negative gradient \( -\nabla F(\mathbf{x}) \).
+
For \( \gamma_k \) small enough, then \( F(\mathbf{x}_{k+1}) \leq
+F(\mathbf{x}_k) \). This means that for a sufficiently small \( \gamma_k \)
+we are always moving towards smaller function values, i.e a minimum.
+
+
+
+
More on Steepest descent
+
+
The previous observation is the basis of the method of steepest
+descent, which is also referred to as just gradient descent (GD). One
+starts with an initial guess \( \mathbf{x}_0 \) for a minimum of \( F \) and
+computes new approximations according to
+
The parameter \( \gamma_k \) is often referred to as the step length or
+the learning rate within the context of Machine Learning.
+
+
+
+
The ideal
+
+
Ideally the sequence \( \{\mathbf{x}_k \}_{k=0} \) converges to a global
+minimum of the function \( F \). In general we do not know if we are in a
+global or local minimum. In the special case when \( F \) is a convex
+function, all local minima are also global minima, so in this case
+gradient descent can converge to the global solution. The advantage of
+this scheme is that it is conceptually simple and straightforward to
+implement. However the method in this form has some severe
+limitations:
+
+
+
In machine learing we are often faced with non-convex high dimensional
+cost functions with many local minima. Since GD is deterministic we
+will get stuck in a local minimum, if the method converges, unless we
+have a very good intial guess. This also implies that the scheme is
+sensitive to the chosen initial condition.
+
+
+
Note that the gradient is a function of \( \mathbf{x} =
+(x_1,\cdots,x_n) \) which makes it expensive to compute numerically.
+
+
+
+
The sensitiveness of the gradient descent
+
+
The gradient descent method
+is sensitive to the choice of learning rate \( \gamma_k \). This is due
+to the fact that we are only guaranteed that \( F(\mathbf{x}_{k+1}) \leq
+F(\mathbf{x}_k) \) for sufficiently small \( \gamma_k \). The problem is to
+determine an optimal learning rate. If the learning rate is chosen too
+small the method will take a long time to converge and if it is too
+large we can experience erratic behavior.
+
+
+
Many of these shortcomings can be alleviated by introducing
+randomness. One such method is that of Stochastic Gradient Descent
+(SGD), to be discussed next week.
+
+
+
+
Convex functions
+
+
Ideally we want our cost/loss function to be convex(concave).
+
+
First we give the definition of a convex set: A set \( C \) in
+\( \mathbb{R}^n \) is said to be convex if, for all \( x \) and \( y \) in \( C \) and
+all \( t \in (0,1) \) , the point \( (1 − t)x + ty \) also belongs to
+C. Geometrically this means that every point on the line segment
+connecting \( x \) and \( y \) is in \( C \) as discussed below.
+
+
+
The convex subsets of \( \mathbb{R} \) are the intervals of
+\( \mathbb{R} \). Examples of convex sets of \( \mathbb{R}^2 \) are the
+regular polygons (triangles, rectangles, pentagons, etc...).
+
+
+
+
Convex function
+
+
Convex function: Let \( X \subset \mathbb{R}^n \) be a convex set. Assume that the function \( f: X \rightarrow \mathbb{R} \) is continuous, then \( f \) is said to be convex if $$f(tx_1 + (1-t)x_2) \leq tf(x_1) + (1-t)f(x_2) $$ for all \( x_1, x_2 \in X \) and for all \( t \in [0,1] \). If \( \leq \) is replaced with a strict inequaltiy in the definition, we demand \( x_1 \neq x_2 \) and \( t\in(0,1) \) then \( f \) is said to be strictly convex. For a single variable function, convexity means that if you draw a straight line connecting \( f(x_1) \) and \( f(x_2) \), the value of the function on the interval \( [x_1,x_2] \) is always below the line as illustrated below.
+
+
+
Conditions on convex functions
+
+
In the following we state first and second-order conditions which
+ensures convexity of a function \( f \). We write \( D_f \) to denote the
+domain of \( f \), i.e the subset of \( R^n \) where \( f \) is defined. For more
+details and proofs we refer to: S. Boyd and L. Vandenberghe. Convex Optimization. Cambridge University Press.
+
+
+
+First order condition
+
+
Suppose \( f \) is differentiable (i.e \( \nabla f(x) \) is well defined for
+all \( x \) in the domain of \( f \)). Then \( f \) is convex if and only if \( D_f \)
+is a convex set and $$f(y) \geq f(x) + \nabla f(x)^T (y-x) $$ holds
+for all \( x,y \in D_f \). This condition means that for a convex function
+the first order Taylor expansion (right hand side above) at any point
+a global under estimator of the function. To convince yourself you can
+make a drawing of \( f(x) = x^2+1 \) and draw the tangent line to \( f(x) \) and
+note that it is always below the graph.
+
+
+
+
+
+Second order condition
+
+
Assume that \( f \) is twice
+differentiable, i.e the Hessian matrix exists at each point in
+\( D_f \). Then \( f \) is convex if and only if \( D_f \) is a convex set and its
+Hessian is positive semi-definite for all \( x\in D_f \). For a
+single-variable function this reduces to \( f''(x) \geq 0 \). Geometrically this means that \( f \) has nonnegative curvature
+everywhere.
+
+
+
+
+
This condition is particularly useful since it gives us an procedure for determining if the function under consideration is convex, apart from using the definition.
+
+
+
More on convex functions
+
+
The next result is of great importance to us and the reason why we are
+going on about convex functions. In machine learning we frequently
+have to minimize a loss/cost function in order to find the best
+parameters for the model we are considering.
+
+
+
Ideally we want the
+global minimum (for high-dimensional models it is hard to know
+if we have local or global minimum). However, if the cost/loss function
+is convex the following result provides invaluable information:
+
+
+
+Any minimum is global for convex functions
+
+
Consider the problem of finding \( x \in \mathbb{R}^n \) such that \( f(x) \)
+is minimal, where \( f \) is convex and differentiable. Then, any point
+\( x^* \) that satisfies \( \nabla f(x^*) = 0 \) is a global minimum.
+
+
+
+
+
This result means that if we know that the cost/loss function is convex and we are able to find a minimum, we are guaranteed that it is a global minimum.
+
+
+
Some simple problems
+
+
+
Show that \( f(x)=x^2 \) is convex for \( x \in \mathbb{R} \) using the definition of convexity. Hint: If you re-write the definition, \( f \) is convex if the following holds for all \( x,y \in D_f \) and any \( \lambda \in [0,1] \) $\lambda f(x)+(1-\lambda)f(y)-f(\lambda x + (1-\lambda) y ) \geq 0$.
+
Using the second order condition show that the following functions are convex on the specified domain.
+
+
\( f(x) = e^x \) is convex for \( x \in \mathbb{R} \).
+
\( g(x) = -\ln(x) \) is convex for \( x \in (0,\infty) \).
+
+
Let \( f(x) = x^2 \) and \( g(x) = e^x \). Show that \( f(g(x)) \) and \( g(f(x)) \) is convex for \( x \in \mathbb{R} \). Also show that if \( f(x) \) is any convex function than \( h(x) = e^{f(x)} \) is convex.
+
A norm is any function that satisfy the following properties
+
+
\( f(\alpha x) = |\alpha| f(x) \) for all \( \alpha \in \mathbb{R} \).
+
\( f(x+y) \leq f(x) + f(y) \)
+
\( f(x) \leq 0 \) for all \( x \in \mathbb{R}^n \) with equality if and only if \( x = 0 \)
+
+
+
Using the definition of convexity, try to show that a function satisfying the properties above is convex (the third condition is not needed to show this).
+
+
+
Revisiting Ordinary Least Squares
+
+
We will use linear regression as a case study for the gradient descent
+methods. Linear regression is a great test case for the gradient
+descent methods discussed in the lectures since it has several
+desirable properties such as:
+
+
+
+
An analytical solution (recall homework sets for week 35).
+
The gradient can be computed analytically.
+
The cost function is convex which guarantees that gradient descent converges for small enough learning rates
+
+
We revisit an example similar to what we had in the first homework set. We had a function of the type
+
+
+
+
+
+
+
+
+
x = 2*np.random.rand(m,1)
+y = 4+3*x+np.random.randn(m,1)
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
with \( x_i \in [0,1] \) is chosen randomly using a uniform distribution. Additionally we have a stochastic noise chosen according to a normal distribution \( \cal {N}(0,1) \).
+The linear regression model is given by
+
Let \( \mathbf{y} = (y_1,\cdots,y_n)^T \), \( \mathbf{\boldsymbol{y}} = (\boldsymbol{y}_1,\cdots,\boldsymbol{y}_n)^T \) and \( \theta = (\theta_0, \theta_1)^T \)
+
+
It is convenient to write \( \mathbf{\boldsymbol{y}} = X\theta \) where \( X \in \mathbb{R}^{100 \times 2} \) is the design matrix given by (we keep the intercept here)
and we want to find \( \theta \) such that \( C(\theta) \) is minimized.
+
+
+
The derivative of the cost/loss function
+
+
Computing \( \partial C(\theta) / \partial \theta_0 \) and \( \partial C(\theta) / \partial \theta_1 \) we can show that the gradient can be written as
We can use the expression we computed for the gradient and let use a
+\( \theta_0 \) be chosen randomly and let \( \gamma = 0.001 \). Stop iterating
+when \( ||\nabla_\theta C(\theta_k) || \leq \epsilon = 10^{-8} \). Note that the code below does not include the latter stop criterion.
+
+
+
And finally we can compare our solution for \( \theta \) with the analytic result given by
+\( \theta= (X^TX)^{-1} X^T \mathbf{y} \).
+
This implies that the Hessian matrix is positive definite, hence the stationary point is a
+minimum.
+Note that the Ridge cost function is convex being a sum of two convex
+functions. Therefore, the stationary point is a global
+minimum of this function.
+
+
+
+
Program example for gradient descent with Ridge Regression
Gradient descent (GD) finds local minima of our function. Since the GD algorithm is deterministic, if it converges, it will converge to a local minimum of our cost/loss/risk function. Because in ML we are often dealing with extremely rugged landscapes with many local minima, this can lead to poor performance.
+
GD is sensitive to initial conditions. One consequence of the local nature of GD is that initial conditions matter. Depending on where one starts, one will end up at a different local minima. Therefore, it is very important to think about how one initializes the training process. This is true for GD as well as more complicated variants of GD.
+
Gradients are computationally expensive to calculate for large datasets. In many cases in statistics and ML, the cost/loss/risk function is a sum of terms, with one term for each data point. For example, in linear regression, \( E \propto \sum_{i=1}^n (y_i - \mathbf{w}^T\cdot\mathbf{x}_i)^2 \); for logistic regression, the square error is replaced by the cross entropy. To calculate the gradient we have to sum over all \( n \) data points. Doing this at every GD step becomes extremely computationally expensive. An ingenious solution to this, is to calculate the gradients using small subsets of the data called "mini batches". This has the added benefit of introducing stochasticity into our algorithm.
+
GD is very sensitive to choices of learning rates. GD is extremely sensitive to the choice of learning rates. If the learning rate is very small, the training process take an extremely long time. For larger learning rates, GD can diverge and give poor results. Furthermore, depending on what the local landscape looks like, we have to modify the learning rates to ensure convergence. Ideally, we would adaptively choose the learning rates to match the landscape.
+
GD treats all directions in parameter space uniformly. Another major drawback of GD is that unlike Newton's method, the learning rate for GD is the same in all directions in parameter space. For this reason, the maximum learning rate is set by the behavior of the steepest direction and this can significantly slow down training. Ideally, we would like to take large steps in flat directions and small steps in steep directions. Since we are exploring rugged landscapes where curvatures change, this requires us to keep track of not only the gradient but second derivatives. The ideal scenario would be to calculate the Hessian but this proves to be too computationally expensive.
+
GD can take exponential time to escape saddle points, even with random initialization. As we mentioned, GD is extremely sensitive to initial condition since it determines the particular local minimum GD would eventually reach. However, even with a good initialization scheme, through the introduction of randomness, GD can still take exponential time to escape saddle points.
+
Material for lab sessions sessions Tuesday and Wednesday
@@ -1239,13 +1976,13 @@ Hessian matrix.
our optimization problem is
where we have used the definition of a norm-2 vector, that is
@@ -1258,31 +1995,31 @@ $$
From OLS to Ridge and Lasso
By minimizing the above equation with respect to the parameters
-\( \boldsymbol{\beta} \) we could then obtain an analytical expression for the
-parameters \( \boldsymbol{\beta} \). We can add a regularization parameter \( \lambda \) by
+\( \boldsymbol{\theta} \) we could then obtain an analytical expression for the
+parameters \( \boldsymbol{\theta} \). We can add a regularization parameter \( \lambda \) by
defining a new cost function to be optimized, that is
which leads to the Ridge regression minimization problem where we
-require that \( \vert\vert \boldsymbol{\beta}\vert\vert_2^2\le t \), where \( t \) is
+require that \( \vert\vert \boldsymbol{\theta}\vert\vert_2^2\le t \), where \( t \) is
a finite number larger than zero. We do not include such a constraints in the discussions here.
which leads to Lasso regression. Lasso stands for least absolute shrinkage and selection operator.
@@ -1299,23 +2036,23 @@ $$
Using the matrix-vector expression for Ridge regression and dropping the parameter \( 1/n \) in front of the standard means squared error equation, we have
and
-taking the derivatives with respect to \( \boldsymbol{\beta} \) we obtain then
+taking the derivatives with respect to \( \boldsymbol{\theta} \) we obtain then
a slightly modified matrix inversion problem which for finite values
of \( \lambda \) does not suffer from singularity problems. We obtain
the optimal parameters
Note well that a library like Scikit-Learn does not include the \( 1/n \) factor in the expression for the mean-squared error. If you include it, the optimal parameter \( \beta \) becomes
+
Note well that a library like Scikit-Learn does not include the \( 1/n \) factor in the expression for the mean-squared error. If you include it, the optimal parameter \( \theta \) becomes
which can lead to singular matrices. However, with the SVD, we can always compute the inverse of the matrix \( \boldsymbol{X}^T\boldsymbol{X} \).
@@ -1344,7 +2081,7 @@ $$
modified diagonal term added to \( \boldsymbol{X}^T\boldsymbol{X} \). The consequences, in
particular for our discussion of the bias-variance tradeoff are rather
interesting. We will see that for specific values of \( \lambda \), we may
-even reduce the variance of the optimal parameters \( \boldsymbol{\beta} \). These topics and other related ones, will be discussed after the more linear algebra oriented analysis here.
+even reduce the variance of the optimal parameters \( \boldsymbol{\theta} \). These topics and other related ones, will be discussed after the more linear algebra oriented analysis here.
@@ -1354,13 +2091,13 @@ even reduce the variance of the optimal parameters \( \boldsymbol{\beta} \). The
We have already analyzed the OLS solutions in terms of the eigenvectors (the columns) of the right singular value matrix \( \boldsymbol{U} \) as
$$
-\tilde{\boldsymbol{y}}_{\mathrm{OLS}}=\boldsymbol{X}\boldsymbol{\beta} =\boldsymbol{U}\boldsymbol{U}^T\boldsymbol{y}.
+\tilde{\boldsymbol{y}}_{\mathrm{OLS}}=\boldsymbol{X}\boldsymbol{\theta} =\boldsymbol{U}\boldsymbol{U}^T\boldsymbol{y}.
$$
Our model approximation is just \( \tilde{\boldsymbol{y}}=\boldsymbol{\beta} \) and the mean squared error and thereby the cost function for ordinary least sqquares (OLS) is then (we drop the term \( 1/n \))
+
Our model approximation is just \( \tilde{\boldsymbol{y}}=\boldsymbol{\theta} \) and the mean squared error and thereby the cost function for ordinary least sqquares (OLS) is then (we drop the term \( 1/n \))
Plotting these results shows clearly that Lasso regression suppresses (sets to zero) values of \( \beta_i \) for specific values of \( \lambda \). Ridge regression reduces on the other hand the values of \( \beta_i \) as function of \( \lambda \).
+
Plotting these results shows clearly that Lasso regression suppresses (sets to zero) values of \( \theta_i \) for specific values of \( \lambda \). Ridge regression reduces on the other hand the values of \( \theta_i \) as function of \( \lambda \).
meaning that we have two features and two unknown parameters \( \beta_0 \) and \( \beta_1 \) to be determined either by ordinary least squares, Ridge or Lasso regression.
+
meaning that we have two features and two unknown parameters \( \theta_0 \) and \( \theta_1 \) to be determined either by ordinary least squares, Ridge or Lasso regression.
The OLS case
@@ -1517,13 +2254,13 @@ $$
For ordinary least squares (OLS) we know that the optimal solution is
There is normally a constraint on the value of \( \vert\vert \boldsymbol{\beta}\vert\vert_2 \) via the parameter \( \lambda \).
-Let us for simplicity assume that \( \beta_0^2+\beta_1^2=1 \) as constraint. This will allow us to find an expression for the optimal values of \( \beta \) and \( \lambda \).
+
There is normally a constraint on the value of \( \vert\vert \boldsymbol{\theta}\vert\vert_2 \) via the parameter \( \lambda \).
+Let us for simplicity assume that \( \theta_0^2+\theta_1^2=1 \) as constraint. This will allow us to find an expression for the optimal values of \( \theta \) and \( \lambda \).
To see this, let us write the cost function for Ridge regression.
@@ -1554,83 +2291,83 @@ Let us for simplicity assume that \( \beta_0^2+\beta_1^2=1 \) as constraint. Thi
We define the MSE without the \( 1/n \) factor and have then, using that
which gives \( \lambda=4.571 \) and \( \beta_0=0.933 \) and \( \beta_1=0.359 \).
+
which gives \( \lambda=4.571 \) and \( \theta_0=0.933 \) and \( \theta_1=0.359 \).
Lasso case
-
For Lasso we need now, keeping a constraint on \( \vert\beta_0\vert+\vert\beta_1\vert=1 \), to take the derivative of the absolute values of \( \beta_0 \)
-and \( \beta_1 \). This gives us the following derivatives of the cost function
+
For Lasso we need now, keeping a constraint on \( \vert\theta_0\vert+\vert\theta_1\vert=1 \), to take the derivative of the absolute values of \( \theta_0 \)
+and \( \theta_1 \). This gives us the following derivatives of the cost function
Using the constraint on \( \beta_0 \) and \( \beta_1 \) we can then find the optimal value of \( \lambda \) for the different cases. We leave this as an exercise to you.
+
Using the constraint on \( \theta_0 \) and \( \theta_1 \) we can then find the optimal value of \( \lambda \) for the different cases. We leave this as an exercise to you.
Simple code for solving the above problem
diff --git a/doc/pub/week36/html/week36.html b/doc/pub/week36/html/week36.html
index 6a9b2663a..f848354a3 100644
--- a/doc/pub/week36/html/week36.html
+++ b/doc/pub/week36/html/week36.html
@@ -205,6 +205,71 @@ div.toc p,a {
2,
None,
'deriving-the-lasso-regression-equations'),
+ ('Optimization and gradient descent, the central part of any '
+ 'Machine Learning algortithm',
+ 2,
+ None,
+ 'optimization-and-gradient-descent-the-central-part-of-any-machine-learning-algortithm'),
+ ("Reminder on Newton-Raphson's method",
+ 2,
+ None,
+ 'reminder-on-newton-raphson-s-method'),
+ ('The equations', 2, None, 'the-equations'),
+ ('Simple geometric interpretation',
+ 2,
+ None,
+ 'simple-geometric-interpretation'),
+ ('Extending to more than one variable',
+ 2,
+ None,
+ 'extending-to-more-than-one-variable'),
+ ('Steepest descent', 2, None, 'steepest-descent'),
+ ('More on Steepest descent', 2, None, 'more-on-steepest-descent'),
+ ('The ideal', 2, None, 'the-ideal'),
+ ('The sensitiveness of the gradient descent',
+ 2,
+ None,
+ 'the-sensitiveness-of-the-gradient-descent'),
+ ('Convex functions', 2, None, 'convex-functions'),
+ ('Convex function', 2, None, 'convex-function'),
+ ('Conditions on convex functions',
+ 2,
+ None,
+ 'conditions-on-convex-functions'),
+ ('More on convex functions', 2, None, 'more-on-convex-functions'),
+ ('Some simple problems', 2, None, 'some-simple-problems'),
+ ('Revisiting Ordinary Least Squares',
+ 2,
+ None,
+ 'revisiting-ordinary-least-squares'),
+ ('Gradient descent example', 2, None, 'gradient-descent-example'),
+ ('The derivative of the cost/loss function',
+ 2,
+ None,
+ 'the-derivative-of-the-cost-loss-function'),
+ ('The Hessian matrix', 2, None, 'the-hessian-matrix'),
+ ('Simple program', 2, None, 'simple-program'),
+ ('Gradient Descent Example', 2, None, 'gradient-descent-example'),
+ ('And a corresponding example using _scikit-learn_',
+ 2,
+ None,
+ 'and-a-corresponding-example-using-scikit-learn'),
+ ('Gradient descent and Ridge',
+ 2,
+ None,
+ 'gradient-descent-and-ridge'),
+ ('The Hessian matrix for Ridge Regression',
+ 2,
+ None,
+ 'the-hessian-matrix-for-ridge-regression'),
+ ('Program example for gradient descent with Ridge Regression',
+ 2,
+ None,
+ 'program-example-for-gradient-descent-with-ridge-regression'),
+ ('Using gradient descent methods, limitations',
+ 2,
+ None,
+ 'using-gradient-descent-methods-limitations'),
('Material for lab sessions sessions Tuesday and Wednesday',
2,
None,
@@ -321,6 +386,7 @@ MathJax.Hub.Config({
This equation does not lead to a nice analytical equation as in either Ridge regression or ordinary least squares. This equation can however be solved by using standard convex optimization algorithms.We will discuss how to code the above methods using gardient descent methods.
+
This equation does not lead to a nice analytical equation as in either Ridge regression or ordinary least squares. This equation can however be solved by using standard convex optimization algorithms.We will discuss how to code the above methods using gradient descent methods.
+
+
Optimization and gradient descent, the central part of any Machine Learning algortithm
+
+
Almost every problem in machine learning and data science starts with
+a dataset \( X \), a model \( g(\theta) \), which is a function of the
+parameters \( \theta \) and a cost function \( C(X, g(\theta)) \) that allows
+us to judge how well the model \( g(\theta) \) explains the observations
+\( X \). The model is fit by finding the values of \( \theta \) that minimize
+the cost function. Ideally we would be able to solve for \( \theta \)
+analytically, however this is not possible in general and we must use
+some approximative/numerical method to compute the minimum.
+
+
+
+
Reminder on Newton-Raphson's method
+
+
Let us quickly remind ourselves how we derive the above method.
+
+
Perhaps the most celebrated of all one-dimensional root-finding
+routines is Newton's method, also called the Newton-Raphson
+method. This method requires the evaluation of both the
+function \( f \) and its derivative \( f' \) at arbitrary points.
+If you can only calculate the derivative
+numerically and/or your function is not of the smooth type, we
+normally discourage the use of this method.
+
+
+
+
The equations
+
+
The Newton-Raphson formula consists geometrically of extending the
+tangent line at a current point until it crosses zero, then setting
+the next guess to the abscissa of that zero-crossing. The mathematics
+behind this method is rather simple. Employing a Taylor expansion for
+\( x \) sufficiently close to the solution \( s \), we have
+
The above is Newton-Raphson's method. It has a simple geometric
+interpretation, namely \( x_{n+1} \) is the point where the tangent from
+\( (x_n,f(x_n)) \) crosses the \( x \)-axis. Close to the solution,
+Newton-Raphson converges fast to the desired result. However, if we
+are far from a root, where the higher-order terms in the series are
+important, the Newton-Raphson formula can give grossly inaccurate
+results. For instance, the initial guess for the root might be so far
+from the true root as to let the search interval include a local
+maximum or minimum of the function. If an iteration places a trial
+guess near such a local extremum, so that the first derivative nearly
+vanishes, then Newton-Raphson may fail totally
+
+
+
+
Extending to more than one variable
+
+
Newton's method can be generalized to systems of several non-linear equations
+and variables. Consider the case with two equations
+
We need thus to compute the inverse of the Jacobian matrix and it
+is to understand that difficulties may
+arise in case \( {\bf \boldsymbol{J}} \) is nearly singular.
+
+
+
It is rather straightforward to extend the above scheme to systems of
+more than two non-linear equations. In our case, the Jacobian matrix is given by the Hessian that represents the second derivative of cost function.
+
+
+
+
Steepest descent
+
+
The basic idea of gradient descent is
+that a function \( F(\mathbf{x}) \),
+\( \mathbf{x} \equiv (x_1,\cdots,x_n) \), decreases fastest if one goes from \( \bf {x} \) in the
+direction of the negative gradient \( -\nabla F(\mathbf{x}) \).
+
For \( \gamma_k \) small enough, then \( F(\mathbf{x}_{k+1}) \leq
+F(\mathbf{x}_k) \). This means that for a sufficiently small \( \gamma_k \)
+we are always moving towards smaller function values, i.e a minimum.
+
+
+
+
More on Steepest descent
+
+
The previous observation is the basis of the method of steepest
+descent, which is also referred to as just gradient descent (GD). One
+starts with an initial guess \( \mathbf{x}_0 \) for a minimum of \( F \) and
+computes new approximations according to
+
The parameter \( \gamma_k \) is often referred to as the step length or
+the learning rate within the context of Machine Learning.
+
+
+
+
The ideal
+
+
Ideally the sequence \( \{\mathbf{x}_k \}_{k=0} \) converges to a global
+minimum of the function \( F \). In general we do not know if we are in a
+global or local minimum. In the special case when \( F \) is a convex
+function, all local minima are also global minima, so in this case
+gradient descent can converge to the global solution. The advantage of
+this scheme is that it is conceptually simple and straightforward to
+implement. However the method in this form has some severe
+limitations:
+
+
+
In machine learing we are often faced with non-convex high dimensional
+cost functions with many local minima. Since GD is deterministic we
+will get stuck in a local minimum, if the method converges, unless we
+have a very good intial guess. This also implies that the scheme is
+sensitive to the chosen initial condition.
+
+
+
Note that the gradient is a function of \( \mathbf{x} =
+(x_1,\cdots,x_n) \) which makes it expensive to compute numerically.
+
+
+
+
The sensitiveness of the gradient descent
+
+
The gradient descent method
+is sensitive to the choice of learning rate \( \gamma_k \). This is due
+to the fact that we are only guaranteed that \( F(\mathbf{x}_{k+1}) \leq
+F(\mathbf{x}_k) \) for sufficiently small \( \gamma_k \). The problem is to
+determine an optimal learning rate. If the learning rate is chosen too
+small the method will take a long time to converge and if it is too
+large we can experience erratic behavior.
+
+
+
Many of these shortcomings can be alleviated by introducing
+randomness. One such method is that of Stochastic Gradient Descent
+(SGD), to be discussed next week.
+
+
+
+
Convex functions
+
+
Ideally we want our cost/loss function to be convex(concave).
+
+
First we give the definition of a convex set: A set \( C \) in
+\( \mathbb{R}^n \) is said to be convex if, for all \( x \) and \( y \) in \( C \) and
+all \( t \in (0,1) \) , the point \( (1 − t)x + ty \) also belongs to
+C. Geometrically this means that every point on the line segment
+connecting \( x \) and \( y \) is in \( C \) as discussed below.
+
+
+
The convex subsets of \( \mathbb{R} \) are the intervals of
+\( \mathbb{R} \). Examples of convex sets of \( \mathbb{R}^2 \) are the
+regular polygons (triangles, rectangles, pentagons, etc...).
+
+
+
+
Convex function
+
+
Convex function: Let \( X \subset \mathbb{R}^n \) be a convex set. Assume that the function \( f: X \rightarrow \mathbb{R} \) is continuous, then \( f \) is said to be convex if $$f(tx_1 + (1-t)x_2) \leq tf(x_1) + (1-t)f(x_2) $$ for all \( x_1, x_2 \in X \) and for all \( t \in [0,1] \). If \( \leq \) is replaced with a strict inequaltiy in the definition, we demand \( x_1 \neq x_2 \) and \( t\in(0,1) \) then \( f \) is said to be strictly convex. For a single variable function, convexity means that if you draw a straight line connecting \( f(x_1) \) and \( f(x_2) \), the value of the function on the interval \( [x_1,x_2] \) is always below the line as illustrated below.
+
+
+
Conditions on convex functions
+
+
In the following we state first and second-order conditions which
+ensures convexity of a function \( f \). We write \( D_f \) to denote the
+domain of \( f \), i.e the subset of \( R^n \) where \( f \) is defined. For more
+details and proofs we refer to: S. Boyd and L. Vandenberghe. Convex Optimization. Cambridge University Press.
+
+
+
+First order condition
+
+
Suppose \( f \) is differentiable (i.e \( \nabla f(x) \) is well defined for
+all \( x \) in the domain of \( f \)). Then \( f \) is convex if and only if \( D_f \)
+is a convex set and $$f(y) \geq f(x) + \nabla f(x)^T (y-x) $$ holds
+for all \( x,y \in D_f \). This condition means that for a convex function
+the first order Taylor expansion (right hand side above) at any point
+a global under estimator of the function. To convince yourself you can
+make a drawing of \( f(x) = x^2+1 \) and draw the tangent line to \( f(x) \) and
+note that it is always below the graph.
+
+
+
+
+
+Second order condition
+
+
Assume that \( f \) is twice
+differentiable, i.e the Hessian matrix exists at each point in
+\( D_f \). Then \( f \) is convex if and only if \( D_f \) is a convex set and its
+Hessian is positive semi-definite for all \( x\in D_f \). For a
+single-variable function this reduces to \( f''(x) \geq 0 \). Geometrically this means that \( f \) has nonnegative curvature
+everywhere.
+
+
+
+
+
This condition is particularly useful since it gives us an procedure for determining if the function under consideration is convex, apart from using the definition.
+
+
+
More on convex functions
+
+
The next result is of great importance to us and the reason why we are
+going on about convex functions. In machine learning we frequently
+have to minimize a loss/cost function in order to find the best
+parameters for the model we are considering.
+
+
+
Ideally we want the
+global minimum (for high-dimensional models it is hard to know
+if we have local or global minimum). However, if the cost/loss function
+is convex the following result provides invaluable information:
+
+
+
+Any minimum is global for convex functions
+
+
Consider the problem of finding \( x \in \mathbb{R}^n \) such that \( f(x) \)
+is minimal, where \( f \) is convex and differentiable. Then, any point
+\( x^* \) that satisfies \( \nabla f(x^*) = 0 \) is a global minimum.
+
+
+
+
+
This result means that if we know that the cost/loss function is convex and we are able to find a minimum, we are guaranteed that it is a global minimum.
+
+
+
Some simple problems
+
+
+
Show that \( f(x)=x^2 \) is convex for \( x \in \mathbb{R} \) using the definition of convexity. Hint: If you re-write the definition, \( f \) is convex if the following holds for all \( x,y \in D_f \) and any \( \lambda \in [0,1] \) $\lambda f(x)+(1-\lambda)f(y)-f(\lambda x + (1-\lambda) y ) \geq 0$.
+
Using the second order condition show that the following functions are convex on the specified domain.
+
+
\( f(x) = e^x \) is convex for \( x \in \mathbb{R} \).
+
\( g(x) = -\ln(x) \) is convex for \( x \in (0,\infty) \).
+
+
Let \( f(x) = x^2 \) and \( g(x) = e^x \). Show that \( f(g(x)) \) and \( g(f(x)) \) is convex for \( x \in \mathbb{R} \). Also show that if \( f(x) \) is any convex function than \( h(x) = e^{f(x)} \) is convex.
+
A norm is any function that satisfy the following properties
+
+
\( f(\alpha x) = |\alpha| f(x) \) for all \( \alpha \in \mathbb{R} \).
+
\( f(x+y) \leq f(x) + f(y) \)
+
\( f(x) \leq 0 \) for all \( x \in \mathbb{R}^n \) with equality if and only if \( x = 0 \)
+
+
+
Using the definition of convexity, try to show that a function satisfying the properties above is convex (the third condition is not needed to show this).
+
+
+
Revisiting Ordinary Least Squares
+
+
We will use linear regression as a case study for the gradient descent
+methods. Linear regression is a great test case for the gradient
+descent methods discussed in the lectures since it has several
+desirable properties such as:
+
+
+
+
An analytical solution (recall homework sets for week 35).
+
The gradient can be computed analytically.
+
The cost function is convex which guarantees that gradient descent converges for small enough learning rates
+
+
We revisit an example similar to what we had in the first homework set. We had a function of the type
+
+
+
+
+
+
+
+
+
x =2*np.random.rand(m,1)
+y =4+3*x+np.random.randn(m,1)
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
with \( x_i \in [0,1] \) is chosen randomly using a uniform distribution. Additionally we have a stochastic noise chosen according to a normal distribution \( \cal {N}(0,1) \).
+The linear regression model is given by
+
Let \( \mathbf{y} = (y_1,\cdots,y_n)^T \), \( \mathbf{\boldsymbol{y}} = (\boldsymbol{y}_1,\cdots,\boldsymbol{y}_n)^T \) and \( \theta = (\theta_0, \theta_1)^T \)
+
+
It is convenient to write \( \mathbf{\boldsymbol{y}} = X\theta \) where \( X \in \mathbb{R}^{100 \times 2} \) is the design matrix given by (we keep the intercept here)
and we want to find \( \theta \) such that \( C(\theta) \) is minimized.
+
+
+
The derivative of the cost/loss function
+
+
Computing \( \partial C(\theta) / \partial \theta_0 \) and \( \partial C(\theta) / \partial \theta_1 \) we can show that the gradient can be written as
We can use the expression we computed for the gradient and let use a
+\( \theta_0 \) be chosen randomly and let \( \gamma = 0.001 \). Stop iterating
+when \( ||\nabla_\theta C(\theta_k) || \leq \epsilon = 10^{-8} \). Note that the code below does not include the latter stop criterion.
+
+
+
And finally we can compare our solution for \( \theta \) with the analytic result given by
+\( \theta= (X^TX)^{-1} X^T \mathbf{y} \).
+
This implies that the Hessian matrix is positive definite, hence the stationary point is a
+minimum.
+Note that the Ridge cost function is convex being a sum of two convex
+functions. Therefore, the stationary point is a global
+minimum of this function.
+
+
+
+
Program example for gradient descent with Ridge Regression
+
+
+
+
+
+
+
+
fromrandomimport random, seed
+importnumpyasnp
+importmatplotlib.pyplotasplt
+frommpl_toolkits.mplot3dimport Axes3D
+frommatplotlibimport cm
+frommatplotlib.tickerimport LinearLocator, FormatStrFormatter
+importsys
+
+# the number of datapoints
+n =100
+x =2*np.random.rand(n,1)
+y =4+3*x+np.random.randn(n,1)
+
+X = np.c_[np.ones((n,1)), x]
+XT_X = X.T @ X
+
+#Ridge parameter lambda
+lmbda =0.001
+Id = n*lmbda* np.eye(XT_X.shape[0])
+
+# Hessian matrix
+H = (2.0/n)* XT_X+2*lmbda* np.eye(XT_X.shape[0])
+# Get the eigenvalues
+EigValues, EigVectors = np.linalg.eig(H)
+print(f"Eigenvalues of Hessian Matrix:{EigValues}")
+
+
+theta_linreg = np.linalg.inv(XT_X+Id) @ X.T @ y
+print(theta_linreg)
+# Start plain gradient descent
+theta = np.random.randn(2,1)
+
+eta =1.0/np.max(EigValues)
+Niterations =100
+
+foriterinrange(Niterations):
+ gradients =2.0/n*X.T @ (X @ (theta)-y)+2*lmbda*theta
+ theta -= eta*gradients
+
+print(theta)
+ypredict = X @ theta
+ypredict2 = X @ theta_linreg
+plt.plot(x, ypredict, "r-")
+plt.plot(x, ypredict2, "b-")
+plt.plot(x, y ,'ro')
+plt.axis([0,2.0,0, 15.0])
+plt.xlabel(r'$x$')
+plt.ylabel(r'$y$')
+plt.title(r'Gradient descent example for Ridge')
+plt.show()
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
Using gradient descent methods, limitations
+
+
+
Gradient descent (GD) finds local minima of our function. Since the GD algorithm is deterministic, if it converges, it will converge to a local minimum of our cost/loss/risk function. Because in ML we are often dealing with extremely rugged landscapes with many local minima, this can lead to poor performance.
+
GD is sensitive to initial conditions. One consequence of the local nature of GD is that initial conditions matter. Depending on where one starts, one will end up at a different local minima. Therefore, it is very important to think about how one initializes the training process. This is true for GD as well as more complicated variants of GD.
+
Gradients are computationally expensive to calculate for large datasets. In many cases in statistics and ML, the cost/loss/risk function is a sum of terms, with one term for each data point. For example, in linear regression, \( E \propto \sum_{i=1}^n (y_i - \mathbf{w}^T\cdot\mathbf{x}_i)^2 \); for logistic regression, the square error is replaced by the cross entropy. To calculate the gradient we have to sum over all \( n \) data points. Doing this at every GD step becomes extremely computationally expensive. An ingenious solution to this, is to calculate the gradients using small subsets of the data called "mini batches". This has the added benefit of introducing stochasticity into our algorithm.
+
GD is very sensitive to choices of learning rates. GD is extremely sensitive to the choice of learning rates. If the learning rate is very small, the training process take an extremely long time. For larger learning rates, GD can diverge and give poor results. Furthermore, depending on what the local landscape looks like, we have to modify the learning rates to ensure convergence. Ideally, we would adaptively choose the learning rates to match the landscape.
+
GD treats all directions in parameter space uniformly. Another major drawback of GD is that unlike Newton's method, the learning rate for GD is the same in all directions in parameter space. For this reason, the maximum learning rate is set by the behavior of the steepest direction and this can significantly slow down training. Ideally, we would like to take large steps in flat directions and small steps in steep directions. Since we are exploring rugged landscapes where curvatures change, this requires us to keep track of not only the gradient but second derivatives. The ideal scenario would be to calculate the Hessian but this proves to be too computationally expensive.
+
GD can take exponential time to escape saddle points, even with random initialization. As we mentioned, GD is extremely sensitive to initial condition since it determines the particular local minimum GD would eventually reach. However, even with a good initialization scheme, through the introduction of randomness, GD can still take exponential time to escape saddle points.
+
Material for lab sessions sessions Tuesday and Wednesday
@@ -1316,13 +2053,13 @@ Hessian matrix.
our optimization problem is
$$
-{\displaystyle \min_{\boldsymbol{\beta}\in {\mathbb{R}}^{p}}}\frac{1}{n}\left\{\left(\boldsymbol{y}-\boldsymbol{X}\boldsymbol{\beta}\right)^T\left(\boldsymbol{y}-\boldsymbol{X}\boldsymbol{\beta}\right)\right\}.
+{\displaystyle \min_{\boldsymbol{\theta}\in {\mathbb{R}}^{p}}}\frac{1}{n}\left\{\left(\boldsymbol{y}-\boldsymbol{X}\boldsymbol{\theta}\right)^T\left(\boldsymbol{y}-\boldsymbol{X}\boldsymbol{\theta}\right)\right\}.
$$
where we have used the definition of a norm-2 vector, that is
@@ -1335,31 +2072,31 @@ $$
From OLS to Ridge and Lasso
By minimizing the above equation with respect to the parameters
-\( \boldsymbol{\beta} \) we could then obtain an analytical expression for the
-parameters \( \boldsymbol{\beta} \). We can add a regularization parameter \( \lambda \) by
+\( \boldsymbol{\theta} \) we could then obtain an analytical expression for the
+parameters \( \boldsymbol{\theta} \). We can add a regularization parameter \( \lambda \) by
defining a new cost function to be optimized, that is
which leads to the Ridge regression minimization problem where we
-require that \( \vert\vert \boldsymbol{\beta}\vert\vert_2^2\le t \), where \( t \) is
+require that \( \vert\vert \boldsymbol{\theta}\vert\vert_2^2\le t \), where \( t \) is
a finite number larger than zero. We do not include such a constraints in the discussions here.
which leads to Lasso regression. Lasso stands for least absolute shrinkage and selection operator.
@@ -1376,23 +2113,23 @@ $$
Using the matrix-vector expression for Ridge regression and dropping the parameter \( 1/n \) in front of the standard means squared error equation, we have
and
-taking the derivatives with respect to \( \boldsymbol{\beta} \) we obtain then
+taking the derivatives with respect to \( \boldsymbol{\theta} \) we obtain then
a slightly modified matrix inversion problem which for finite values
of \( \lambda \) does not suffer from singularity problems. We obtain
the optimal parameters
Note well that a library like Scikit-Learn does not include the \( 1/n \) factor in the expression for the mean-squared error. If you include it, the optimal parameter \( \beta \) becomes
+
Note well that a library like Scikit-Learn does not include the \( 1/n \) factor in the expression for the mean-squared error. If you include it, the optimal parameter \( \theta \) becomes
which can lead to singular matrices. However, with the SVD, we can always compute the inverse of the matrix \( \boldsymbol{X}^T\boldsymbol{X} \).
@@ -1421,7 +2158,7 @@ $$
modified diagonal term added to \( \boldsymbol{X}^T\boldsymbol{X} \). The consequences, in
particular for our discussion of the bias-variance tradeoff are rather
interesting. We will see that for specific values of \( \lambda \), we may
-even reduce the variance of the optimal parameters \( \boldsymbol{\beta} \). These topics and other related ones, will be discussed after the more linear algebra oriented analysis here.
+even reduce the variance of the optimal parameters \( \boldsymbol{\theta} \). These topics and other related ones, will be discussed after the more linear algebra oriented analysis here.
@@ -1431,13 +2168,13 @@ even reduce the variance of the optimal parameters \( \boldsymbol{\beta} \). The
We have already analyzed the OLS solutions in terms of the eigenvectors (the columns) of the right singular value matrix \( \boldsymbol{U} \) as
$$
-\tilde{\boldsymbol{y}}_{\mathrm{OLS}}=\boldsymbol{X}\boldsymbol{\beta} =\boldsymbol{U}\boldsymbol{U}^T\boldsymbol{y}.
+\tilde{\boldsymbol{y}}_{\mathrm{OLS}}=\boldsymbol{X}\boldsymbol{\theta} =\boldsymbol{U}\boldsymbol{U}^T\boldsymbol{y}.
$$
Our model approximation is just \( \tilde{\boldsymbol{y}}=\boldsymbol{\beta} \) and the mean squared error and thereby the cost function for ordinary least sqquares (OLS) is then (we drop the term \( 1/n \))
+
Our model approximation is just \( \tilde{\boldsymbol{y}}=\boldsymbol{\theta} \) and the mean squared error and thereby the cost function for ordinary least sqquares (OLS) is then (we drop the term \( 1/n \))
Plotting these results shows clearly that Lasso regression suppresses (sets to zero) values of \( \beta_i \) for specific values of \( \lambda \). Ridge regression reduces on the other hand the values of \( \beta_i \) as function of \( \lambda \).
+
Plotting these results shows clearly that Lasso regression suppresses (sets to zero) values of \( \theta_i \) for specific values of \( \lambda \). Ridge regression reduces on the other hand the values of \( \theta_i \) as function of \( \lambda \).
meaning that we have two features and two unknown parameters \( \beta_0 \) and \( \beta_1 \) to be determined either by ordinary least squares, Ridge or Lasso regression.
+
meaning that we have two features and two unknown parameters \( \theta_0 \) and \( \theta_1 \) to be determined either by ordinary least squares, Ridge or Lasso regression.
The OLS case
@@ -1594,13 +2331,13 @@ $$
For ordinary least squares (OLS) we know that the optimal solution is
There is normally a constraint on the value of \( \vert\vert \boldsymbol{\beta}\vert\vert_2 \) via the parameter \( \lambda \).
-Let us for simplicity assume that \( \beta_0^2+\beta_1^2=1 \) as constraint. This will allow us to find an expression for the optimal values of \( \beta \) and \( \lambda \).
+
There is normally a constraint on the value of \( \vert\vert \boldsymbol{\theta}\vert\vert_2 \) via the parameter \( \lambda \).
+Let us for simplicity assume that \( \theta_0^2+\theta_1^2=1 \) as constraint. This will allow us to find an expression for the optimal values of \( \theta \) and \( \lambda \).
To see this, let us write the cost function for Ridge regression.
@@ -1631,83 +2368,83 @@ Let us for simplicity assume that \( \beta_0^2+\beta_1^2=1 \) as constraint. Thi
We define the MSE without the \( 1/n \) factor and have then, using that
which gives \( \lambda=4.571 \) and \( \beta_0=0.933 \) and \( \beta_1=0.359 \).
+
which gives \( \lambda=4.571 \) and \( \theta_0=0.933 \) and \( \theta_1=0.359 \).
Lasso case
-
For Lasso we need now, keeping a constraint on \( \vert\beta_0\vert+\vert\beta_1\vert=1 \), to take the derivative of the absolute values of \( \beta_0 \)
-and \( \beta_1 \). This gives us the following derivatives of the cost function
+
For Lasso we need now, keeping a constraint on \( \vert\theta_0\vert+\vert\theta_1\vert=1 \), to take the derivative of the absolute values of \( \theta_0 \)
+and \( \theta_1 \). This gives us the following derivatives of the cost function
Using the constraint on \( \beta_0 \) and \( \beta_1 \) we can then find the optimal value of \( \lambda \) for the different cases. We leave this as an exercise to you.
+
Using the constraint on \( \theta_0 \) and \( \theta_1 \) we can then find the optimal value of \( \lambda \) for the different cases. We leave this as an exercise to you.
Simple code for solving the above problem
diff --git a/doc/pub/week36/ipynb/ipynb-week36-src.tar.gz b/doc/pub/week36/ipynb/ipynb-week36-src.tar.gz
index b7e70f108ff726250e48287f2b32111ac3b7620f..76a80034f2ddf34eb202a6ccf3c7642da7c9acbd 100644
GIT binary patch
delta 159
zcmV;Q0AT;W0l)zqABzY8Bcrrv00ZsM%?iRW37-WT61GO4jA(2W{`wiu^E~fs
M4~vxRhX4ow01M\n",
"\n",
- "2. Rashcka et al, pages 37-44 and pages 278-283 with focus on linear regression."
+ "2. Rashcka et al, pages 37-44 and pages 278-283 with focus on linear regression.\n",
+ "\n",
+ "3. Video on gradient descent at "
]
},
{
"cell_type": "markdown",
- "id": "68f1bb41",
+ "id": "1016bcdb",
"metadata": {
"editable": true
},
@@ -65,7 +67,7 @@
},
{
"cell_type": "markdown",
- "id": "cf4c7ef3",
+ "id": "839e657a",
"metadata": {
"editable": true
},
@@ -79,7 +81,7 @@
},
{
"cell_type": "markdown",
- "id": "91bd955c",
+ "id": "12dc9112",
"metadata": {
"editable": true
},
@@ -91,7 +93,7 @@
},
{
"cell_type": "markdown",
- "id": "fe6b5c23",
+ "id": "df3e7f6d",
"metadata": {
"editable": true
},
@@ -103,7 +105,7 @@
},
{
"cell_type": "markdown",
- "id": "ab6c256a",
+ "id": "cc1caa8e",
"metadata": {
"editable": true
},
@@ -115,7 +117,7 @@
},
{
"cell_type": "markdown",
- "id": "28ebdefd",
+ "id": "aaf95f40",
"metadata": {
"editable": true
},
@@ -125,7 +127,7 @@
},
{
"cell_type": "markdown",
- "id": "e8a4ed80",
+ "id": "5e615b93",
"metadata": {
"editable": true
},
@@ -137,7 +139,7 @@
},
{
"cell_type": "markdown",
- "id": "18cbc7f5",
+ "id": "7f764f4e",
"metadata": {
"editable": true
},
@@ -147,7 +149,7 @@
},
{
"cell_type": "markdown",
- "id": "ca9c127d",
+ "id": "4e0d9985",
"metadata": {
"editable": true
},
@@ -159,7 +161,7 @@
},
{
"cell_type": "markdown",
- "id": "9ac3aac4",
+ "id": "a11e3b77",
"metadata": {
"editable": true
},
@@ -170,7 +172,7 @@
},
{
"cell_type": "markdown",
- "id": "689c9ad2",
+ "id": "b175d8ad",
"metadata": {
"editable": true
},
@@ -182,7 +184,7 @@
},
{
"cell_type": "markdown",
- "id": "b7d5c970",
+ "id": "0901c5d9",
"metadata": {
"editable": true
},
@@ -194,7 +196,7 @@
},
{
"cell_type": "markdown",
- "id": "7ba1e34f",
+ "id": "7263285d",
"metadata": {
"editable": true
},
@@ -204,7 +206,7 @@
},
{
"cell_type": "markdown",
- "id": "8c81fa1b",
+ "id": "c0f54e1a",
"metadata": {
"editable": true
},
@@ -216,7 +218,7 @@
},
{
"cell_type": "markdown",
- "id": "317142c4",
+ "id": "035835e7",
"metadata": {
"editable": true
},
@@ -228,7 +230,7 @@
},
{
"cell_type": "markdown",
- "id": "2104cfb3",
+ "id": "a0dca7fe",
"metadata": {
"editable": true
},
@@ -238,7 +240,7 @@
},
{
"cell_type": "markdown",
- "id": "2545dd7a",
+ "id": "5808efd5",
"metadata": {
"editable": true
},
@@ -250,7 +252,7 @@
},
{
"cell_type": "markdown",
- "id": "e483ff85",
+ "id": "cca67bb8",
"metadata": {
"editable": true
},
@@ -260,7 +262,7 @@
},
{
"cell_type": "markdown",
- "id": "ec1217d8",
+ "id": "a189ce2b",
"metadata": {
"editable": true
},
@@ -272,7 +274,7 @@
},
{
"cell_type": "markdown",
- "id": "a4294197",
+ "id": "7835a4fb",
"metadata": {
"editable": true
},
@@ -282,7 +284,7 @@
},
{
"cell_type": "markdown",
- "id": "523bedff",
+ "id": "1ba547c3",
"metadata": {
"editable": true
},
@@ -322,7 +324,7 @@
},
{
"cell_type": "markdown",
- "id": "7a63895f",
+ "id": "55bc2c91",
"metadata": {
"editable": true
},
@@ -339,7 +341,7 @@
},
{
"cell_type": "markdown",
- "id": "5be6cc00",
+ "id": "c702f5e0",
"metadata": {
"editable": true
},
@@ -362,7 +364,7 @@
},
{
"cell_type": "markdown",
- "id": "f0e55e26",
+ "id": "86cc8cb6",
"metadata": {
"editable": true
},
@@ -379,7 +381,7 @@
},
{
"cell_type": "markdown",
- "id": "b0c93e43",
+ "id": "1797b7e5",
"metadata": {
"editable": true
},
@@ -398,7 +400,7 @@
},
{
"cell_type": "markdown",
- "id": "3639c924",
+ "id": "dc73a5a2",
"metadata": {
"editable": true
},
@@ -409,7 +411,7 @@
},
{
"cell_type": "markdown",
- "id": "8d3ba757",
+ "id": "20b19ac5",
"metadata": {
"editable": true
},
@@ -421,7 +423,7 @@
},
{
"cell_type": "markdown",
- "id": "81f9ca59",
+ "id": "c269e5e9",
"metadata": {
"editable": true
},
@@ -439,7 +441,7 @@
},
{
"cell_type": "markdown",
- "id": "195027ed",
+ "id": "64cdb37b",
"metadata": {
"editable": true
},
@@ -455,7 +457,7 @@
},
{
"cell_type": "markdown",
- "id": "e5fd03fb",
+ "id": "3e6e5a3e",
"metadata": {
"editable": true
},
@@ -467,7 +469,7 @@
},
{
"cell_type": "markdown",
- "id": "b0f9d6d0",
+ "id": "fd83bb4b",
"metadata": {
"editable": true
},
@@ -477,7 +479,7 @@
},
{
"cell_type": "markdown",
- "id": "332cc7e8",
+ "id": "45b376e8",
"metadata": {
"editable": true
},
@@ -490,7 +492,7 @@
},
{
"cell_type": "markdown",
- "id": "b78869a4",
+ "id": "90bb63a4",
"metadata": {
"editable": true
},
@@ -502,7 +504,7 @@
},
{
"cell_type": "markdown",
- "id": "848010ab",
+ "id": "de110cca",
"metadata": {
"editable": true
},
@@ -512,7 +514,7 @@
},
{
"cell_type": "markdown",
- "id": "e7abce99",
+ "id": "a8f75c00",
"metadata": {
"editable": true
},
@@ -525,7 +527,7 @@
},
{
"cell_type": "markdown",
- "id": "16f05d95",
+ "id": "e3d1ecbd",
"metadata": {
"editable": true
},
@@ -535,7 +537,7 @@
},
{
"cell_type": "markdown",
- "id": "432f4790",
+ "id": "a932ed24",
"metadata": {
"editable": true
},
@@ -547,7 +549,7 @@
},
{
"cell_type": "markdown",
- "id": "954ac1c9",
+ "id": "9ec04c56",
"metadata": {
"editable": true
},
@@ -560,7 +562,7 @@
},
{
"cell_type": "markdown",
- "id": "02ba7398",
+ "id": "c191b236",
"metadata": {
"editable": true
},
@@ -573,7 +575,7 @@
},
{
"cell_type": "markdown",
- "id": "505fa97e",
+ "id": "214affcd",
"metadata": {
"editable": true
},
@@ -585,7 +587,7 @@
},
{
"cell_type": "markdown",
- "id": "d02ee785",
+ "id": "cebe8ac0",
"metadata": {
"editable": true
},
@@ -597,7 +599,7 @@
},
{
"cell_type": "markdown",
- "id": "ecaded7f",
+ "id": "a10a36e8",
"metadata": {
"editable": true
},
@@ -607,7 +609,7 @@
},
{
"cell_type": "markdown",
- "id": "f3eaed8e",
+ "id": "51e17519",
"metadata": {
"editable": true
},
@@ -620,7 +622,7 @@
},
{
"cell_type": "markdown",
- "id": "343a5abf",
+ "id": "eb706113",
"metadata": {
"editable": true
},
@@ -632,7 +634,7 @@
},
{
"cell_type": "markdown",
- "id": "156ce8b1",
+ "id": "f2252659",
"metadata": {
"editable": true
},
@@ -644,7 +646,7 @@
},
{
"cell_type": "markdown",
- "id": "ff820f30",
+ "id": "bcf67e2c",
"metadata": {
"editable": true
},
@@ -656,7 +658,7 @@
},
{
"cell_type": "markdown",
- "id": "28020db4",
+ "id": "4053a663",
"metadata": {
"editable": true
},
@@ -668,7 +670,7 @@
},
{
"cell_type": "markdown",
- "id": "1a8a4b70",
+ "id": "8c8d8ce5",
"metadata": {
"editable": true
},
@@ -682,7 +684,7 @@
},
{
"cell_type": "markdown",
- "id": "389554f4",
+ "id": "fd306ffb",
"metadata": {
"editable": true
},
@@ -694,7 +696,7 @@
},
{
"cell_type": "markdown",
- "id": "b4f76602",
+ "id": "f819a5cd",
"metadata": {
"editable": true
},
@@ -704,7 +706,7 @@
},
{
"cell_type": "markdown",
- "id": "dd9756e8",
+ "id": "95c2e048",
"metadata": {
"editable": true
},
@@ -716,7 +718,7 @@
},
{
"cell_type": "markdown",
- "id": "3ed04a92",
+ "id": "071a983e",
"metadata": {
"editable": true
},
@@ -728,7 +730,7 @@
},
{
"cell_type": "markdown",
- "id": "be9f2cbc",
+ "id": "36d40252",
"metadata": {
"editable": true
},
@@ -740,7 +742,7 @@
},
{
"cell_type": "markdown",
- "id": "2c78b184",
+ "id": "e70d5af4",
"metadata": {
"editable": true
},
@@ -752,7 +754,7 @@
},
{
"cell_type": "markdown",
- "id": "a433cf4b",
+ "id": "d0becda4",
"metadata": {
"editable": true
},
@@ -764,7 +766,7 @@
},
{
"cell_type": "markdown",
- "id": "721b72cf",
+ "id": "c8ee3aff",
"metadata": {
"editable": true
},
@@ -786,121 +788,13 @@
},
{
"cell_type": "code",
- "execution_count": 4,
- "id": "b957a32b",
+ "execution_count": 1,
+ "id": "19ea825b",
"metadata": {
"collapsed": false,
- "editable": true,
- "jupyter": {
- "outputs_hidden": false
- }
+ "editable": true
},
- "outputs": [
- {
- "name": "stdout",
- "output_type": "stream",
- "text": [
- "Theta values for own Ridge implementation\n",
- "[ 1.03032441e+00 6.28336218e-02 -6.24175744e-01 5.21169159e-02\n",
- " 2.80847477e-01 2.12552073e-01 8.13220608e-02 -1.69634577e-02\n",
- " -6.50846112e-02 -7.38962192e-02 -5.94226022e-02 -3.50227564e-02\n",
- " -9.80609616e-03 1.08299273e-02 2.41882037e-02 2.93492130e-02\n",
- " 2.64742912e-02 1.63249532e-02 -5.01831251e-05 -2.15098090e-02]\n",
- "Theta values for Scikit-Learn Ridge implementation\n",
- "[ 1.03032441e+00 6.28336218e-02 -6.24175744e-01 5.21169159e-02\n",
- " 2.80847477e-01 2.12552073e-01 8.13220608e-02 -1.69634577e-02\n",
- " -6.50846112e-02 -7.38962192e-02 -5.94226022e-02 -3.50227564e-02\n",
- " -9.80609615e-03 1.08299273e-02 2.41882037e-02 2.93492130e-02\n",
- " 2.64742912e-02 1.63249532e-02 -5.01831207e-05 -2.15098090e-02]\n",
- "MSE values for own Ridge implementation\n",
- "4.3632959215700067e-07\n",
- "MSE values for Scikit-Learn Ridge implementation\n",
- "4.363295916323784e-07\n",
- "Theta values for own Ridge implementation\n",
- "[ 1.03630548 -0.01963611 -0.37900111 -0.07062318 0.12182967 0.16343471\n",
- " 0.13003291 0.07490892 0.02365049 -0.01449782 -0.03814292 -0.04909093\n",
- " -0.05009826 -0.04389027 -0.03279636 -0.01866537 -0.00289724 0.01348565\n",
- " 0.02976145 0.04543942]\n",
- "Theta values for Scikit-Learn Ridge implementation\n",
- "[ 1.03630548 -0.01963611 -0.37900111 -0.07062318 0.12182967 0.16343471\n",
- " 0.13003291 0.07490892 0.02365049 -0.01449782 -0.03814292 -0.04909093\n",
- " -0.05009826 -0.04389027 -0.03279636 -0.01866537 -0.00289724 0.01348565\n",
- " 0.02976145 0.04543942]\n",
- "MSE values for own Ridge implementation\n",
- "5.194042827197027e-06\n",
- "MSE values for Scikit-Learn Ridge implementation\n",
- "5.1940428268204826e-06\n",
- "Theta values for own Ridge implementation\n",
- "[ 1.04220758 -0.10931453 -0.17641709 -0.06020587 0.02208512 0.05789007\n",
- " 0.06491736 0.05785343 0.04537385 0.03196357 0.01969145 0.00934499\n",
- " 0.00107405 -0.00526348 -0.00992331 -0.01318643 -0.01531845 -0.01655318\n",
- " -0.01708852 -0.01708781]\n",
- "Theta values for Scikit-Learn Ridge implementation\n",
- "[ 1.04220758 -0.10931453 -0.17641709 -0.06020587 0.02208512 0.05789007\n",
- " 0.06491736 0.05785343 0.04537385 0.03196357 0.01969145 0.00934499\n",
- " 0.00107405 -0.00526348 -0.00992331 -0.01318643 -0.01531845 -0.01655318\n",
- " -0.01708852 -0.01708781]\n",
- "MSE values for own Ridge implementation\n",
- "2.0940821989643363e-05\n",
- "MSE values for Scikit-Learn Ridge implementation\n",
- "2.094082198961999e-05\n",
- "Theta values for own Ridge implementation\n",
- "[ 1.01219292 -0.06043581 -0.10391807 -0.05651951 -0.01898855 0.00312361\n",
- " 0.01463049 0.01975848 0.02123176 0.02068067 0.01905883 0.01691985\n",
- " 0.01458337 0.01223198 0.00996754 0.00784393 0.00588657 0.00410387\n",
- " 0.00249435 0.00105081]\n",
- "Theta values for Scikit-Learn Ridge implementation\n",
- "[ 1.01219292 -0.06043581 -0.10391807 -0.05651951 -0.01898855 0.00312361\n",
- " 0.01463049 0.01975848 0.02123176 0.02068067 0.01905883 0.01691985\n",
- " 0.01458337 0.01223198 0.00996754 0.00784393 0.00588657 0.00410387\n",
- " 0.00249435 0.00105081]\n",
- "MSE values for own Ridge implementation\n",
- "0.0003153514830957865\n",
- "MSE values for Scikit-Learn Ridge implementation\n",
- "0.00031535148309580783\n",
- "Theta values for own Ridge implementation\n",
- "[ 8.38916861e-01 1.31276579e-01 8.97497404e-03 -1.72271878e-02\n",
- " -2.11744554e-02 -1.91492986e-02 -1.57201944e-02 -1.23002365e-02\n",
- " -9.30466214e-03 -6.81048318e-03 -4.78184120e-03 -3.15130074e-03\n",
- " -1.84923989e-03 -8.13661243e-04 7.46984697e-06 6.56636616e-04\n",
- " 1.16805821e-03 1.56912044e-03 1.88168312e-03 2.12318726e-03]\n",
- "Theta values for Scikit-Learn Ridge implementation\n",
- "[ 8.38916861e-01 1.31276579e-01 8.97497404e-03 -1.72271878e-02\n",
- " -2.11744554e-02 -1.91492986e-02 -1.57201944e-02 -1.23002365e-02\n",
- " -9.30466214e-03 -6.81048318e-03 -4.78184120e-03 -3.15130074e-03\n",
- " -1.84923989e-03 -8.13661243e-04 7.46984697e-06 6.56636616e-04\n",
- " 1.16805821e-03 1.56912044e-03 1.88168312e-03 2.12318726e-03]\n",
- "MSE values for own Ridge implementation\n",
- "0.015072388895177157\n",
- "MSE values for Scikit-Learn Ridge implementation\n",
- "0.0150723888951771\n",
- "Theta values for own Ridge implementation\n",
- "[0.37396662 0.14174745 0.0764924 0.04892055 0.03447512 0.02586427\n",
- " 0.02024962 0.01633913 0.01347916 0.0113104 0.0096208 0.00827728\n",
- " 0.00719176 0.00630331 0.00556826 0.0049544 0.00443743 0.0039987\n",
- " 0.0036237 0.003301 ]\n",
- "Theta values for Scikit-Learn Ridge implementation\n",
- "[0.37396662 0.14174745 0.0764924 0.04892055 0.03447512 0.02586427\n",
- " 0.02024962 0.01633913 0.01347916 0.0113104 0.0096208 0.00827728\n",
- " 0.00719176 0.00630331 0.00556826 0.0049544 0.00443743 0.0039987\n",
- " 0.0036237 0.003301 ]\n",
- "MSE values for own Ridge implementation\n",
- "0.26409315307910036\n",
- "MSE values for Scikit-Learn Ridge implementation\n",
- "0.26409315307910025\n"
- ]
- },
- {
- "data": {
- "image/png": "iVBORw0KGgoAAAANSUhEUgAAAkAAAAGwCAYAAABB4NqyAAAAOXRFW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KTz88MMATJw4EQB3d3eCg4PNjAhASkoK+fn5AKxfv55Bgwaxe/du/P39AfD09DQznohIqXy3/EN6bn6C678exU//ysbiZs6xGB0BKg+GAadPm3MzjFJF7dSpE6GhoSxatMixbdGiRYSEhNCxY0fHthMnTrB27VomTZpE3759CQsLo0uXLsTFxdG/f3+nfdaqVYvg4GCnW82aNYvMcPz4cR588EHq1KmDr68vVquVPXv2XPgoDerXr8/ChQsd42+66SYaNGjguJ+cnIyHhwenTp0Czq9Sev/99xk4cCC+vr60aNGCJUuWXPGz8PX1JTg4mNDQUAYNGkRUVBTLly93PF7YV2AJCQnccMMN+Pj40LdvX/bv319gv++99x4hISH4+voycOBApkyZQu3atZ3GfPnll4SHh+Pt7U2zZs149dVXOXfuXKE569ev7/hc69atC0CDBg0c23bt2kWvXr3w8fEhJCSE0aNHc/r0acfzZ8yYQYsWLfD29iYoKIi7774bOH9EcNWqVbz55puOo0mFvR8RkfJk2/gJAJ1paFr5ARWg8nHmDPj5mXM7c6bUcR9++GFmz57tuP/hhx/yyCOPOI3x8/PDz8+PL774wulrofIwdOhQNm3axJIlS0hOTsYwDPr160deXh4Wi4VevXqxcuVK4HxZ2rFjB3l5eezYsQM4P+8mPDwcPz8/xz5fffVV7r33XrZt20a/fv24//77CxypKs7WrVtZt24dHh4eRY45cOAAd911F/369SM1NZXhw4fz/PPPO41Zt24dI0eOZMyYMaSmphIVFcVrr73mNGbZsmU88MADjB49mh07djBr1izi4+MLjCuJH374gZiYGO666y62bdvGggULWLt2LU8++SQAmzZtYvTo0UyYMIHdu3eTmJhIr169AHjzzTeJjIxkxIgRpKenk56eTkhISKkziIiUhu3kFgCszWLMDWJIAZmZmQZgZGZmFnjs7Nmzxo4dO4yzZ8/+b+OpU4Zx/ljMtb+dOlXi9/XQQw8ZAwYMMP744w/Dy8vL2Ldvn7F//37D29vb+OOPP4wBAwYYDz30kGP8f//7X6NOnTqGt7e30b17dyMuLs7YunWr0z7DwsIMT09Po2bNmk63b7/9ttA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Z/SOHToEH369CE0NJTXX3+dP/74w/FYcHCwickqr7S0NI4dO0ZaWhr5+fmOc3Fdf/31jn8vXdG4ceMYMmQInTt3JjIyknfffZe0tDTNJyvEqVOn+Pnnnx339+3bR2pqKnXr1i3w33pX9sQTTzB37lwWL15MrVq1HPPJAgIC8PHxufaBTFl7JgXs27dPy+CLsG3bNqNv375G3bp1DS8vL6NJkybGyJEjjd9++83saJXO7NmzDaDQmxTuoYceKvTz+vbbb82OZrq3337bCAsLMzw9PY1OnTqZtly5svv2228L/Rl66KGHzI5WqRT136bZs2ebkkdzgERERMTluN7kABEREXF5KkAiIiLiclSARERExOWoAImIiIjLUQESERERl6MCJCIiIi5HBUhERERcjgqQiIiIuBwVIBEpsT59+jB27FizYxTq6NGjNGjQgP379wOwcuVKLBZLhV/ctKyvEx8fT+3atUv1nIiICBYtWlSq54hI4VSARMQ06enp3HfffbRs2RI3N7ciy9XChQtp06YNXl5etGnThs8//7zAmIkTJ3LHHXfQpEmTig1tohdffJHnn38eu91udhSRKk8FSERMk5OTQ/369Rk/fjwdOnQodExycjKDBw9myJAhbN26lSFDhnDvvfeyYcMGx5izZ8/ywQcfMHz48GsV3RT9+/cnMzOTZcuWmR1FpMpTARKRMjl+/DgPPvggderUwdfXF6vVyp49e5zGvPfee4SEhODr68vAgQOZMmWK09c+TZo04c033+TBBx8kICCg0NeZOnUqUVFRxMXF0apVK+Li4rj11luZOnWqY4zNZqNGjRpERkYWmffo0aP85S9/oXHjxvj6+nLjjTcyb948pzF9+vRh1KhRjB07ljp16hAUFMS7777L6dOnefjhh6lVqxbNmzfHZrMV2P+6devo0KED3t7edO3alR9++MHp8fj4eEJDQx2fxdGjR50e37t3LwMGDCAoKAg/Pz8iIiJYsWKF0xh3d3f69etXILeIlJ4KkIiUydChQ9m0aRNLliwhOTkZwzDo168feXl5wPlCMHLkSMaMGUNqaipRUVG89tprpX6d5ORkoqOjnbbFxMSwfv16x/3Vq1fTuXPnYveTnZ1NeHg4S5cu5ccff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Bx7guuuuY8CAAQCMGjWKhIQEpkyZwp49e5g1axY2m63AUaHU1FRSU1M5deoUf/zxB6mpqU5lZsyYMSxfvpxJkyaxa9cuJk2axIoVK5zOGRQTE8P27duLPQp0/fXXk5SUxPr169m5cyePPfZYgSNLV2PChAl8/fXX/PjjjwwdOpTAwEDuvPNOAEaPHk1iYiKTJ0/mp59+4q233iIxMbFAvkWLFpGamsrWrVu57777Cj3KtGbNmgKTwkWk9FSARKRMZs+eTXh4OLfffjuRkZEYhkFCQoLj66IePXowc+ZMpkyZQocOHUhMTOSpp54qMFenY8eOdOzYkc2bNzN37lw6duxIv379HI93796d+fPnM3v2bNq3b098fDwLFixwmn9044030rlzZz799NMi87744ot06tSJmJgY+vTpQ3BwsKOglId//vOfjBkzhvDwcNLT01myZAmenp4AdOvWjffff5/p06dz0003sXz5cl544QWn57/xxhvUqVOH7t27c8cddxATE1PgSM/BgwdZv349Dz/8cLnlFnFVFqMsX8qLiJTBiBEj2LVrV4Us405ISODpp5/mxx9/xM2tev6/3TPPPENmZibvvvuu2VFEqjxNghaRCvP6668TFRVFzZo1sdlsfPTRR8yYMaNCXqtfv37s2bOHgwcPEhISUiGvYbYGDRrw9NNPmx1DpFrQESARqTD33nsvK1eu5OTJkzRr1oxRo0YxcuRIs2OJiKgAiYiIiOupnl+Ui4iIiBRDBUhERERcjgqQiIiIuBwVIBEREXE5KkAiIiLiclSARERExOWoAImIiIjLUQESERERl/P/AZaP27Xvhj1uAAAAAElFTkSuQmCC",
- "text/plain": [
- ""
- ]
- },
- "metadata": {},
- "output_type": "display_data"
- }
- ],
+ "outputs": [],
"source": [
"%matplotlib inline\n",
"\n",
@@ -973,7 +867,7 @@
},
{
"cell_type": "markdown",
- "id": "8607d736",
+ "id": "85080d04",
"metadata": {
"editable": true
},
@@ -985,7 +879,7 @@
},
{
"cell_type": "markdown",
- "id": "0118b1d0",
+ "id": "cefa4cb7",
"metadata": {
"editable": true
},
@@ -1000,7 +894,7 @@
},
{
"cell_type": "markdown",
- "id": "7328ad62",
+ "id": "10147fa0",
"metadata": {
"editable": true
},
@@ -1012,7 +906,7 @@
},
{
"cell_type": "markdown",
- "id": "110d74ec",
+ "id": "2405041d",
"metadata": {
"editable": true
},
@@ -1022,7 +916,7 @@
},
{
"cell_type": "markdown",
- "id": "43775b2f",
+ "id": "a1a6b707",
"metadata": {
"editable": true
},
@@ -1034,7 +928,7 @@
},
{
"cell_type": "markdown",
- "id": "5d9d7e09",
+ "id": "ae672df8",
"metadata": {
"editable": true
},
@@ -1044,7 +938,7 @@
},
{
"cell_type": "markdown",
- "id": "94ef14bf",
+ "id": "53ea5d3b",
"metadata": {
"editable": true
},
@@ -1056,7 +950,7 @@
},
{
"cell_type": "markdown",
- "id": "b9208f23",
+ "id": "19d5965a",
"metadata": {
"editable": true
},
@@ -1068,7 +962,7 @@
},
{
"cell_type": "markdown",
- "id": "c2c30a84",
+ "id": "20608e44",
"metadata": {
"editable": true
},
@@ -1083,7 +977,7 @@
},
{
"cell_type": "markdown",
- "id": "48697e16",
+ "id": "7a04cc8a",
"metadata": {
"editable": true
},
@@ -1094,7 +988,7 @@
},
{
"cell_type": "markdown",
- "id": "80422083",
+ "id": "77a30599",
"metadata": {
"editable": true
},
@@ -1114,7 +1008,7 @@
},
{
"cell_type": "markdown",
- "id": "34c18fb1",
+ "id": "e97e9982",
"metadata": {
"editable": true
},
@@ -1126,7 +1020,7 @@
},
{
"cell_type": "markdown",
- "id": "ad87f938",
+ "id": "6b89ea8c",
"metadata": {
"editable": true
},
@@ -1136,7 +1030,7 @@
},
{
"cell_type": "markdown",
- "id": "c3fae543",
+ "id": "148873d3",
"metadata": {
"editable": true
},
@@ -1148,7 +1042,7 @@
},
{
"cell_type": "markdown",
- "id": "ed2a3b1e",
+ "id": "b008fef3",
"metadata": {
"editable": true
},
@@ -1177,7 +1071,7 @@
},
{
"cell_type": "markdown",
- "id": "c91325a5",
+ "id": "82103acd",
"metadata": {
"editable": true
},
@@ -1204,7 +1098,7 @@
},
{
"cell_type": "markdown",
- "id": "349d7a8f",
+ "id": "4fea6570",
"metadata": {
"editable": true
},
@@ -1215,13 +1109,10 @@
{
"cell_type": "code",
"execution_count": 2,
- "id": "214c48ce",
+ "id": "ac796dd0",
"metadata": {
"collapsed": false,
- "editable": true,
- "jupyter": {
- "outputs_hidden": false
- }
+ "editable": true
},
"outputs": [],
"source": [
@@ -1258,7 +1149,7 @@
},
{
"cell_type": "markdown",
- "id": "ff572ce1",
+ "id": "db53512b",
"metadata": {
"editable": true
},
@@ -1275,7 +1166,7 @@
},
{
"cell_type": "markdown",
- "id": "32e06c3b",
+ "id": "502d1308",
"metadata": {
"editable": true
},
@@ -1298,7 +1189,7 @@
},
{
"cell_type": "markdown",
- "id": "b32e6b97",
+ "id": "8c2bb770",
"metadata": {
"editable": true
},
@@ -1312,7 +1203,7 @@
},
{
"cell_type": "markdown",
- "id": "69354b1a",
+ "id": "ee7c0203",
"metadata": {
"editable": true
},
@@ -1331,7 +1222,7 @@
},
{
"cell_type": "markdown",
- "id": "1f873fcd",
+ "id": "672a491b",
"metadata": {
"editable": true
},
@@ -1341,7 +1232,7 @@
},
{
"cell_type": "markdown",
- "id": "22ebe1ab",
+ "id": "8e3af41a",
"metadata": {
"editable": true
},
@@ -1353,7 +1244,7 @@
},
{
"cell_type": "markdown",
- "id": "a0dc0d9f",
+ "id": "3c0db076",
"metadata": {
"editable": true
},
@@ -1367,7 +1258,7 @@
},
{
"cell_type": "markdown",
- "id": "168c1b66",
+ "id": "a6c05d18",
"metadata": {
"editable": true
},
@@ -1379,7 +1270,7 @@
},
{
"cell_type": "markdown",
- "id": "50cb9802",
+ "id": "ff6c524a",
"metadata": {
"editable": true
},
@@ -1389,7 +1280,7 @@
},
{
"cell_type": "markdown",
- "id": "1ec29252",
+ "id": "ccca66ed",
"metadata": {
"editable": true
},
@@ -1401,7 +1292,7 @@
},
{
"cell_type": "markdown",
- "id": "a568112a",
+ "id": "da2a1c44",
"metadata": {
"editable": true
},
@@ -1418,7 +1309,7 @@
},
{
"cell_type": "markdown",
- "id": "a20d59ba",
+ "id": "2f2704ab",
"metadata": {
"editable": true
},
@@ -1428,7 +1319,7 @@
},
{
"cell_type": "markdown",
- "id": "cb8f997e",
+ "id": "e7286128",
"metadata": {
"editable": true
},
@@ -1444,7 +1335,7 @@
},
{
"cell_type": "markdown",
- "id": "fcb8b9af",
+ "id": "560e14d4",
"metadata": {
"editable": true
},
@@ -1454,7 +1345,7 @@
},
{
"cell_type": "markdown",
- "id": "07c3b63d",
+ "id": "5f35139c",
"metadata": {
"editable": true
},
@@ -1470,7 +1361,7 @@
},
{
"cell_type": "markdown",
- "id": "7e51e38a",
+ "id": "a5732633",
"metadata": {
"editable": true
},
@@ -1480,7 +1371,7 @@
},
{
"cell_type": "markdown",
- "id": "0e25f153",
+ "id": "cb54add9",
"metadata": {
"editable": true
},
@@ -1496,7 +1387,7 @@
},
{
"cell_type": "markdown",
- "id": "b5e93a92",
+ "id": "f03fc8ea",
"metadata": {
"editable": true
},
@@ -1506,7 +1397,7 @@
},
{
"cell_type": "markdown",
- "id": "b6645d1b",
+ "id": "d686fb8e",
"metadata": {
"editable": true
},
@@ -1523,7 +1414,7 @@
},
{
"cell_type": "markdown",
- "id": "443712ff",
+ "id": "3b44a880",
"metadata": {
"editable": true
},
@@ -1535,7 +1426,7 @@
},
{
"cell_type": "markdown",
- "id": "4eef9305",
+ "id": "d2dcc6d7",
"metadata": {
"editable": true
},
@@ -1547,7 +1438,7 @@
},
{
"cell_type": "markdown",
- "id": "156cfa45",
+ "id": "a2f18583",
"metadata": {
"editable": true
},
@@ -1559,7 +1450,7 @@
},
{
"cell_type": "markdown",
- "id": "9118545b",
+ "id": "1b1b3ce0",
"metadata": {
"editable": true
},
@@ -1569,7 +1460,7 @@
},
{
"cell_type": "markdown",
- "id": "fba158e1",
+ "id": "d96fcd4a",
"metadata": {
"editable": true
},
@@ -1581,7 +1472,7 @@
},
{
"cell_type": "markdown",
- "id": "5322f74b",
+ "id": "98506ca6",
"metadata": {
"editable": true
},
@@ -1593,7 +1484,7 @@
},
{
"cell_type": "markdown",
- "id": "a4d49735",
+ "id": "f7df719c",
"metadata": {
"editable": true
},
@@ -1605,7 +1496,7 @@
},
{
"cell_type": "markdown",
- "id": "67c3cfb9",
+ "id": "1263babe",
"metadata": {
"editable": true
},
@@ -1615,7 +1506,7 @@
},
{
"cell_type": "markdown",
- "id": "48a0f5d7",
+ "id": "13a792f3",
"metadata": {
"editable": true
},
@@ -1627,7 +1518,7 @@
},
{
"cell_type": "markdown",
- "id": "8a837224",
+ "id": "ff69a1d7",
"metadata": {
"editable": true
},
@@ -1637,7 +1528,7 @@
},
{
"cell_type": "markdown",
- "id": "8cb7a1f5",
+ "id": "7e4a31aa",
"metadata": {
"editable": true
},
@@ -1649,7 +1540,7 @@
},
{
"cell_type": "markdown",
- "id": "73000cf9",
+ "id": "50768853",
"metadata": {
"editable": true
},
@@ -1666,7 +1557,7 @@
},
{
"cell_type": "markdown",
- "id": "99fd315b",
+ "id": "e70b34dc",
"metadata": {
"editable": true
},
@@ -1678,7 +1569,7 @@
},
{
"cell_type": "markdown",
- "id": "2c90ca3c",
+ "id": "e505b123",
"metadata": {
"editable": true
},
@@ -1690,7 +1581,7 @@
},
{
"cell_type": "markdown",
- "id": "55edce1b",
+ "id": "e143b570",
"metadata": {
"editable": true
},
@@ -1700,7 +1591,7 @@
},
{
"cell_type": "markdown",
- "id": "8914bdba",
+ "id": "5135ebb4",
"metadata": {
"editable": true
},
@@ -1712,7 +1603,7 @@
},
{
"cell_type": "markdown",
- "id": "2764a6a3",
+ "id": "07ce9ec4",
"metadata": {
"editable": true
},
@@ -1723,7 +1614,7 @@
},
{
"cell_type": "markdown",
- "id": "eb958b83",
+ "id": "80932acf",
"metadata": {
"editable": true
},
@@ -1735,7 +1626,7 @@
},
{
"cell_type": "markdown",
- "id": "4c9a382e",
+ "id": "73eeda35",
"metadata": {
"editable": true
},
@@ -1745,7 +1636,7 @@
},
{
"cell_type": "markdown",
- "id": "85b639fc",
+ "id": "47aff789",
"metadata": {
"editable": true
},
@@ -1757,7 +1648,7 @@
},
{
"cell_type": "markdown",
- "id": "22b5186f",
+ "id": "2460c817",
"metadata": {
"editable": true
},
@@ -1767,7 +1658,7 @@
},
{
"cell_type": "markdown",
- "id": "8c769dd3",
+ "id": "5e3b0d9c",
"metadata": {
"editable": true
},
@@ -1779,7 +1670,7 @@
},
{
"cell_type": "markdown",
- "id": "07c98da1",
+ "id": "fbf2cb86",
"metadata": {
"editable": true
},
@@ -1790,7 +1681,7 @@
},
{
"cell_type": "markdown",
- "id": "b72b4794",
+ "id": "ebce4ea0",
"metadata": {
"editable": true
},
@@ -1802,7 +1693,7 @@
},
{
"cell_type": "markdown",
- "id": "ca243c34",
+ "id": "2795da2d",
"metadata": {
"editable": true
},
@@ -1820,7 +1711,7 @@
},
{
"cell_type": "markdown",
- "id": "a32f8cb4",
+ "id": "6a26ccff",
"metadata": {
"editable": true
},
@@ -1833,7 +1724,7 @@
},
{
"cell_type": "markdown",
- "id": "36a5761e",
+ "id": "702137ae",
"metadata": {
"editable": true
},
@@ -1845,7 +1736,7 @@
},
{
"cell_type": "markdown",
- "id": "78a25fba",
+ "id": "6df222d6",
"metadata": {
"editable": true
},
@@ -1855,7 +1746,7 @@
},
{
"cell_type": "markdown",
- "id": "dc3fc392",
+ "id": "9cc370f4",
"metadata": {
"editable": true
},
@@ -1868,7 +1759,7 @@
},
{
"cell_type": "markdown",
- "id": "776a6b1b",
+ "id": "9a71ac65",
"metadata": {
"editable": true
},
@@ -1878,7 +1769,7 @@
},
{
"cell_type": "markdown",
- "id": "d5e49536",
+ "id": "c4242498",
"metadata": {
"editable": true
},
@@ -1890,7 +1781,7 @@
},
{
"cell_type": "markdown",
- "id": "5114d169",
+ "id": "6deb1e52",
"metadata": {
"editable": true
},
@@ -1903,7 +1794,7 @@
},
{
"cell_type": "markdown",
- "id": "4b46be4a",
+ "id": "4b9320dd",
"metadata": {
"editable": true
},
@@ -1916,7 +1807,7 @@
},
{
"cell_type": "markdown",
- "id": "2548fc2e",
+ "id": "43cca84c",
"metadata": {
"editable": true
},
@@ -1928,7 +1819,7 @@
},
{
"cell_type": "markdown",
- "id": "f10e0754",
+ "id": "91672a95",
"metadata": {
"editable": true
},
@@ -1940,7 +1831,7 @@
},
{
"cell_type": "markdown",
- "id": "24e5a851",
+ "id": "f3e9c0e4",
"metadata": {
"editable": true
},
@@ -1950,7 +1841,7 @@
},
{
"cell_type": "markdown",
- "id": "abadd06e",
+ "id": "0cc6fab9",
"metadata": {
"editable": true
},
@@ -1963,7 +1854,7 @@
},
{
"cell_type": "markdown",
- "id": "b310538d",
+ "id": "71f360d2",
"metadata": {
"editable": true
},
@@ -1975,7 +1866,7 @@
},
{
"cell_type": "markdown",
- "id": "993d85b7",
+ "id": "7a27d39c",
"metadata": {
"editable": true
},
@@ -1987,7 +1878,7 @@
},
{
"cell_type": "markdown",
- "id": "90863588",
+ "id": "d554f3b2",
"metadata": {
"editable": true
},
@@ -2004,7 +1895,7 @@
},
{
"cell_type": "markdown",
- "id": "9961c60f",
+ "id": "e9597e67",
"metadata": {
"editable": true
},
@@ -2016,7 +1907,7 @@
},
{
"cell_type": "markdown",
- "id": "e0baa289",
+ "id": "d0c80c08",
"metadata": {
"editable": true
},
@@ -2026,7 +1917,7 @@
},
{
"cell_type": "markdown",
- "id": "9ae92883",
+ "id": "2b33f0e5",
"metadata": {
"editable": true
},
@@ -2038,7 +1929,7 @@
},
{
"cell_type": "markdown",
- "id": "253eb07f",
+ "id": "7db2a530",
"metadata": {
"editable": true
},
@@ -2048,7 +1939,7 @@
},
{
"cell_type": "markdown",
- "id": "4a4694a8",
+ "id": "177b3058",
"metadata": {
"editable": true
},
@@ -2060,7 +1951,7 @@
},
{
"cell_type": "markdown",
- "id": "d8ba62af",
+ "id": "304c0b90",
"metadata": {
"editable": true
},
@@ -2072,7 +1963,7 @@
},
{
"cell_type": "markdown",
- "id": "7a152478",
+ "id": "14936ac3",
"metadata": {
"editable": true
},
@@ -2088,7 +1979,7 @@
},
{
"cell_type": "markdown",
- "id": "2dad5d0d",
+ "id": "797ca0aa",
"metadata": {
"editable": true
},
@@ -2100,7 +1991,7 @@
},
{
"cell_type": "markdown",
- "id": "4d51dc36",
+ "id": "a469a907",
"metadata": {
"editable": true
},
@@ -2112,7 +2003,7 @@
},
{
"cell_type": "markdown",
- "id": "fb0636bb",
+ "id": "e9452a64",
"metadata": {
"editable": true
},
@@ -2122,7 +2013,7 @@
},
{
"cell_type": "markdown",
- "id": "3e787280",
+ "id": "699b712d",
"metadata": {
"editable": true
},
@@ -2134,7 +2025,7 @@
},
{
"cell_type": "markdown",
- "id": "c4c794e7",
+ "id": "e4af99e7",
"metadata": {
"editable": true
},
@@ -2144,7 +2035,7 @@
},
{
"cell_type": "markdown",
- "id": "2d780f46",
+ "id": "a5a8ee8c",
"metadata": {
"editable": true
},
@@ -2156,7 +2047,7 @@
},
{
"cell_type": "markdown",
- "id": "27f0b04d",
+ "id": "03c00df5",
"metadata": {
"editable": true
},
@@ -2173,7 +2064,7 @@
},
{
"cell_type": "markdown",
- "id": "e6736c46",
+ "id": "023042c7",
"metadata": {
"editable": true
},
@@ -2185,7 +2076,7 @@
},
{
"cell_type": "markdown",
- "id": "d30ef5ac",
+ "id": "b0cd7107",
"metadata": {
"editable": true
},
@@ -2197,7 +2088,7 @@
},
{
"cell_type": "markdown",
- "id": "d9e09aac",
+ "id": "4c34ce5f",
"metadata": {
"editable": true
},
@@ -2207,7 +2098,7 @@
},
{
"cell_type": "markdown",
- "id": "936a99a1",
+ "id": "d489ea51",
"metadata": {
"editable": true
},
@@ -2219,7 +2110,7 @@
},
{
"cell_type": "markdown",
- "id": "acd780b1",
+ "id": "9921bc50",
"metadata": {
"editable": true
},
@@ -2229,7 +2120,7 @@
},
{
"cell_type": "markdown",
- "id": "ee8c183a",
+ "id": "c568250e",
"metadata": {
"editable": true
},
@@ -2241,7 +2132,7 @@
},
{
"cell_type": "markdown",
- "id": "aab1f387",
+ "id": "21d0b485",
"metadata": {
"editable": true
},
@@ -2251,7 +2142,7 @@
},
{
"cell_type": "markdown",
- "id": "56a08fe6",
+ "id": "6722483b",
"metadata": {
"editable": true
},
@@ -2263,7 +2154,7 @@
},
{
"cell_type": "markdown",
- "id": "3a7376bf",
+ "id": "9777f5cc",
"metadata": {
"editable": true
},
@@ -2273,7 +2164,7 @@
},
{
"cell_type": "markdown",
- "id": "030fc2c9",
+ "id": "23101fe6",
"metadata": {
"editable": true
},
@@ -2285,17 +2176,1146 @@
},
{
"cell_type": "markdown",
- "id": "1146c162",
+ "id": "4f604170",
"metadata": {
"editable": true
},
"source": [
- "This equation does not lead to a nice analytical equation as in either Ridge regression or ordinary least squares. This equation can however be solved by using standard convex optimization algorithms.We will discuss how to code the above methods using gardient descent methods."
+ "This equation does not lead to a nice analytical equation as in either Ridge regression or ordinary least squares. This equation can however be solved by using standard convex optimization algorithms.We will discuss how to code the above methods using gradient descent methods."
]
},
{
"cell_type": "markdown",
- "id": "d58c9fcc",
+ "id": "5c7b9070",
+ "metadata": {
+ "editable": true
+ },
+ "source": [
+ "## Optimization and gradient descent, the central part of any Machine Learning algortithm\n",
+ "\n",
+ "Almost every problem in machine learning and data science starts with\n",
+ "a dataset $X$, a model $g(\\theta)$, which is a function of the\n",
+ "parameters $\\theta$ and a cost function $C(X, g(\\theta))$ that allows\n",
+ "us to judge how well the model $g(\\theta)$ explains the observations\n",
+ "$X$. The model is fit by finding the values of $\\theta$ that minimize\n",
+ "the cost function. Ideally we would be able to solve for $\\theta$\n",
+ "analytically, however this is not possible in general and we must use\n",
+ "some approximative/numerical method to compute the minimum."
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "id": "0af8105c",
+ "metadata": {
+ "editable": true
+ },
+ "source": [
+ "## Reminder on Newton-Raphson's method\n",
+ "\n",
+ "Let us quickly remind ourselves how we derive the above method.\n",
+ "\n",
+ "Perhaps the most celebrated of all one-dimensional root-finding\n",
+ "routines is Newton's method, also called the Newton-Raphson\n",
+ "method. This method requires the evaluation of both the\n",
+ "function $f$ and its derivative $f'$ at arbitrary points. \n",
+ "If you can only calculate the derivative\n",
+ "numerically and/or your function is not of the smooth type, we\n",
+ "normally discourage the use of this method."
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "id": "c93d44b0",
+ "metadata": {
+ "editable": true
+ },
+ "source": [
+ "## The equations\n",
+ "\n",
+ "The Newton-Raphson formula consists geometrically of extending the\n",
+ "tangent line at a current point until it crosses zero, then setting\n",
+ "the next guess to the abscissa of that zero-crossing. The mathematics\n",
+ "behind this method is rather simple. Employing a Taylor expansion for\n",
+ "$x$ sufficiently close to the solution $s$, we have"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "id": "b1c868cd",
+ "metadata": {
+ "editable": true
+ },
+ "source": [
+ "\n",
+ "\n",
+ "\n",
+ "$$\n",
+ "f(s)=0=f(x)+(s-x)f'(x)+\\frac{(s-x)^2}{2}f''(x) +\\dots.\n",
+ " \\label{eq:taylornr} \\tag{2}\n",
+ "$$"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "id": "7c257671",
+ "metadata": {
+ "editable": true
+ },
+ "source": [
+ "For small enough values of the function and for well-behaved\n",
+ "functions, the terms beyond linear are unimportant, hence we obtain"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "id": "ddc77aef",
+ "metadata": {
+ "editable": true
+ },
+ "source": [
+ "$$\n",
+ "f(x)+(s-x)f'(x)\\approx 0,\n",
+ "$$"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "id": "026777a7",
+ "metadata": {
+ "editable": true
+ },
+ "source": [
+ "yielding"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "id": "3707790b",
+ "metadata": {
+ "editable": true
+ },
+ "source": [
+ "$$\n",
+ "s\\approx x-\\frac{f(x)}{f'(x)}.\n",
+ "$$"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "id": "13ab6bec",
+ "metadata": {
+ "editable": true
+ },
+ "source": [
+ "Having in mind an iterative procedure, it is natural to start iterating with"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "id": "0a6d69ef",
+ "metadata": {
+ "editable": true
+ },
+ "source": [
+ "$$\n",
+ "x_{n+1}=x_n-\\frac{f(x_n)}{f'(x_n)}.\n",
+ "$$"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "id": "336ec1b1",
+ "metadata": {
+ "editable": true
+ },
+ "source": [
+ "## Simple geometric interpretation\n",
+ "\n",
+ "The above is Newton-Raphson's method. It has a simple geometric\n",
+ "interpretation, namely $x_{n+1}$ is the point where the tangent from\n",
+ "$(x_n,f(x_n))$ crosses the $x$-axis. Close to the solution,\n",
+ "Newton-Raphson converges fast to the desired result. However, if we\n",
+ "are far from a root, where the higher-order terms in the series are\n",
+ "important, the Newton-Raphson formula can give grossly inaccurate\n",
+ "results. For instance, the initial guess for the root might be so far\n",
+ "from the true root as to let the search interval include a local\n",
+ "maximum or minimum of the function. If an iteration places a trial\n",
+ "guess near such a local extremum, so that the first derivative nearly\n",
+ "vanishes, then Newton-Raphson may fail totally"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "id": "3081ba44",
+ "metadata": {
+ "editable": true
+ },
+ "source": [
+ "## Extending to more than one variable\n",
+ "\n",
+ "Newton's method can be generalized to systems of several non-linear equations\n",
+ "and variables. Consider the case with two equations"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "id": "5c3faff2",
+ "metadata": {
+ "editable": true
+ },
+ "source": [
+ "$$\n",
+ "\\begin{array}{cc} f_1(x_1,x_2) &=0\\\\\n",
+ " f_2(x_1,x_2) &=0,\\end{array}\n",
+ "$$"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "id": "68fd52c0",
+ "metadata": {
+ "editable": true
+ },
+ "source": [
+ "which we Taylor expand to obtain"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "id": "5e29a567",
+ "metadata": {
+ "editable": true
+ },
+ "source": [
+ "$$\n",
+ "\\begin{array}{cc} 0=f_1(x_1+h_1,x_2+h_2)=&f_1(x_1,x_2)+h_1\n",
+ " \\partial f_1/\\partial x_1+h_2\n",
+ " \\partial f_1/\\partial x_2+\\dots\\\\\n",
+ " 0=f_2(x_1+h_1,x_2+h_2)=&f_2(x_1,x_2)+h_1\n",
+ " \\partial f_2/\\partial x_1+h_2\n",
+ " \\partial f_2/\\partial x_2+\\dots\n",
+ " \\end{array}.\n",
+ "$$"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "id": "f787c3a2",
+ "metadata": {
+ "editable": true
+ },
+ "source": [
+ "Defining the Jacobian matrix ${\\bf \\boldsymbol{J}}$ we have"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "id": "1c5e1214",
+ "metadata": {
+ "editable": true
+ },
+ "source": [
+ "$$\n",
+ "{\\bf \\boldsymbol{J}}=\\left( \\begin{array}{cc}\n",
+ " \\partial f_1/\\partial x_1 & \\partial f_1/\\partial x_2 \\\\\n",
+ " \\partial f_2/\\partial x_1 &\\partial f_2/\\partial x_2\n",
+ " \\end{array} \\right),\n",
+ "$$"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "id": "1cdd5ba1",
+ "metadata": {
+ "editable": true
+ },
+ "source": [
+ "we can rephrase Newton's method as"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "id": "276e07a3",
+ "metadata": {
+ "editable": true
+ },
+ "source": [
+ "$$\n",
+ "\\left(\\begin{array}{c} x_1^{n+1} \\\\ x_2^{n+1} \\end{array} \\right)=\n",
+ "\\left(\\begin{array}{c} x_1^{n} \\\\ x_2^{n} \\end{array} \\right)+\n",
+ "\\left(\\begin{array}{c} h_1^{n} \\\\ h_2^{n} \\end{array} \\right),\n",
+ "$$"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "id": "80fe7f13",
+ "metadata": {
+ "editable": true
+ },
+ "source": [
+ "where we have defined"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "id": "e8838b8f",
+ "metadata": {
+ "editable": true
+ },
+ "source": [
+ "$$\n",
+ "\\left(\\begin{array}{c} h_1^{n} \\\\ h_2^{n} \\end{array} \\right)=\n",
+ " -{\\bf \\boldsymbol{J}}^{-1}\n",
+ " \\left(\\begin{array}{c} f_1(x_1^{n},x_2^{n}) \\\\ f_2(x_1^{n},x_2^{n}) \\end{array} \\right).\n",
+ "$$"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "id": "2ed6fbd0",
+ "metadata": {
+ "editable": true
+ },
+ "source": [
+ "We need thus to compute the inverse of the Jacobian matrix and it\n",
+ "is to understand that difficulties may\n",
+ "arise in case ${\\bf \\boldsymbol{J}}$ is nearly singular.\n",
+ "\n",
+ "It is rather straightforward to extend the above scheme to systems of\n",
+ "more than two non-linear equations. In our case, the Jacobian matrix is given by the Hessian that represents the second derivative of cost function."
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "id": "0796429c",
+ "metadata": {
+ "editable": true
+ },
+ "source": [
+ "## Steepest descent\n",
+ "\n",
+ "The basic idea of gradient descent is\n",
+ "that a function $F(\\mathbf{x})$, \n",
+ "$\\mathbf{x} \\equiv (x_1,\\cdots,x_n)$, decreases fastest if one goes from $\\bf {x}$ in the\n",
+ "direction of the negative gradient $-\\nabla F(\\mathbf{x})$.\n",
+ "\n",
+ "It can be shown that if"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "id": "fc44df4f",
+ "metadata": {
+ "editable": true
+ },
+ "source": [
+ "$$\n",
+ "\\mathbf{x}_{k+1} = \\mathbf{x}_k - \\gamma_k \\nabla F(\\mathbf{x}_k),\n",
+ "$$"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "id": "c88146a9",
+ "metadata": {
+ "editable": true
+ },
+ "source": [
+ "with $\\gamma_k > 0$.\n",
+ "\n",
+ "For $\\gamma_k$ small enough, then $F(\\mathbf{x}_{k+1}) \\leq\n",
+ "F(\\mathbf{x}_k)$. This means that for a sufficiently small $\\gamma_k$\n",
+ "we are always moving towards smaller function values, i.e a minimum."
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "id": "d1b85445",
+ "metadata": {
+ "editable": true
+ },
+ "source": [
+ "## More on Steepest descent\n",
+ "\n",
+ "The previous observation is the basis of the method of steepest\n",
+ "descent, which is also referred to as just gradient descent (GD). One\n",
+ "starts with an initial guess $\\mathbf{x}_0$ for a minimum of $F$ and\n",
+ "computes new approximations according to"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "id": "8edde795",
+ "metadata": {
+ "editable": true
+ },
+ "source": [
+ "$$\n",
+ "\\mathbf{x}_{k+1} = \\mathbf{x}_k - \\gamma_k \\nabla F(\\mathbf{x}_k), \\ \\ k \\geq 0.\n",
+ "$$"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "id": "f92e4583",
+ "metadata": {
+ "editable": true
+ },
+ "source": [
+ "The parameter $\\gamma_k$ is often referred to as the step length or\n",
+ "the learning rate within the context of Machine Learning."
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "id": "0bf80264",
+ "metadata": {
+ "editable": true
+ },
+ "source": [
+ "## The ideal\n",
+ "\n",
+ "Ideally the sequence $\\{\\mathbf{x}_k \\}_{k=0}$ converges to a global\n",
+ "minimum of the function $F$. In general we do not know if we are in a\n",
+ "global or local minimum. In the special case when $F$ is a convex\n",
+ "function, all local minima are also global minima, so in this case\n",
+ "gradient descent can converge to the global solution. The advantage of\n",
+ "this scheme is that it is conceptually simple and straightforward to\n",
+ "implement. However the method in this form has some severe\n",
+ "limitations:\n",
+ "\n",
+ "In machine learing we are often faced with non-convex high dimensional\n",
+ "cost functions with many local minima. Since GD is deterministic we\n",
+ "will get stuck in a local minimum, if the method converges, unless we\n",
+ "have a very good intial guess. This also implies that the scheme is\n",
+ "sensitive to the chosen initial condition.\n",
+ "\n",
+ "Note that the gradient is a function of $\\mathbf{x} =\n",
+ "(x_1,\\cdots,x_n)$ which makes it expensive to compute numerically."
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "id": "5b6b24c7",
+ "metadata": {
+ "editable": true
+ },
+ "source": [
+ "## The sensitiveness of the gradient descent\n",
+ "\n",
+ "The gradient descent method \n",
+ "is sensitive to the choice of learning rate $\\gamma_k$. This is due\n",
+ "to the fact that we are only guaranteed that $F(\\mathbf{x}_{k+1}) \\leq\n",
+ "F(\\mathbf{x}_k)$ for sufficiently small $\\gamma_k$. The problem is to\n",
+ "determine an optimal learning rate. If the learning rate is chosen too\n",
+ "small the method will take a long time to converge and if it is too\n",
+ "large we can experience erratic behavior.\n",
+ "\n",
+ "Many of these shortcomings can be alleviated by introducing\n",
+ "randomness. One such method is that of Stochastic Gradient Descent\n",
+ "(SGD), to be discussed next week."
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "id": "e36297bd",
+ "metadata": {
+ "editable": true
+ },
+ "source": [
+ "## Convex functions\n",
+ "\n",
+ "Ideally we want our cost/loss function to be convex(concave).\n",
+ "\n",
+ "First we give the definition of a convex set: A set $C$ in\n",
+ "$\\mathbb{R}^n$ is said to be convex if, for all $x$ and $y$ in $C$ and\n",
+ "all $t \\in (0,1)$ , the point $(1 − t)x + ty$ also belongs to\n",
+ "C. Geometrically this means that every point on the line segment\n",
+ "connecting $x$ and $y$ is in $C$ as discussed below.\n",
+ "\n",
+ "The convex subsets of $\\mathbb{R}$ are the intervals of\n",
+ "$\\mathbb{R}$. Examples of convex sets of $\\mathbb{R}^2$ are the\n",
+ "regular polygons (triangles, rectangles, pentagons, etc...)."
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "id": "f8ec331d",
+ "metadata": {
+ "editable": true
+ },
+ "source": [
+ "## Convex function\n",
+ "\n",
+ "**Convex function**: Let $X \\subset \\mathbb{R}^n$ be a convex set. Assume that the function $f: X \\rightarrow \\mathbb{R}$ is continuous, then $f$ is said to be convex if $$f(tx_1 + (1-t)x_2) \\leq tf(x_1) + (1-t)f(x_2) $$ for all $x_1, x_2 \\in X$ and for all $t \\in [0,1]$. If $\\leq$ is replaced with a strict inequaltiy in the definition, we demand $x_1 \\neq x_2$ and $t\\in(0,1)$ then $f$ is said to be strictly convex. For a single variable function, convexity means that if you draw a straight line connecting $f(x_1)$ and $f(x_2)$, the value of the function on the interval $[x_1,x_2]$ is always below the line as illustrated below."
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "id": "0b0d0c67",
+ "metadata": {
+ "editable": true
+ },
+ "source": [
+ "## Conditions on convex functions\n",
+ "\n",
+ "In the following we state first and second-order conditions which\n",
+ "ensures convexity of a function $f$. We write $D_f$ to denote the\n",
+ "domain of $f$, i.e the subset of $R^n$ where $f$ is defined. For more\n",
+ "details and proofs we refer to: [S. Boyd and L. Vandenberghe. Convex Optimization. Cambridge University Press](http://stanford.edu/boyd/cvxbook/, 2004).\n",
+ "\n",
+ "**First order condition.**\n",
+ "\n",
+ "Suppose $f$ is differentiable (i.e $\\nabla f(x)$ is well defined for\n",
+ "all $x$ in the domain of $f$). Then $f$ is convex if and only if $D_f$\n",
+ "is a convex set and $$f(y) \\geq f(x) + \\nabla f(x)^T (y-x) $$ holds\n",
+ "for all $x,y \\in D_f$. This condition means that for a convex function\n",
+ "the first order Taylor expansion (right hand side above) at any point\n",
+ "a global under estimator of the function. To convince yourself you can\n",
+ "make a drawing of $f(x) = x^2+1$ and draw the tangent line to $f(x)$ and\n",
+ "note that it is always below the graph.\n",
+ "\n",
+ "**Second order condition.**\n",
+ "\n",
+ "Assume that $f$ is twice\n",
+ "differentiable, i.e the Hessian matrix exists at each point in\n",
+ "$D_f$. Then $f$ is convex if and only if $D_f$ is a convex set and its\n",
+ "Hessian is positive semi-definite for all $x\\in D_f$. For a\n",
+ "single-variable function this reduces to $f''(x) \\geq 0$. Geometrically this means that $f$ has nonnegative curvature\n",
+ "everywhere.\n",
+ "\n",
+ "This condition is particularly useful since it gives us an procedure for determining if the function under consideration is convex, apart from using the definition."
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "id": "bdfac28b",
+ "metadata": {
+ "editable": true
+ },
+ "source": [
+ "## More on convex functions\n",
+ "\n",
+ "The next result is of great importance to us and the reason why we are\n",
+ "going on about convex functions. In machine learning we frequently\n",
+ "have to minimize a loss/cost function in order to find the best\n",
+ "parameters for the model we are considering. \n",
+ "\n",
+ "Ideally we want the\n",
+ "global minimum (for high-dimensional models it is hard to know\n",
+ "if we have local or global minimum). However, if the cost/loss function\n",
+ "is convex the following result provides invaluable information:\n",
+ "\n",
+ "**Any minimum is global for convex functions.**\n",
+ "\n",
+ "Consider the problem of finding $x \\in \\mathbb{R}^n$ such that $f(x)$\n",
+ "is minimal, where $f$ is convex and differentiable. Then, any point\n",
+ "$x^*$ that satisfies $\\nabla f(x^*) = 0$ is a global minimum.\n",
+ "\n",
+ "This result means that if we know that the cost/loss function is convex and we are able to find a minimum, we are guaranteed that it is a global minimum."
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "id": "2032fb83",
+ "metadata": {
+ "editable": true
+ },
+ "source": [
+ "## Some simple problems\n",
+ "\n",
+ "1. Show that $f(x)=x^2$ is convex for $x \\in \\mathbb{R}$ using the definition of convexity. Hint: If you re-write the definition, $f$ is convex if the following holds for all $x,y \\in D_f$ and any $\\lambda \\in [0,1]$ $\\lambda f(x)+(1-\\lambda)f(y)-f(\\lambda x + (1-\\lambda) y ) \\geq 0$.\n",
+ "\n",
+ "2. Using the second order condition show that the following functions are convex on the specified domain.\n",
+ "\n",
+ " * $f(x) = e^x$ is convex for $x \\in \\mathbb{R}$.\n",
+ "\n",
+ " * $g(x) = -\\ln(x)$ is convex for $x \\in (0,\\infty)$.\n",
+ "\n",
+ "3. Let $f(x) = x^2$ and $g(x) = e^x$. Show that $f(g(x))$ and $g(f(x))$ is convex for $x \\in \\mathbb{R}$. Also show that if $f(x)$ is any convex function than $h(x) = e^{f(x)}$ is convex.\n",
+ "\n",
+ "4. A norm is any function that satisfy the following properties\n",
+ "\n",
+ " * $f(\\alpha x) = |\\alpha| f(x)$ for all $\\alpha \\in \\mathbb{R}$.\n",
+ "\n",
+ " * $f(x+y) \\leq f(x) + f(y)$\n",
+ "\n",
+ " * $f(x) \\leq 0$ for all $x \\in \\mathbb{R}^n$ with equality if and only if $x = 0$\n",
+ "\n",
+ "Using the definition of convexity, try to show that a function satisfying the properties above is convex (the third condition is not needed to show this)."
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "id": "f5a00d18",
+ "metadata": {
+ "editable": true
+ },
+ "source": [
+ "## Revisiting Ordinary Least Squares\n",
+ "\n",
+ "We will use linear regression as a case study for the gradient descent\n",
+ "methods. Linear regression is a great test case for the gradient\n",
+ "descent methods discussed in the lectures since it has several\n",
+ "desirable properties such as:\n",
+ "\n",
+ "1. An analytical solution (recall homework sets for week 35).\n",
+ "\n",
+ "2. The gradient can be computed analytically.\n",
+ "\n",
+ "3. The cost function is convex which guarantees that gradient descent converges for small enough learning rates\n",
+ "\n",
+ "We revisit an example similar to what we had in the first homework set. We had a function of the type"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 3,
+ "id": "68f97538",
+ "metadata": {
+ "collapsed": false,
+ "editable": true
+ },
+ "outputs": [],
+ "source": [
+ "x = 2*np.random.rand(m,1)\n",
+ "y = 4+3*x+np.random.randn(m,1)"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "id": "a7fbe32f",
+ "metadata": {
+ "editable": true
+ },
+ "source": [
+ "with $x_i \\in [0,1] $ is chosen randomly using a uniform distribution. Additionally we have a stochastic noise chosen according to a normal distribution $\\cal {N}(0,1)$. \n",
+ "The linear regression model is given by"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "id": "1b64af25",
+ "metadata": {
+ "editable": true
+ },
+ "source": [
+ "$$\n",
+ "h_\\theta(x) = \\boldsymbol{y} = \\theta_0 + \\theta_1 x,\n",
+ "$$"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "id": "ef56e132",
+ "metadata": {
+ "editable": true
+ },
+ "source": [
+ "such that"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "id": "6d7f0c20",
+ "metadata": {
+ "editable": true
+ },
+ "source": [
+ "$$\n",
+ "\\boldsymbol{y}_i = \\theta_0 + \\theta_1 x_i.\n",
+ "$$"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "id": "3ac315d2",
+ "metadata": {
+ "editable": true
+ },
+ "source": [
+ "## Gradient descent example\n",
+ "\n",
+ "Let $\\mathbf{y} = (y_1,\\cdots,y_n)^T$, $\\mathbf{\\boldsymbol{y}} = (\\boldsymbol{y}_1,\\cdots,\\boldsymbol{y}_n)^T$ and $\\theta = (\\theta_0, \\theta_1)^T$\n",
+ "\n",
+ "It is convenient to write $\\mathbf{\\boldsymbol{y}} = X\\theta$ where $X \\in \\mathbb{R}^{100 \\times 2} $ is the design matrix given by (we keep the intercept here)"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "id": "040d030b",
+ "metadata": {
+ "editable": true
+ },
+ "source": [
+ "$$\n",
+ "X \\equiv \\begin{bmatrix}\n",
+ "1 & x_1 \\\\\n",
+ "\\vdots & \\vdots \\\\\n",
+ "1 & x_{100} & \\\\\n",
+ "\\end{bmatrix}.\n",
+ "$$"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "id": "1cb9c213",
+ "metadata": {
+ "editable": true
+ },
+ "source": [
+ "The cost/loss/risk function is given by ("
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "id": "7f6ab192",
+ "metadata": {
+ "editable": true
+ },
+ "source": [
+ "$$\n",
+ "C(\\theta) = \\frac{1}{n}||X\\theta-\\mathbf{y}||_{2}^{2} = \\frac{1}{n}\\sum_{i=1}^{100}\\left[ (\\theta_0 + \\theta_1 x_i)^2 - 2 y_i (\\theta_0 + \\theta_1 x_i) + y_i^2\\right]\n",
+ "$$"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "id": "bc154729",
+ "metadata": {
+ "editable": true
+ },
+ "source": [
+ "and we want to find $\\theta$ such that $C(\\theta)$ is minimized."
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "id": "cda14c18",
+ "metadata": {
+ "editable": true
+ },
+ "source": [
+ "## The derivative of the cost/loss function\n",
+ "\n",
+ "Computing $\\partial C(\\theta) / \\partial \\theta_0$ and $\\partial C(\\theta) / \\partial \\theta_1$ we can show that the gradient can be written as"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "id": "ffc6db98",
+ "metadata": {
+ "editable": true
+ },
+ "source": [
+ "$$\n",
+ "\\nabla_{\\theta} C(\\theta) = \\frac{2}{n}\\begin{bmatrix} \\sum_{i=1}^{100} \\left(\\theta_0+\\theta_1x_i-y_i\\right) \\\\\n",
+ "\\sum_{i=1}^{100}\\left( x_i (\\theta_0+\\theta_1x_i)-y_ix_i\\right) \\\\\n",
+ "\\end{bmatrix} = \\frac{2}{n}X^T(X\\theta - \\mathbf{y}),\n",
+ "$$"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "id": "f5dd4f8d",
+ "metadata": {
+ "editable": true
+ },
+ "source": [
+ "where $X$ is the design matrix defined above."
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "id": "54cf8a09",
+ "metadata": {
+ "editable": true
+ },
+ "source": [
+ "## The Hessian matrix\n",
+ "The Hessian matrix of $C(\\theta)$ is given by"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "id": "c06fcb28",
+ "metadata": {
+ "editable": true
+ },
+ "source": [
+ "$$\n",
+ "\\boldsymbol{H} \\equiv \\begin{bmatrix}\n",
+ "\\frac{\\partial^2 C(\\theta)}{\\partial \\theta_0^2} & \\frac{\\partial^2 C(\\theta)}{\\partial \\theta_0 \\partial \\theta_1} \\\\\n",
+ "\\frac{\\partial^2 C(\\theta)}{\\partial \\theta_0 \\partial \\theta_1} & \\frac{\\partial^2 C(\\theta)}{\\partial \\theta_1^2} & \\\\\n",
+ "\\end{bmatrix} = \\frac{2}{n}X^T X.\n",
+ "$$"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "id": "16b2e122",
+ "metadata": {
+ "editable": true
+ },
+ "source": [
+ "This result implies that $C(\\theta)$ is a convex function since the matrix $X^T X$ always is positive semi-definite."
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "id": "9e48ac99",
+ "metadata": {
+ "editable": true
+ },
+ "source": [
+ "## Simple program\n",
+ "\n",
+ "We can now write a program that minimizes $C(\\theta)$ using the gradient descent method with a constant learning rate $\\gamma$ according to"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "id": "9a536e9c",
+ "metadata": {
+ "editable": true
+ },
+ "source": [
+ "$$\n",
+ "\\theta_{k+1} = \\theta_k - \\gamma \\nabla_\\theta C(\\theta_k), \\ k=0,1,\\cdots\n",
+ "$$"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "id": "e9afa223",
+ "metadata": {
+ "editable": true
+ },
+ "source": [
+ "We can use the expression we computed for the gradient and let use a\n",
+ "$\\theta_0$ be chosen randomly and let $\\gamma = 0.001$. Stop iterating\n",
+ "when $||\\nabla_\\theta C(\\theta_k) || \\leq \\epsilon = 10^{-8}$. **Note that the code below does not include the latter stop criterion**.\n",
+ "\n",
+ "And finally we can compare our solution for $\\theta$ with the analytic result given by \n",
+ "$\\theta= (X^TX)^{-1} X^T \\mathbf{y}$."
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "id": "f4f76d91",
+ "metadata": {
+ "editable": true
+ },
+ "source": [
+ "## Gradient Descent Example\n",
+ "\n",
+ "Here our simple example"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 4,
+ "id": "801ec4de",
+ "metadata": {
+ "collapsed": false,
+ "editable": true
+ },
+ "outputs": [],
+ "source": [
+ "\n",
+ "# Importing various packages\n",
+ "from random import random, seed\n",
+ "import numpy as np\n",
+ "import matplotlib.pyplot as plt\n",
+ "from mpl_toolkits.mplot3d import Axes3D\n",
+ "from matplotlib import cm\n",
+ "from matplotlib.ticker import LinearLocator, FormatStrFormatter\n",
+ "import sys\n",
+ "\n",
+ "# the number of datapoints\n",
+ "n = 100\n",
+ "x = 2*np.random.rand(n,1)\n",
+ "y = 4+3*x+np.random.randn(n,1)\n",
+ "\n",
+ "X = np.c_[np.ones((n,1)), x]\n",
+ "# Hessian matrix\n",
+ "H = (2.0/n)* X.T @ X\n",
+ "# Get the eigenvalues\n",
+ "EigValues, EigVectors = np.linalg.eig(H)\n",
+ "print(f\"Eigenvalues of Hessian Matrix:{EigValues}\")\n",
+ "\n",
+ "theta_linreg = np.linalg.inv(X.T @ X) @ X.T @ y\n",
+ "print(theta_linreg)\n",
+ "theta = np.random.randn(2,1)\n",
+ "\n",
+ "eta = 1.0/np.max(EigValues)\n",
+ "Niterations = 1000\n",
+ "\n",
+ "for iter in range(Niterations):\n",
+ " gradient = (2.0/n)*X.T @ (X @ theta-y)\n",
+ " theta -= eta*gradient\n",
+ "\n",
+ "print(theta)\n",
+ "xnew = np.array([[0],[2]])\n",
+ "xbnew = np.c_[np.ones((2,1)), xnew]\n",
+ "ypredict = xbnew.dot(theta)\n",
+ "ypredict2 = xbnew.dot(theta_linreg)\n",
+ "plt.plot(xnew, ypredict, \"r-\")\n",
+ "plt.plot(xnew, ypredict2, \"b-\")\n",
+ "plt.plot(x, y ,'ro')\n",
+ "plt.axis([0,2.0,0, 15.0])\n",
+ "plt.xlabel(r'$x$')\n",
+ "plt.ylabel(r'$y$')\n",
+ "plt.title(r'Gradient descent example')\n",
+ "plt.show()"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "id": "b6c4900e",
+ "metadata": {
+ "editable": true
+ },
+ "source": [
+ "## And a corresponding example using **scikit-learn**"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 5,
+ "id": "d2f662be",
+ "metadata": {
+ "collapsed": false,
+ "editable": true
+ },
+ "outputs": [],
+ "source": [
+ "# Importing various packages\n",
+ "from random import random, seed\n",
+ "import numpy as np\n",
+ "import matplotlib.pyplot as plt\n",
+ "from sklearn.linear_model import SGDRegressor\n",
+ "\n",
+ "n = 100\n",
+ "x = 2*np.random.rand(n,1)\n",
+ "y = 4+3*x+np.random.randn(n,1)\n",
+ "\n",
+ "X = np.c_[np.ones((n,1)), x]\n",
+ "theta_linreg = np.linalg.inv(X.T @ X) @ (X.T @ y)\n",
+ "print(theta_linreg)\n",
+ "sgdreg = SGDRegressor(max_iter = 50, penalty=None, eta0=0.1)\n",
+ "sgdreg.fit(x,y.ravel())\n",
+ "print(sgdreg.intercept_, sgdreg.coef_)"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "id": "83bd5b44",
+ "metadata": {
+ "editable": true
+ },
+ "source": [
+ "## Gradient descent and Ridge\n",
+ "\n",
+ "We have also discussed Ridge regression where the loss function contains a regularized term given by the $L_2$ norm of $\\theta$,"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "id": "8c7ee80c",
+ "metadata": {
+ "editable": true
+ },
+ "source": [
+ "$$\n",
+ "C_{\\text{ridge}}(\\theta) = \\frac{1}{n}||X\\theta -\\mathbf{y}||^2 + \\lambda ||\\theta||^2, \\ \\lambda \\geq 0.\n",
+ "$$"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "id": "7c70714f",
+ "metadata": {
+ "editable": true
+ },
+ "source": [
+ "In order to minimize $C_{\\text{ridge}}(\\theta)$ using GD we adjust the gradient as follows"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "id": "e170727b",
+ "metadata": {
+ "editable": true
+ },
+ "source": [
+ "$$\n",
+ "\\nabla_\\theta C_{\\text{ridge}}(\\theta) = \\frac{2}{n}\\begin{bmatrix} \\sum_{i=1}^{100} \\left(\\theta_0+\\theta_1x_i-y_i\\right) \\\\\n",
+ "\\sum_{i=1}^{100}\\left( x_i (\\theta_0+\\theta_1x_i)-y_ix_i\\right) \\\\\n",
+ "\\end{bmatrix} + 2\\lambda\\begin{bmatrix} \\theta_0 \\\\ \\theta_1\\end{bmatrix} = 2 (\\frac{1}{n}X^T(X\\theta - \\mathbf{y})+\\lambda \\theta).\n",
+ "$$"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "id": "b7b5d1ce",
+ "metadata": {
+ "editable": true
+ },
+ "source": [
+ "We can easily extend our program to minimize $C_{\\text{ridge}}(\\theta)$ using gradient descent and compare with the analytical solution given by"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "id": "7e59753a",
+ "metadata": {
+ "editable": true
+ },
+ "source": [
+ "$$\n",
+ "\\theta_{\\text{ridge}} = \\left(X^T X + n\\lambda I_{2 \\times 2} \\right)^{-1} X^T \\mathbf{y}.\n",
+ "$$"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "id": "d05de5f9",
+ "metadata": {
+ "editable": true
+ },
+ "source": [
+ "## The Hessian matrix for Ridge Regression\n",
+ "The Hessian matrix of Ridge Regression for our simple example is given by"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "id": "e3a5c888",
+ "metadata": {
+ "editable": true
+ },
+ "source": [
+ "$$\n",
+ "\\boldsymbol{H} \\equiv \\begin{bmatrix}\n",
+ "\\frac{\\partial^2 C(\\theta)}{\\partial \\theta_0^2} & \\frac{\\partial^2 C(\\theta)}{\\partial \\theta_0 \\partial \\theta_1} \\\\\n",
+ "\\frac{\\partial^2 C(\\theta)}{\\partial \\theta_0 \\partial \\theta_1} & \\frac{\\partial^2 C(\\theta)}{\\partial \\theta_1^2} & \\\\\n",
+ "\\end{bmatrix} = \\frac{2}{n}X^T X+2\\lambda\\boldsymbol{I}.\n",
+ "$$"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "id": "52b009a7",
+ "metadata": {
+ "editable": true
+ },
+ "source": [
+ "This implies that the Hessian matrix is positive definite, hence the stationary point is a\n",
+ "minimum.\n",
+ "Note that the Ridge cost function is convex being a sum of two convex\n",
+ "functions. Therefore, the stationary point is a global\n",
+ "minimum of this function."
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "id": "430d2418",
+ "metadata": {
+ "editable": true
+ },
+ "source": [
+ "## Program example for gradient descent with Ridge Regression"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 6,
+ "id": "b889c65e",
+ "metadata": {
+ "collapsed": false,
+ "editable": true
+ },
+ "outputs": [],
+ "source": [
+ "from random import random, seed\n",
+ "import numpy as np\n",
+ "import matplotlib.pyplot as plt\n",
+ "from mpl_toolkits.mplot3d import Axes3D\n",
+ "from matplotlib import cm\n",
+ "from matplotlib.ticker import LinearLocator, FormatStrFormatter\n",
+ "import sys\n",
+ "\n",
+ "# the number of datapoints\n",
+ "n = 100\n",
+ "x = 2*np.random.rand(n,1)\n",
+ "y = 4+3*x+np.random.randn(n,1)\n",
+ "\n",
+ "X = np.c_[np.ones((n,1)), x]\n",
+ "XT_X = X.T @ X\n",
+ "\n",
+ "#Ridge parameter lambda\n",
+ "lmbda = 0.001\n",
+ "Id = n*lmbda* np.eye(XT_X.shape[0])\n",
+ "\n",
+ "# Hessian matrix\n",
+ "H = (2.0/n)* XT_X+2*lmbda* np.eye(XT_X.shape[0])\n",
+ "# Get the eigenvalues\n",
+ "EigValues, EigVectors = np.linalg.eig(H)\n",
+ "print(f\"Eigenvalues of Hessian Matrix:{EigValues}\")\n",
+ "\n",
+ "\n",
+ "theta_linreg = np.linalg.inv(XT_X+Id) @ X.T @ y\n",
+ "print(theta_linreg)\n",
+ "# Start plain gradient descent\n",
+ "theta = np.random.randn(2,1)\n",
+ "\n",
+ "eta = 1.0/np.max(EigValues)\n",
+ "Niterations = 100\n",
+ "\n",
+ "for iter in range(Niterations):\n",
+ " gradients = 2.0/n*X.T @ (X @ (theta)-y)+2*lmbda*theta\n",
+ " theta -= eta*gradients\n",
+ "\n",
+ "print(theta)\n",
+ "ypredict = X @ theta\n",
+ "ypredict2 = X @ theta_linreg\n",
+ "plt.plot(x, ypredict, \"r-\")\n",
+ "plt.plot(x, ypredict2, \"b-\")\n",
+ "plt.plot(x, y ,'ro')\n",
+ "plt.axis([0,2.0,0, 15.0])\n",
+ "plt.xlabel(r'$x$')\n",
+ "plt.ylabel(r'$y$')\n",
+ "plt.title(r'Gradient descent example for Ridge')\n",
+ "plt.show()"
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "id": "21e20510",
+ "metadata": {
+ "editable": true
+ },
+ "source": [
+ "## Using gradient descent methods, limitations\n",
+ "\n",
+ "* **Gradient descent (GD) finds local minima of our function**. Since the GD algorithm is deterministic, if it converges, it will converge to a local minimum of our cost/loss/risk function. Because in ML we are often dealing with extremely rugged landscapes with many local minima, this can lead to poor performance.\n",
+ "\n",
+ "* **GD is sensitive to initial conditions**. One consequence of the local nature of GD is that initial conditions matter. Depending on where one starts, one will end up at a different local minima. Therefore, it is very important to think about how one initializes the training process. This is true for GD as well as more complicated variants of GD.\n",
+ "\n",
+ "* **Gradients are computationally expensive to calculate for large datasets**. In many cases in statistics and ML, the cost/loss/risk function is a sum of terms, with one term for each data point. For example, in linear regression, $E \\propto \\sum_{i=1}^n (y_i - \\mathbf{w}^T\\cdot\\mathbf{x}_i)^2$; for logistic regression, the square error is replaced by the cross entropy. To calculate the gradient we have to sum over *all* $n$ data points. Doing this at every GD step becomes extremely computationally expensive. An ingenious solution to this, is to calculate the gradients using small subsets of the data called \"mini batches\". This has the added benefit of introducing stochasticity into our algorithm.\n",
+ "\n",
+ "* **GD is very sensitive to choices of learning rates**. GD is extremely sensitive to the choice of learning rates. If the learning rate is very small, the training process take an extremely long time. For larger learning rates, GD can diverge and give poor results. Furthermore, depending on what the local landscape looks like, we have to modify the learning rates to ensure convergence. Ideally, we would *adaptively* choose the learning rates to match the landscape.\n",
+ "\n",
+ "* **GD treats all directions in parameter space uniformly.** Another major drawback of GD is that unlike Newton's method, the learning rate for GD is the same in all directions in parameter space. For this reason, the maximum learning rate is set by the behavior of the steepest direction and this can significantly slow down training. Ideally, we would like to take large steps in flat directions and small steps in steep directions. Since we are exploring rugged landscapes where curvatures change, this requires us to keep track of not only the gradient but second derivatives. The ideal scenario would be to calculate the Hessian but this proves to be too computationally expensive. \n",
+ "\n",
+ "* GD can take exponential time to escape saddle points, even with random initialization. As we mentioned, GD is extremely sensitive to initial condition since it determines the particular local minimum GD would eventually reach. However, even with a good initialization scheme, through the introduction of randomness, GD can still take exponential time to escape saddle points."
+ ]
+ },
+ {
+ "cell_type": "markdown",
+ "id": "59d61c18",
"metadata": {
"editable": true
},
@@ -2307,7 +3327,7 @@
},
{
"cell_type": "markdown",
- "id": "0fb1040e",
+ "id": "19a3af8f",
"metadata": {
"editable": true
},
@@ -2319,7 +3339,7 @@
},
{
"cell_type": "markdown",
- "id": "db25930c",
+ "id": "a0a91546",
"metadata": {
"editable": true
},
@@ -2331,7 +3351,7 @@
},
{
"cell_type": "markdown",
- "id": "4a546ba3",
+ "id": "4ddc3a0d",
"metadata": {
"editable": true
},
@@ -2341,7 +3361,7 @@
},
{
"cell_type": "markdown",
- "id": "c6de0dc0",
+ "id": "2c51cc5b",
"metadata": {
"editable": true
},
@@ -2353,7 +3373,7 @@
},
{
"cell_type": "markdown",
- "id": "fe5dcdab",
+ "id": "754dd1c2",
"metadata": {
"editable": true
},
@@ -2363,7 +3383,7 @@
},
{
"cell_type": "markdown",
- "id": "2a51b2e5",
+ "id": "37b8fcf8",
"metadata": {
"editable": true
},
@@ -2380,7 +3400,7 @@
},
{
"cell_type": "markdown",
- "id": "bcb630ab",
+ "id": "4103d318",
"metadata": {
"editable": true
},
@@ -2390,7 +3410,7 @@
},
{
"cell_type": "markdown",
- "id": "c8e959be",
+ "id": "dae6c763",
"metadata": {
"editable": true
},
@@ -2402,7 +3422,7 @@
},
{
"cell_type": "markdown",
- "id": "3c833fb9",
+ "id": "b13a4b0d",
"metadata": {
"editable": true
},
@@ -2412,7 +3432,7 @@
},
{
"cell_type": "markdown",
- "id": "f26ce824",
+ "id": "0911661b",
"metadata": {
"editable": true
},
@@ -2424,7 +3444,7 @@
},
{
"cell_type": "markdown",
- "id": "a53e6221",
+ "id": "9a4144ae",
"metadata": {
"editable": true
},
@@ -2438,7 +3458,7 @@
},
{
"cell_type": "markdown",
- "id": "92dfaee8",
+ "id": "9dfc5f86",
"metadata": {
"editable": true
},
@@ -2450,7 +3470,7 @@
},
{
"cell_type": "markdown",
- "id": "5900606b",
+ "id": "73be1c56",
"metadata": {
"editable": true
},
@@ -2469,7 +3489,7 @@
},
{
"cell_type": "markdown",
- "id": "96866dd5",
+ "id": "9bd87051",
"metadata": {
"editable": true
},
@@ -2482,19 +3502,19 @@
},
{
"cell_type": "markdown",
- "id": "2de2dd52",
+ "id": "c720ad2b",
"metadata": {
"editable": true
},
"source": [
"$$\n",
- "{\\displaystyle \\min_{\\boldsymbol{\\beta}\\in {\\mathbb{R}}^{p}}}\\frac{1}{n}\\left\\{\\left(\\boldsymbol{y}-\\boldsymbol{X}\\boldsymbol{\\beta}\\right)^T\\left(\\boldsymbol{y}-\\boldsymbol{X}\\boldsymbol{\\beta}\\right)\\right\\}.\n",
+ "{\\displaystyle \\min_{\\boldsymbol{\\theta}\\in {\\mathbb{R}}^{p}}}\\frac{1}{n}\\left\\{\\left(\\boldsymbol{y}-\\boldsymbol{X}\\boldsymbol{\\theta}\\right)^T\\left(\\boldsymbol{y}-\\boldsymbol{X}\\boldsymbol{\\theta}\\right)\\right\\}.\n",
"$$"
]
},
{
"cell_type": "markdown",
- "id": "85c82be2",
+ "id": "2bb60a91",
"metadata": {
"editable": true
},
@@ -2504,20 +3524,20 @@
},
{
"cell_type": "markdown",
- "id": "c9bd13b0",
+ "id": "3a65ac27",
"metadata": {
"editable": true
},
"source": [
"$$\n",
- "{\\displaystyle \\min_{\\boldsymbol{\\beta}\\in\n",
- "{\\mathbb{R}}^{p}}}\\frac{1}{n}\\sum_{i=0}^{n-1}\\left(y_i-\\tilde{y}_i\\right)^2=\\frac{1}{n}\\vert\\vert \\boldsymbol{y}-\\boldsymbol{X}\\boldsymbol{\\beta}\\vert\\vert_2^2,\n",
+ "{\\displaystyle \\min_{\\boldsymbol{\\theta}\\in\n",
+ "{\\mathbb{R}}^{p}}}\\frac{1}{n}\\sum_{i=0}^{n-1}\\left(y_i-\\tilde{y}_i\\right)^2=\\frac{1}{n}\\vert\\vert \\boldsymbol{y}-\\boldsymbol{X}\\boldsymbol{\\theta}\\vert\\vert_2^2,\n",
"$$"
]
},
{
"cell_type": "markdown",
- "id": "00a53089",
+ "id": "3dfeab84",
"metadata": {
"editable": true
},
@@ -2527,7 +3547,7 @@
},
{
"cell_type": "markdown",
- "id": "9156ea65",
+ "id": "6e8ad46c",
"metadata": {
"editable": true
},
@@ -2539,7 +3559,7 @@
},
{
"cell_type": "markdown",
- "id": "5de72fba",
+ "id": "500a62cd",
"metadata": {
"editable": true
},
@@ -2547,33 +3567,33 @@
"## From OLS to Ridge and Lasso\n",
"\n",
"By minimizing the above equation with respect to the parameters\n",
- "$\\boldsymbol{\\beta}$ we could then obtain an analytical expression for the\n",
- "parameters $\\boldsymbol{\\beta}$. We can add a regularization parameter $\\lambda$ by\n",
+ "$\\boldsymbol{\\theta}$ we could then obtain an analytical expression for the\n",
+ "parameters $\\boldsymbol{\\theta}$. We can add a regularization parameter $\\lambda$ by\n",
"defining a new cost function to be optimized, that is"
]
},
{
"cell_type": "markdown",
- "id": "b842e373",
+ "id": "edf77f5d",
"metadata": {
"editable": true
},
"source": [
"$$\n",
- "{\\displaystyle \\min_{\\boldsymbol{\\beta}\\in\n",
- "{\\mathbb{R}}^{p}}}\\frac{1}{n}\\vert\\vert \\boldsymbol{y}-\\boldsymbol{X}\\boldsymbol{\\beta}\\vert\\vert_2^2+\\lambda\\vert\\vert \\boldsymbol{\\beta}\\vert\\vert_2^2\n",
+ "{\\displaystyle \\min_{\\boldsymbol{\\theta}\\in\n",
+ "{\\mathbb{R}}^{p}}}\\frac{1}{n}\\vert\\vert \\boldsymbol{y}-\\boldsymbol{X}\\boldsymbol{\\theta}\\vert\\vert_2^2+\\lambda\\vert\\vert \\boldsymbol{\\theta}\\vert\\vert_2^2\n",
"$$"
]
},
{
"cell_type": "markdown",
- "id": "f0fe85a5",
+ "id": "9d308fc9",
"metadata": {
"editable": true
},
"source": [
"which leads to the Ridge regression minimization problem where we\n",
- "require that $\\vert\\vert \\boldsymbol{\\beta}\\vert\\vert_2^2\\le t$, where $t$ is\n",
+ "require that $\\vert\\vert \\boldsymbol{\\theta}\\vert\\vert_2^2\\le t$, where $t$ is\n",
"a finite number larger than zero. We do not include such a constraints in the discussions here.\n",
"\n",
"By defining"
@@ -2581,19 +3601,19 @@
},
{
"cell_type": "markdown",
- "id": "a96485c6",
+ "id": "fccb6caa",
"metadata": {
"editable": true
},
"source": [
"$$\n",
- "C(\\boldsymbol{X},\\boldsymbol{\\beta})=\\frac{1}{n}\\vert\\vert \\boldsymbol{y}-\\boldsymbol{X}\\boldsymbol{\\beta}\\vert\\vert_2^2+\\lambda\\vert\\vert \\boldsymbol{\\beta}\\vert\\vert_1,\n",
+ "C(\\boldsymbol{X},\\boldsymbol{\\theta})=\\frac{1}{n}\\vert\\vert \\boldsymbol{y}-\\boldsymbol{X}\\boldsymbol{\\theta}\\vert\\vert_2^2+\\lambda\\vert\\vert \\boldsymbol{\\theta}\\vert\\vert_1,\n",
"$$"
]
},
{
"cell_type": "markdown",
- "id": "845dac57",
+ "id": "f1fa209f",
"metadata": {
"editable": true
},
@@ -2603,20 +3623,20 @@
},
{
"cell_type": "markdown",
- "id": "feb1287c",
+ "id": "4ae99f60",
"metadata": {
"editable": true
},
"source": [
"$$\n",
- "{\\displaystyle \\min_{\\boldsymbol{\\beta}\\in\n",
- "{\\mathbb{R}}^{p}}}\\frac{1}{n}\\vert\\vert \\boldsymbol{y}-\\boldsymbol{X}\\boldsymbol{\\beta}\\vert\\vert_2^2+\\lambda\\vert\\vert \\boldsymbol{\\beta}\\vert\\vert_1\n",
+ "{\\displaystyle \\min_{\\boldsymbol{\\theta}\\in\n",
+ "{\\mathbb{R}}^{p}}}\\frac{1}{n}\\vert\\vert \\boldsymbol{y}-\\boldsymbol{X}\\boldsymbol{\\theta}\\vert\\vert_2^2+\\lambda\\vert\\vert \\boldsymbol{\\theta}\\vert\\vert_1\n",
"$$"
]
},
{
"cell_type": "markdown",
- "id": "cde81855",
+ "id": "36cbbd77",
"metadata": {
"editable": true
},
@@ -2628,7 +3648,7 @@
},
{
"cell_type": "markdown",
- "id": "426999dd",
+ "id": "d2d67dee",
"metadata": {
"editable": true
},
@@ -2640,7 +3660,7 @@
},
{
"cell_type": "markdown",
- "id": "b023d5ec",
+ "id": "c1e84f6b",
"metadata": {
"editable": true
},
@@ -2652,25 +3672,25 @@
},
{
"cell_type": "markdown",
- "id": "8c88df1d",
+ "id": "d0806a88",
"metadata": {
"editable": true
},
"source": [
"$$\n",
- "C(\\boldsymbol{X},\\boldsymbol{\\beta})=\\left\\{(\\boldsymbol{y}-\\boldsymbol{X}\\boldsymbol{\\beta})^T(\\boldsymbol{y}-\\boldsymbol{X}\\boldsymbol{\\beta})\\right\\}+\\lambda\\boldsymbol{\\beta}^T\\boldsymbol{\\beta},\n",
+ "C(\\boldsymbol{X},\\boldsymbol{\\theta})=\\left\\{(\\boldsymbol{y}-\\boldsymbol{X}\\boldsymbol{\\theta})^T(\\boldsymbol{y}-\\boldsymbol{X}\\boldsymbol{\\theta})\\right\\}+\\lambda\\boldsymbol{\\theta}^T\\boldsymbol{\\theta},\n",
"$$"
]
},
{
"cell_type": "markdown",
- "id": "7b538bea",
+ "id": "5217eb80",
"metadata": {
"editable": true
},
"source": [
"and \n",
- "taking the derivatives with respect to $\\boldsymbol{\\beta}$ we obtain then\n",
+ "taking the derivatives with respect to $\\boldsymbol{\\theta}$ we obtain then\n",
"a slightly modified matrix inversion problem which for finite values\n",
"of $\\lambda$ does not suffer from singularity problems. We obtain\n",
"the optimal parameters"
@@ -2678,19 +3698,19 @@
},
{
"cell_type": "markdown",
- "id": "48b626f8",
+ "id": "26476c82",
"metadata": {
"editable": true
},
"source": [
"$$\n",
- "\\hat{\\boldsymbol{\\beta}}_{\\mathrm{Ridge}} = \\left(\\boldsymbol{X}^T\\boldsymbol{X}+\\lambda\\boldsymbol{I}\\right)^{-1}\\boldsymbol{X}^T\\boldsymbol{y},\n",
+ "\\hat{\\boldsymbol{\\theta}}_{\\mathrm{Ridge}} = \\left(\\boldsymbol{X}^T\\boldsymbol{X}+\\lambda\\boldsymbol{I}\\right)^{-1}\\boldsymbol{X}^T\\boldsymbol{y},\n",
"$$"
]
},
{
"cell_type": "markdown",
- "id": "de641451",
+ "id": "865ed23a",
"metadata": {
"editable": true
},
@@ -2700,19 +3720,19 @@
},
{
"cell_type": "markdown",
- "id": "a42a620b",
+ "id": "267f405a",
"metadata": {
"editable": true
},
"source": [
"$$\n",
- "\\sum_{i=0}^{p-1} \\beta_i^2 \\leq t,\n",
+ "\\sum_{i=0}^{p-1} \\theta_i^2 \\leq t,\n",
"$$"
]
},
{
"cell_type": "markdown",
- "id": "f3f3ca34",
+ "id": "128c8fe1",
"metadata": {
"editable": true
},
@@ -2722,31 +3742,31 @@
},
{
"cell_type": "markdown",
- "id": "9ae449cb",
+ "id": "025774a5",
"metadata": {
"editable": true
},
"source": [
"## Note on Scikit-Learn\n",
"\n",
- "Note well that a library like **Scikit-Learn** does not include the $1/n$ factor in the expression for the mean-squared error. If you include it, the optimal parameter $\\beta$ becomes"
+ "Note well that a library like **Scikit-Learn** does not include the $1/n$ factor in the expression for the mean-squared error. If you include it, the optimal parameter $\\theta$ becomes"
]
},
{
"cell_type": "markdown",
- "id": "d0788dec",
+ "id": "a3d2ecae",
"metadata": {
"editable": true
},
"source": [
"$$\n",
- "\\hat{\\boldsymbol{\\beta}}_{\\mathrm{Ridge}} = \\left(\\boldsymbol{X}^T\\boldsymbol{X}+n\\lambda\\boldsymbol{I}\\right)^{-1}\\boldsymbol{X}^T\\boldsymbol{y}.\n",
+ "\\hat{\\boldsymbol{\\theta}}_{\\mathrm{Ridge}} = \\left(\\boldsymbol{X}^T\\boldsymbol{X}+n\\lambda\\boldsymbol{I}\\right)^{-1}\\boldsymbol{X}^T\\boldsymbol{y}.\n",
"$$"
]
},
{
"cell_type": "markdown",
- "id": "f6ce16ec",
+ "id": "7f619bb0",
"metadata": {
"editable": true
},
@@ -2756,7 +3776,7 @@
},
{
"cell_type": "markdown",
- "id": "aef8a956",
+ "id": "fa1c8647",
"metadata": {
"editable": true
},
@@ -2767,19 +3787,19 @@
},
{
"cell_type": "markdown",
- "id": "ce797210",
+ "id": "9f5a4138",
"metadata": {
"editable": true
},
"source": [
"$$\n",
- "\\hat{\\boldsymbol{\\beta}}_{\\mathrm{OLS}} = \\left(\\boldsymbol{X}^T\\boldsymbol{X}\\right)^{-1}\\boldsymbol{X}^T\\boldsymbol{y},\n",
+ "\\hat{\\boldsymbol{\\theta}}_{\\mathrm{OLS}} = \\left(\\boldsymbol{X}^T\\boldsymbol{X}\\right)^{-1}\\boldsymbol{X}^T\\boldsymbol{y},\n",
"$$"
]
},
{
"cell_type": "markdown",
- "id": "bce49278",
+ "id": "357000de",
"metadata": {
"editable": true
},
@@ -2790,12 +3810,12 @@
"modified diagonal term added to $\\boldsymbol{X}^T\\boldsymbol{X}$. The consequences, in\n",
"particular for our discussion of the bias-variance tradeoff are rather\n",
"interesting. We will see that for specific values of $\\lambda$, we may\n",
- "even reduce the variance of the optimal parameters $\\boldsymbol{\\beta}$. These topics and other related ones, will be discussed after the more linear algebra oriented analysis here."
+ "even reduce the variance of the optimal parameters $\\boldsymbol{\\theta}$. These topics and other related ones, will be discussed after the more linear algebra oriented analysis here."
]
},
{
"cell_type": "markdown",
- "id": "2560c4b3",
+ "id": "2716f2d3",
"metadata": {
"editable": true
},
@@ -2808,19 +3828,19 @@
},
{
"cell_type": "markdown",
- "id": "f4cba9b6",
+ "id": "9f1150a1",
"metadata": {
"editable": true
},
"source": [
"$$\n",
- "\\tilde{\\boldsymbol{y}}_{\\mathrm{OLS}}=\\boldsymbol{X}\\boldsymbol{\\beta} =\\boldsymbol{U}\\boldsymbol{U}^T\\boldsymbol{y}.\n",
+ "\\tilde{\\boldsymbol{y}}_{\\mathrm{OLS}}=\\boldsymbol{X}\\boldsymbol{\\theta} =\\boldsymbol{U}\\boldsymbol{U}^T\\boldsymbol{y}.\n",
"$$"
]
},
{
"cell_type": "markdown",
- "id": "de2a1df1",
+ "id": "d5ee456d",
"metadata": {
"editable": true
},
@@ -2830,19 +3850,19 @@
},
{
"cell_type": "markdown",
- "id": "25fbea25",
+ "id": "50b60351",
"metadata": {
"editable": true
},
"source": [
"$$\n",
- "\\tilde{\\boldsymbol{y}}_{\\mathrm{Ridge}}=\\boldsymbol{X}\\boldsymbol{\\beta}_{\\mathrm{Ridge}} = \\boldsymbol{U\\Sigma V^T}\\left(\\boldsymbol{V}\\boldsymbol{\\Sigma}^2\\boldsymbol{V}^T+\\lambda\\boldsymbol{I} \\right)^{-1}(\\boldsymbol{U\\Sigma V^T})^T\\boldsymbol{y}=\\sum_{j=0}^{p-1}\\boldsymbol{u}_j\\boldsymbol{u}_j^T\\frac{\\sigma_j^2}{\\sigma_j^2+\\lambda}\\boldsymbol{y},\n",
+ "\\tilde{\\boldsymbol{y}}_{\\mathrm{Ridge}}=\\boldsymbol{X}\\boldsymbol{\\theta}_{\\mathrm{Ridge}} = \\boldsymbol{U\\Sigma V^T}\\left(\\boldsymbol{V}\\boldsymbol{\\Sigma}^2\\boldsymbol{V}^T+\\lambda\\boldsymbol{I} \\right)^{-1}(\\boldsymbol{U\\Sigma V^T})^T\\boldsymbol{y}=\\sum_{j=0}^{p-1}\\boldsymbol{u}_j\\boldsymbol{u}_j^T\\frac{\\sigma_j^2}{\\sigma_j^2+\\lambda}\\boldsymbol{y},\n",
"$$"
]
},
{
"cell_type": "markdown",
- "id": "2250909a",
+ "id": "b349aa76",
"metadata": {
"editable": true
},
@@ -2852,7 +3872,7 @@
},
{
"cell_type": "markdown",
- "id": "f5f1ec38",
+ "id": "0cf92ff7",
"metadata": {
"editable": true
},
@@ -2864,7 +3884,7 @@
},
{
"cell_type": "markdown",
- "id": "353a033b",
+ "id": "63ab8407",
"metadata": {
"editable": true
},
@@ -2876,7 +3896,7 @@
},
{
"cell_type": "markdown",
- "id": "aaff0699",
+ "id": "c1c8b499",
"metadata": {
"editable": true
},
@@ -2892,7 +3912,7 @@
},
{
"cell_type": "markdown",
- "id": "9086c7ed",
+ "id": "38a3cc6b",
"metadata": {
"editable": true
},
@@ -2904,7 +3924,7 @@
},
{
"cell_type": "markdown",
- "id": "ed4ff265",
+ "id": "6c9a1e21",
"metadata": {
"editable": true
},
@@ -2916,7 +3936,7 @@
},
{
"cell_type": "markdown",
- "id": "00d299f4",
+ "id": "77cebd55",
"metadata": {
"editable": true
},
@@ -2926,19 +3946,19 @@
},
{
"cell_type": "markdown",
- "id": "ebe5d9d8",
+ "id": "f3397dc1",
"metadata": {
"editable": true
},
"source": [
"$$\n",
- "\\boldsymbol{\\beta}^{\\mathrm{OLS}} = \\boldsymbol{X}^T\\boldsymbol{y}=\\sum_{i=0}^{n-1}\\boldsymbol{u}_i\\boldsymbol{u}_i^T\\boldsymbol{y},\n",
+ "\\boldsymbol{\\theta}^{\\mathrm{OLS}} = \\boldsymbol{X}^T\\boldsymbol{y}=\\sum_{i=0}^{n-1}\\boldsymbol{u}_i\\boldsymbol{u}_i^T\\boldsymbol{y},\n",
"$$"
]
},
{
"cell_type": "markdown",
- "id": "c6edfc6a",
+ "id": "8b36e38d",
"metadata": {
"editable": true
},
@@ -2948,19 +3968,19 @@
},
{
"cell_type": "markdown",
- "id": "e0b4814d",
+ "id": "1c6262cc",
"metadata": {
"editable": true
},
"source": [
"$$\n",
- "\\boldsymbol{\\beta}^{\\mathrm{Ridge}} = \\left(\\boldsymbol{I}+\\lambda\\boldsymbol{I}\\right)^{-1}\\boldsymbol{X}^T\\boldsymbol{y}=\\left(1+\\lambda\\right)^{-1}\\boldsymbol{\\beta}^{\\mathrm{OLS}},\n",
+ "\\boldsymbol{\\theta}^{\\mathrm{Ridge}} = \\left(\\boldsymbol{I}+\\lambda\\boldsymbol{I}\\right)^{-1}\\boldsymbol{X}^T\\boldsymbol{y}=\\left(1+\\lambda\\right)^{-1}\\boldsymbol{\\theta}^{\\mathrm{OLS}},\n",
"$$"
]
},
{
"cell_type": "markdown",
- "id": "27682ade",
+ "id": "18a58f70",
"metadata": {
"editable": true
},
@@ -2977,7 +3997,7 @@
},
{
"cell_type": "markdown",
- "id": "77a93e3d",
+ "id": "bdadc0f1",
"metadata": {
"editable": true
},
@@ -2989,41 +4009,41 @@
},
{
"cell_type": "markdown",
- "id": "2b5f205f",
+ "id": "a482e79b",
"metadata": {
"editable": true
},
"source": [
"$$\n",
- "C(\\boldsymbol{X},\\boldsymbol{\\beta})=\\frac{1}{n}\\left\\{(\\boldsymbol{y}-\\boldsymbol{X}\\boldsymbol{\\beta})^T(\\boldsymbol{y}-\\boldsymbol{X}\\boldsymbol{\\beta})\\right\\}+\\lambda\\vert\\vert\\boldsymbol{\\beta}\\vert\\vert_1,\n",
+ "C(\\boldsymbol{X},\\boldsymbol{\\theta})=\\frac{1}{n}\\left\\{(\\boldsymbol{y}-\\boldsymbol{X}\\boldsymbol{\\theta})^T(\\boldsymbol{y}-\\boldsymbol{X}\\boldsymbol{\\theta})\\right\\}+\\lambda\\vert\\vert\\boldsymbol{\\theta}\\vert\\vert_1,\n",
"$$"
]
},
{
"cell_type": "markdown",
- "id": "e3b126e5",
+ "id": "1c1f3504",
"metadata": {
"editable": true
},
"source": [
- "Taking the derivative with respect to $\\boldsymbol{\\beta}$ and recalling that the derivative of the absolute value is (we drop the boldfaced vector symbol for simplicity)"
+ "Taking the derivative with respect to $\\boldsymbol{\\theta}$ and recalling that the derivative of the absolute value is (we drop the boldfaced vector symbol for simplicity)"
]
},
{
"cell_type": "markdown",
- "id": "da358f73",
+ "id": "c7ff16c0",
"metadata": {
"editable": true
},
"source": [
"$$\n",
- "\\frac{d \\vert \\beta\\vert}{d \\beta}=\\mathrm{sgn}(\\beta)=\\left\\{\\begin{array}{cc} 1 & \\beta > 0 \\\\-1 & \\beta < 0, \\end{array}\\right.\n",
+ "\\frac{d \\vert \\theta\\vert}{d \\theta}=\\mathrm{sgn}(\\theta)=\\left\\{\\begin{array}{cc} 1 & \\theta > 0 \\\\-1 & \\theta < 0, \\end{array}\\right.\n",
"$$"
]
},
{
"cell_type": "markdown",
- "id": "0f2e27fe",
+ "id": "df7b2ee6",
"metadata": {
"editable": true
},
@@ -3033,19 +4053,19 @@
},
{
"cell_type": "markdown",
- "id": "5a90b8b0",
+ "id": "768d2256",
"metadata": {
"editable": true
},
"source": [
"$$\n",
- "\\frac{\\partial C(\\boldsymbol{X},\\boldsymbol{\\beta})}{\\partial \\boldsymbol{\\beta}}=-\\frac{2}{n}\\boldsymbol{X}^T(\\boldsymbol{y}-\\boldsymbol{X}\\boldsymbol{\\beta})+\\lambda sgn(\\boldsymbol{\\beta})=0,\n",
+ "\\frac{\\partial C(\\boldsymbol{X},\\boldsymbol{\\theta})}{\\partial \\boldsymbol{\\theta}}=-\\frac{2}{n}\\boldsymbol{X}^T(\\boldsymbol{y}-\\boldsymbol{X}\\boldsymbol{\\theta})+\\lambda sgn(\\boldsymbol{\\theta})=0,\n",
"$$"
]
},
{
"cell_type": "markdown",
- "id": "ee51ab14",
+ "id": "f0d5cbe4",
"metadata": {
"editable": true
},
@@ -3055,19 +4075,19 @@
},
{
"cell_type": "markdown",
- "id": "2a6710db",
+ "id": "5403622a",
"metadata": {
"editable": true
},
"source": [
"$$\n",
- "\\boldsymbol{X}^T\\boldsymbol{X}\\boldsymbol{\\beta}+\\lambda sgn(\\boldsymbol{\\beta})=\\boldsymbol{X}^T\\boldsymbol{y}.\n",
+ "\\boldsymbol{X}^T\\boldsymbol{X}\\boldsymbol{\\theta}+\\lambda sgn(\\boldsymbol{\\theta})=\\boldsymbol{X}^T\\boldsymbol{y}.\n",
"$$"
]
},
{
"cell_type": "markdown",
- "id": "e1f59642",
+ "id": "75c85a12",
"metadata": {
"editable": true
},
@@ -3077,7 +4097,7 @@
},
{
"cell_type": "markdown",
- "id": "7ce86400",
+ "id": "4591459d",
"metadata": {
"editable": true
},
@@ -3087,24 +4107,24 @@
"Let us assume that our design matrix is given by unit (identity) matrix, that is a square diagonal matrix with ones only along the\n",
"diagonal. In this case we have an equal number of rows and columns $n=p$.\n",
"\n",
- "Our model approximation is just $\\tilde{\\boldsymbol{y}}=\\boldsymbol{\\beta}$ and the mean squared error and thereby the cost function for ordinary least sqquares (OLS) is then (we drop the term $1/n$)"
+ "Our model approximation is just $\\tilde{\\boldsymbol{y}}=\\boldsymbol{\\theta}$ and the mean squared error and thereby the cost function for ordinary least sqquares (OLS) is then (we drop the term $1/n$)"
]
},
{
"cell_type": "markdown",
- "id": "98b73725",
+ "id": "24cc16cd",
"metadata": {
"editable": true
},
"source": [
"$$\n",
- "C(\\boldsymbol{\\beta})=\\sum_{i=0}^{p-1}(y_i-\\beta_i)^2,\n",
+ "C(\\boldsymbol{\\theta})=\\sum_{i=0}^{p-1}(y_i-\\theta_i)^2,\n",
"$$"
]
},
{
"cell_type": "markdown",
- "id": "59ec5543",
+ "id": "86889b7d",
"metadata": {
"editable": true
},
@@ -3114,19 +4134,19 @@
},
{
"cell_type": "markdown",
- "id": "0b602027",
+ "id": "965e8e09",
"metadata": {
"editable": true
},
"source": [
"$$\n",
- "\\hat{\\beta}_i^{\\mathrm{OLS}} = y_i.\n",
+ "\\hat{\\theta}_i^{\\mathrm{OLS}} = y_i.\n",
"$$"
]
},
{
"cell_type": "markdown",
- "id": "4deb54d0",
+ "id": "5cffcb19",
"metadata": {
"editable": true
},
@@ -3138,19 +4158,19 @@
},
{
"cell_type": "markdown",
- "id": "1bb3b75c",
+ "id": "6671e517",
"metadata": {
"editable": true
},
"source": [
"$$\n",
- "C(\\boldsymbol{\\beta})=\\sum_{i=0}^{p-1}(y_i-\\beta_i)^2+\\lambda\\sum_{i=0}^{p-1}\\beta_i^2,\n",
+ "C(\\boldsymbol{\\theta})=\\sum_{i=0}^{p-1}(y_i-\\theta_i)^2+\\lambda\\sum_{i=0}^{p-1}\\theta_i^2,\n",
"$$"
]
},
{
"cell_type": "markdown",
- "id": "ec06de57",
+ "id": "252e152e",
"metadata": {
"editable": true
},
@@ -3160,19 +4180,19 @@
},
{
"cell_type": "markdown",
- "id": "443a4c51",
+ "id": "26d20ede",
"metadata": {
"editable": true
},
"source": [
"$$\n",
- "\\hat{\\beta}_i^{\\mathrm{Ridge}} = \\frac{y_i}{1+\\lambda}.\n",
+ "\\hat{\\theta}_i^{\\mathrm{Ridge}} = \\frac{y_i}{1+\\lambda}.\n",
"$$"
]
},
{
"cell_type": "markdown",
- "id": "2caa2792",
+ "id": "c25ce321",
"metadata": {
"editable": true
},
@@ -3184,19 +4204,19 @@
},
{
"cell_type": "markdown",
- "id": "fdab0d9e",
+ "id": "c036a923",
"metadata": {
"editable": true
},
"source": [
"$$\n",
- "C(\\boldsymbol{\\beta})=\\sum_{i=0}^{p-1}(y_i-\\beta_i)^2+\\lambda\\sum_{i=0}^{p-1}\\vert\\beta_i\\vert=\\sum_{i=0}^{p-1}(y_i-\\beta_i)^2+\\lambda\\sum_{i=0}^{p-1}\\sqrt{\\beta_i^2},\n",
+ "C(\\boldsymbol{\\theta})=\\sum_{i=0}^{p-1}(y_i-\\theta_i)^2+\\lambda\\sum_{i=0}^{p-1}\\vert\\theta_i\\vert=\\sum_{i=0}^{p-1}(y_i-\\theta_i)^2+\\lambda\\sum_{i=0}^{p-1}\\sqrt{\\theta_i^2},\n",
"$$"
]
},
{
"cell_type": "markdown",
- "id": "9bf9979d",
+ "id": "6f10942f",
"metadata": {
"editable": true
},
@@ -3206,19 +4226,19 @@
},
{
"cell_type": "markdown",
- "id": "69a9abf7",
+ "id": "8c175b28",
"metadata": {
"editable": true
},
"source": [
"$$\n",
- "-2\\sum_{i=0}^{p-1}(y_i-\\beta_i)+\\lambda \\sum_{i=0}^{p-1}\\frac{(\\beta_i)}{\\vert\\beta_i\\vert}=0,\n",
+ "-2\\sum_{i=0}^{p-1}(y_i-\\theta_i)+\\lambda \\sum_{i=0}^{p-1}\\frac{(\\theta_i)}{\\vert\\theta_i\\vert}=0,\n",
"$$"
]
},
{
"cell_type": "markdown",
- "id": "08351598",
+ "id": "cb7d2fa1",
"metadata": {
"editable": true
},
@@ -3228,13 +4248,13 @@
},
{
"cell_type": "markdown",
- "id": "8cd66c38",
+ "id": "352e9f9a",
"metadata": {
"editable": true
},
"source": [
"$$\n",
- "\\hat{\\boldsymbol{\\beta}}_i^{\\mathrm{Lasso}} = \\left\\{\\begin{array}{ccc}y_i-\\frac{\\lambda}{2} &\\mathrm{if} & y_i> \\frac{\\lambda}{2}\\\\\n",
+ "\\hat{\\boldsymbol{\\theta}}_i^{\\mathrm{Lasso}} = \\left\\{\\begin{array}{ccc}y_i-\\frac{\\lambda}{2} &\\mathrm{if} & y_i> \\frac{\\lambda}{2}\\\\\n",
" y_i+\\frac{\\lambda}{2} &\\mathrm{if} & y_i< -\\frac{\\lambda}{2}\\\\\n",
"\t\t\t\t\t\t\t 0 &\\mathrm{if} & \\vert y_i\\vert\\le \\frac{\\lambda}{2}\\end{array}\\right.\\\\.\n",
"$$"
@@ -3242,17 +4262,17 @@
},
{
"cell_type": "markdown",
- "id": "4887c632",
+ "id": "2d627bc4",
"metadata": {
"editable": true
},
"source": [
- "Plotting these results shows clearly that Lasso regression suppresses (sets to zero) values of $\\beta_i$ for specific values of $\\lambda$. Ridge regression reduces on the other hand the values of $\\beta_i$ as function of $\\lambda$."
+ "Plotting these results shows clearly that Lasso regression suppresses (sets to zero) values of $\\theta_i$ for specific values of $\\lambda$. Ridge regression reduces on the other hand the values of $\\theta_i$ as function of $\\lambda$."
]
},
{
"cell_type": "markdown",
- "id": "a4660170",
+ "id": "e0d9b39f",
"metadata": {
"editable": true
},
@@ -3264,7 +4284,7 @@
},
{
"cell_type": "markdown",
- "id": "1b0fea4a",
+ "id": "f84e1a77",
"metadata": {
"editable": true
},
@@ -3276,7 +4296,7 @@
},
{
"cell_type": "markdown",
- "id": "26ac6cb7",
+ "id": "7845b77c",
"metadata": {
"editable": true
},
@@ -3286,7 +4306,7 @@
},
{
"cell_type": "markdown",
- "id": "2eab96bb",
+ "id": "da3ca301",
"metadata": {
"editable": true
},
@@ -3298,17 +4318,17 @@
},
{
"cell_type": "markdown",
- "id": "683837ff",
+ "id": "ac98fa0a",
"metadata": {
"editable": true
},
"source": [
- "meaning that we have two features and two unknown parameters $\\beta_0$ and $\\beta_1$ to be determined either by ordinary least squares, Ridge or Lasso regression."
+ "meaning that we have two features and two unknown parameters $\\theta_0$ and $\\theta_1$ to be determined either by ordinary least squares, Ridge or Lasso regression."
]
},
{
"cell_type": "markdown",
- "id": "35faa9c3",
+ "id": "26e6c40d",
"metadata": {
"editable": true
},
@@ -3320,19 +4340,19 @@
},
{
"cell_type": "markdown",
- "id": "1d9e928d",
+ "id": "aa9e70a1",
"metadata": {
"editable": true
},
"source": [
"$$\n",
- "\\hat{\\boldsymbol{\\beta}}^{\\mathrm{OLS}}=\\left( \\boldsymbol{X}^T\\boldsymbol{X}\\right)^{-1}\\boldsymbol{X}^T\\boldsymbol{y}.\n",
+ "\\hat{\\boldsymbol{\\theta}}^{\\mathrm{OLS}}=\\left( \\boldsymbol{X}^T\\boldsymbol{X}\\right)^{-1}\\boldsymbol{X}^T\\boldsymbol{y}.\n",
"$$"
]
},
{
"cell_type": "markdown",
- "id": "a6c85dfa",
+ "id": "a1a46c84",
"metadata": {
"editable": true
},
@@ -3342,19 +4362,19 @@
},
{
"cell_type": "markdown",
- "id": "707c9ba6",
+ "id": "f14d9318",
"metadata": {
"editable": true
},
"source": [
"$$\n",
- "\\hat{\\boldsymbol{\\beta}}^{\\mathrm{OLS}}=\\begin{bmatrix}2 \\\\ 2\\end{bmatrix},\n",
+ "\\hat{\\boldsymbol{\\theta}}^{\\mathrm{OLS}}=\\begin{bmatrix}2 \\\\ 2\\end{bmatrix},\n",
"$$"
]
},
{
"cell_type": "markdown",
- "id": "a262ea3d",
+ "id": "b71a9481",
"metadata": {
"editable": true
},
@@ -3364,7 +4384,7 @@
},
{
"cell_type": "markdown",
- "id": "a86375ed",
+ "id": "57629d3b",
"metadata": {
"editable": true
},
@@ -3376,19 +4396,19 @@
},
{
"cell_type": "markdown",
- "id": "0cf34409",
+ "id": "3062396e",
"metadata": {
"editable": true
},
"source": [
"$$\n",
- "\\hat{\\boldsymbol{\\beta}}^{\\mathrm{Ridge}}=\\left( \\boldsymbol{X}^T\\boldsymbol{X}+\\lambda\\boldsymbol{I}\\right)^{-1}\\boldsymbol{X}^T\\boldsymbol{y}.\n",
+ "\\hat{\\boldsymbol{\\theta}}^{\\mathrm{Ridge}}=\\left( \\boldsymbol{X}^T\\boldsymbol{X}+\\lambda\\boldsymbol{I}\\right)^{-1}\\boldsymbol{X}^T\\boldsymbol{y}.\n",
"$$"
]
},
{
"cell_type": "markdown",
- "id": "2b27c3be",
+ "id": "2879fd54",
"metadata": {
"editable": true
},
@@ -3398,32 +4418,32 @@
},
{
"cell_type": "markdown",
- "id": "a6f53a04",
+ "id": "10e94837",
"metadata": {
"editable": true
},
"source": [
"$$\n",
- "\\hat{\\boldsymbol{\\beta}}^{\\mathrm{Ridge}}=\\begin{bmatrix}\\frac{8}{4+\\lambda} \\\\ \\frac{2}{1+\\lambda}\\end{bmatrix},\n",
+ "\\hat{\\boldsymbol{\\theta}}^{\\mathrm{Ridge}}=\\begin{bmatrix}\\frac{8}{4+\\lambda} \\\\ \\frac{2}{1+\\lambda}\\end{bmatrix},\n",
"$$"
]
},
{
"cell_type": "markdown",
- "id": "b8b440e5",
+ "id": "d449327b",
"metadata": {
"editable": true
},
"source": [
- "There is normally a constraint on the value of $\\vert\\vert \\boldsymbol{\\beta}\\vert\\vert_2$ via the parameter $\\lambda$.\n",
- "Let us for simplicity assume that $\\beta_0^2+\\beta_1^2=1$ as constraint. This will allow us to find an expression for the optimal values of $\\beta$ and $\\lambda$.\n",
+ "There is normally a constraint on the value of $\\vert\\vert \\boldsymbol{\\theta}\\vert\\vert_2$ via the parameter $\\lambda$.\n",
+ "Let us for simplicity assume that $\\theta_0^2+\\theta_1^2=1$ as constraint. This will allow us to find an expression for the optimal values of $\\theta$ and $\\lambda$.\n",
"\n",
"To see this, let us write the cost function for Ridge regression."
]
},
{
"cell_type": "markdown",
- "id": "67fd1c0d",
+ "id": "52e8baa1",
"metadata": {
"editable": true
},
@@ -3435,85 +4455,85 @@
},
{
"cell_type": "markdown",
- "id": "3cdbca60",
+ "id": "ea867985",
"metadata": {
"editable": true
},
"source": [
"$$\n",
- "\\boldsymbol{X}\\boldsymbol{\\beta}=\\begin{bmatrix} 2\\beta_0 \\\\ \\beta_1 \\\\0 \\end{bmatrix},\n",
+ "\\boldsymbol{X}\\boldsymbol{\\theta}=\\begin{bmatrix} 2\\theta_0 \\\\ \\theta_1 \\\\0 \\end{bmatrix},\n",
"$$"
]
},
{
"cell_type": "markdown",
- "id": "ae419827",
+ "id": "864b48cf",
"metadata": {
"editable": true
},
"source": [
"$$\n",
- "C(\\boldsymbol{\\beta})=(4-2\\beta_0)^2+(2-\\beta_1)^2+\\lambda(\\beta_0^2+\\beta_1^2),\n",
+ "C(\\boldsymbol{\\theta})=(4-2\\theta_0)^2+(2-\\theta_1)^2+\\lambda(\\theta_0^2+\\theta_1^2),\n",
"$$"
]
},
{
"cell_type": "markdown",
- "id": "6a690852",
+ "id": "7f7ed5ba",
"metadata": {
"editable": true
},
"source": [
- "and taking the derivative with respect to $\\beta_0$ we get"
+ "and taking the derivative with respect to $\\theta_0$ we get"
]
},
{
"cell_type": "markdown",
- "id": "24417171",
+ "id": "d607e924",
"metadata": {
"editable": true
},
"source": [
"$$\n",
- "\\beta_0=\\frac{8}{4+\\lambda},\n",
+ "\\theta_0=\\frac{8}{4+\\lambda},\n",
"$$"
]
},
{
"cell_type": "markdown",
- "id": "1a4ff44b",
+ "id": "3bd4f95f",
"metadata": {
"editable": true
},
"source": [
- "and for $\\beta_1$ we obtain"
+ "and for $\\theta_1$ we obtain"
]
},
{
"cell_type": "markdown",
- "id": "7f1dc0b6",
+ "id": "f8940052",
"metadata": {
"editable": true
},
"source": [
"$$\n",
- "\\beta_1=\\frac{2}{1+\\lambda},\n",
+ "\\theta_1=\\frac{2}{1+\\lambda},\n",
"$$"
]
},
{
"cell_type": "markdown",
- "id": "c90156c1",
+ "id": "81bbbb0e",
"metadata": {
"editable": true
},
"source": [
- "Using the constraint for $\\beta_0^2+\\beta_1^2=1$ we can constrain $\\lambda$ by solving"
+ "Using the constraint for $\\theta_0^2+\\theta_1^2=1$ we can constrain $\\lambda$ by solving"
]
},
{
"cell_type": "markdown",
- "id": "9fa725ef",
+ "id": "ca83ff01",
"metadata": {
"editable": true
},
@@ -3525,54 +4545,54 @@
},
{
"cell_type": "markdown",
- "id": "1d2b029c",
+ "id": "0b5ac9e9",
"metadata": {
"editable": true
},
"source": [
- "which gives $\\lambda=4.571$ and $\\beta_0=0.933$ and $\\beta_1=0.359$."
+ "which gives $\\lambda=4.571$ and $\\theta_0=0.933$ and $\\theta_1=0.359$."
]
},
{
"cell_type": "markdown",
- "id": "271db328",
+ "id": "19ab9b33",
"metadata": {
"editable": true
},
"source": [
"## Lasso case\n",
"\n",
- "For Lasso we need now, keeping a constraint on $\\vert\\beta_0\\vert+\\vert\\beta_1\\vert=1$, to take the derivative of the absolute values of $\\beta_0$\n",
- "and $\\beta_1$. This gives us the following derivatives of the cost function"
+ "For Lasso we need now, keeping a constraint on $\\vert\\theta_0\\vert+\\vert\\theta_1\\vert=1$, to take the derivative of the absolute values of $\\theta_0$\n",
+ "and $\\theta_1$. This gives us the following derivatives of the cost function"
]
},
{
"cell_type": "markdown",
- "id": "d8b5b4f6",
+ "id": "59135778",
"metadata": {
"editable": true
},
"source": [
"$$\n",
- "C(\\boldsymbol{\\beta})=(4-2\\beta_0)^2+(2-\\beta_1)^2+\\lambda(\\vert\\beta_0\\vert+\\vert\\beta_1\\vert),\n",
+ "C(\\boldsymbol{\\theta})=(4-2\\theta_0)^2+(2-\\theta_1)^2+\\lambda(\\vert\\theta_0\\vert+\\vert\\theta_1\\vert),\n",
"$$"
]
},
{
"cell_type": "markdown",
- "id": "1232b642",
+ "id": "8d40d8ab",
"metadata": {
"editable": true
},
"source": [
"$$\n",
- "\\frac{\\partial C(\\boldsymbol{\\beta})}{\\partial \\beta_0}=-4(4-2\\beta_0)+\\lambda\\mathrm{sgn}(\\beta_0)=0,\n",
+ "\\frac{\\partial C(\\boldsymbol{\\theta})}{\\partial \\theta_0}=-4(4-2\\theta_0)+\\lambda\\mathrm{sgn}(\\theta_0)=0,\n",
"$$"
]
},
{
"cell_type": "markdown",
- "id": "fc401cbb",
+ "id": "9c0401f9",
"metadata": {
"editable": true
},
@@ -3582,36 +4602,36 @@
},
{
"cell_type": "markdown",
- "id": "53c50332",
+ "id": "aa075ce0",
"metadata": {
"editable": true
},
"source": [
"$$\n",
- "\\frac{\\partial C(\\boldsymbol{\\beta})}{\\partial \\beta_1}=-2(2-\\beta_1)+\\lambda\\mathrm{sgn}(\\beta_1)=0.\n",
+ "\\frac{\\partial C(\\boldsymbol{\\theta})}{\\partial \\theta_1}=-2(2-\\theta_1)+\\lambda\\mathrm{sgn}(\\theta_1)=0.\n",
"$$"
]
},
{
"cell_type": "markdown",
- "id": "50a046d9",
+ "id": "4e465dee",
"metadata": {
"editable": true
},
"source": [
- "We have now four cases to solve besides the trivial cases $\\beta_0$ and/or $\\beta_1$ are zero, namely\n",
- "1. $\\beta_0 > 0$ and $\\beta_1 > 0$,\n",
+ "We have now four cases to solve besides the trivial cases $\\theta_0$ and/or $\\theta_1$ are zero, namely\n",
+ "1. $\\theta_0 > 0$ and $\\theta_1 > 0$,\n",
"\n",
- "2. $\\beta_0 > 0$ and $\\beta_1 < 0$,\n",
+ "2. $\\theta_0 > 0$ and $\\theta_1 < 0$,\n",
"\n",
- "3. $\\beta_0 < 0$ and $\\beta_1 > 0$,\n",
+ "3. $\\theta_0 < 0$ and $\\theta_1 > 0$,\n",
"\n",
- "4. $\\beta_0 < 0$ and $\\beta_1 < 0$."
+ "4. $\\theta_0 < 0$ and $\\theta_1 < 0$."
]
},
{
"cell_type": "markdown",
- "id": "7ad94202",
+ "id": "7af63418",
"metadata": {
"editable": true
},
@@ -3623,19 +4643,19 @@
},
{
"cell_type": "markdown",
- "id": "24acdcc1",
+ "id": "0fff0234",
"metadata": {
"editable": true
},
"source": [
"$$\n",
- "-4(4-2\\beta_0)+\\lambda=0,\n",
+ "-4(4-2\\theta_0)+\\lambda=0,\n",
"$$"
]
},
{
"cell_type": "markdown",
- "id": "c3327ee1",
+ "id": "32328a87",
"metadata": {
"editable": true
},
@@ -3645,19 +4665,19 @@
},
{
"cell_type": "markdown",
- "id": "fe60589e",
+ "id": "6b6403d7",
"metadata": {
"editable": true
},
"source": [
"$$\n",
- "-2(2-\\beta_1)+\\lambda=0.\n",
+ "-2(2-\\theta_1)+\\lambda=0.\n",
"$$"
]
},
{
"cell_type": "markdown",
- "id": "5a662c04",
+ "id": "8823b897",
"metadata": {
"editable": true
},
@@ -3667,19 +4687,19 @@
},
{
"cell_type": "markdown",
- "id": "f1b6531c",
+ "id": "319984ba",
"metadata": {
"editable": true
},
"source": [
"$$\n",
- "\\beta_0=\\frac{16+\\lambda}{8},\n",
+ "\\theta_0=\\frac{16+\\lambda}{8},\n",
"$$"
]
},
{
"cell_type": "markdown",
- "id": "29464730",
+ "id": "2382a622",
"metadata": {
"editable": true
},
@@ -3689,29 +4709,29 @@
},
{
"cell_type": "markdown",
- "id": "c998bd2a",
+ "id": "24b75d16",
"metadata": {
"editable": true
},
"source": [
"$$\n",
- "\\beta_1=\\frac{4+\\lambda}{2}.\n",
+ "\\theta_1=\\frac{4+\\lambda}{2}.\n",
"$$"
]
},
{
"cell_type": "markdown",
- "id": "ab2ebc84",
+ "id": "4ba2f29c",
"metadata": {
"editable": true
},
"source": [
- "Using the constraint on $\\beta_0$ and $\\beta_1$ we can then find the optimal value of $\\lambda$ for the different cases. We leave this as an exercise to you."
+ "Using the constraint on $\\theta_0$ and $\\theta_1$ we can then find the optimal value of $\\lambda$ for the different cases. We leave this as an exercise to you."
]
},
{
"cell_type": "markdown",
- "id": "2dc43348",
+ "id": "dd65fa2e",
"metadata": {
"editable": true
},
@@ -3725,36 +4745,13 @@
},
{
"cell_type": "code",
- "execution_count": 5,
- "id": "20f9c9f3",
+ "execution_count": 7,
+ "id": "6f044cbb",
"metadata": {
"collapsed": false,
- "editable": true,
- "jupyter": {
- "outputs_hidden": false
- }
+ "editable": true
},
- "outputs": [
- {
- "name": "stdout",
- "output_type": "stream",
- "text": [
- "[2. 2.]\n",
- "Training MSE for OLS\n",
- "3.0\n"
- ]
- },
- {
- "data": {
- "image/png": "iVBORw0KGgoAAAANSUhEUgAAAioAAAGwCAYAAACHJU4LAAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjguNCwgaHR0cHM6Ly9tYXRwbG90bGliLm9yZy8fJSN1AAAACXBIWXMAAA9hAAAPYQGoP6dpAABB20lEQVR4nO3deZzN9eLH8feZMftmGWsGQ91EWUO2K9m3pFJXspYSiaSkbpKrO3FLXXWLUihl0qLSL2shRbYQspTIFCLLzNhmzMz398e3mXHMYmacmc9ZXs/H4/s4y3zOOe8zxpz3fJfP12FZliUAAAA35Gc6AAAAQF4oKgAAwG1RVAAAgNuiqAAAALdFUQEAAG6LogIAANwWRQUAALitUqYDXI6MjAwdPHhQERERcjgcpuMAAIACsCxLycnJqlKlivz88l9n4tFF5eDBg4qJiTEdAwAAFEFCQoKqVq2a7xiPLioRERGS7DcaGRlpOA0AACiIpKQkxcTEZH2O58eji0rm5p7IyEiKCgAAHqYgu22wMy0AAHBbFBUAAOC2KCoAAMBtefQ+KgWVnp6u8+fPm44BHxMQECB/f3/TMQDAo3l1UbEsS4cPH9bJkydNR4GPKl26tCpVqsQ8PwBQRF5dVDJLSoUKFRQaGsqHBUqMZVk6c+aMjhw5IkmqXLmy4UQA4Jm8tqikp6dnlZRy5cqZjgMfFBISIkk6cuSIKlSowGYgACgCr92ZNnOflNDQUMNJ4Msyf/7YRwoAisZri0omNvfAJH7+AODyeH1RAQAAnouiAgAA3BZFBZdl//79cjgc2rJlS55jVq5cKYfD4ZGHiQ8cOFC33HKL6RgA4LMoKm5o4MCB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Mzw8XOHh4frkk090ww03KCgoqMivdylbt27Vt99+qxo1auQ5JiEhQbfeequGDh2qBx54QBs3btQjjzziNObbb7/V0KFDNXnyZN18881avny5nnrqKacxS5Ys0d13361p06apdevW2rt3r+677z5J0tNPP12k/E8//bTi4uL04osvyt/fXxkZGapatarmz5+v6OhorVmzRvfdd58qV66sO+64I8/nmTNnjkaPHq1169Zp7dq1GjhwoFq2bKkOHToUKRcAN5SRIR06ZBeQX3+VEhKyl99+k775JvuzJC5OevPNvJ/r2LHsonLh3F4hIVJEhP0HbXh4zj9smzeXHnjAHhccnL0EBdlLlSrZY/v0kZo2lQID7TUgFy6lStmfT5mGDpUGDLALS26L3wV7heTyh2GJszxYYmKiJclKTEzM8bWzZ89aP/74o3X27NmcD7TrQ+5L167OY0ND8x7bpo3z2OjonGOKYMCAAVbPnj2to0ePWkFBQda+ffus/fv3W8HBwdbRo0etnj17WgMGDMga/+GHH1plypSxgoODrRYtWljjxo2ztm7d6vSc1atXtwIDA62wsDCnZcWKFXnmaNOmjRUQEGCFhYVZgYGBliTLz8/P+vDDD7PG7Nu3z5Jkbd682bIsyxo3bpx1zTXXWBkZGVljxo4da0myTpw4YVmWZd15551Wt27dnF6rb9++VlRUVNbt1q1bW//+97+dxrzzzjtW5cqVL/n9W7FihdPrWZZlSbJGjRp1yccOGzbMuu2227JuZ/5bZGrTpo3VqlUrp8c0adLEGjt2bK7Pl+/PIQDzEhMt67vvLOuttyzr/Pns+wcPzv+z4uefs8dOmWJZ9epZVrt2lnXnnZY1fLhljR9vWS+9ZFmzZ1vWyZPOr3f8uPNr+aD8Pr8v5gZVyYBTp/L+2sWrxP46V0uu/C7aF3n//iJHyk10dLS6deumOXPmyLIsdevWTdHR0TnG3XbbberWrZtWr16ttWvXavHixZoyZYpmzpzptNPto48+6nRbkq644op8M/Tt21dPPvmkkpKSNHnyZEVGRuq2227Lc/zOnTt1ww03OE101rx5c6cxu3fvVq9evZzua9q0qT7//POs25s2bdKGDRv07LPPZt2Xnp6uc+fO6cyZM0Wacfj666/Pcd/06dM1c+ZM/frrrzp79qxSU1OzNmHlpV69ek63K1eunHVOHwBu7MgRaf16adMm6fvvpc2b7TUkmVq1kq66yr5evbr9eVC9ur02olo1KSbGXqpWlSpWzH7co4/aS0FkrllBgflmUSnMfiPFNbaABg8erAcffFCS9L///S/PccHBwerQoYM6dOig8ePH695779XTTz/tVEyio6N15ZVXFur1o6Kish4zd+5c1a1bV2+++abuueeeXMdbBdjUZVlWjhlbL35cRkaGnnnmGd166605Hh984T5EhRB20b/P/Pnz9fDDD+uFF15Q8+bNFRERof/85z9at25dvs9z8U64DodDGRkZRcoEoJhkZEjbt0u1amX/bp42Tbrgj58sVapIdeo478cxZoz0xBPusenDx/Ev4OY6d+6s1L8OFevUqVOBH1enTp2sHUBdJSAgQE888YTGjRunPn365LpWI7fX/e6775xu165dW+vXr3e6b+PGjU63GzVqpN27dxe6WBXG6tWr1aJFCw0bNizrvr179xbb6wEoZr//Li1ZIi1ebO+IeuKEtGiR1Lmz/fWmTaW6daVGjaTGje3L666T/trp3gnniXMbFBU35+/vr507d2Zdv9ixY8fUu3dvDR48WPXq1VNERIQ2btyoKVOmqGfPnk5jk5OTdfjwYaf7QkNDsw7hLYi77rpLTzzxhF599VWNGTMmx9eHDh2qF154QaNHj9b999+vTZs25ZiHZMSIEfr73/+uqVOnqkePHvrqq6+0aNEip7Us48ePV/fu3RUTE6PevXvLz89PP/zwg7Zt26ZJkyYVOG9+rrzySr399ttasmSJYmNj9c4772jDhg2KzdzjHoD7S0iQXntN+vxzads256+FhUkHD2bfvvlme4FHYcI3DxAZGZlnmQgPD1ezZs304osv6u9//7uuvfZaPfXUUxoyZIheuegQuPHjx6ty5cpOy2OPPVaoLIGBgXrwwQc1ZcoUncplX59q1arpo48+0sKFC1W/fn1Nnz5d//73v53GtGzZUtOnT9fUqVNVv359LV68WA8//LDTJp1OnTrp888/17Jly9SkSRPdcMMNmjp1qqpXr16ovPkZOnSobr31Vt15551q1qyZj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mVmzZlmScl28xYABA3J9fytWrDAdrcj+97//WdWrV7cCAwOtRo0aedXhrStWrMj132vAgAGmo122vP6vzZo1y3Q0lxk8eHDWz2b58uWtdu3aWUuXLjUdq1iZPDzZZ/dRAQAA7s/9N9QDAACfRVEBAABui6ICAADcFkUFAAC4LYoKAABwWxQVAADgtigqAADAbVFUAACA26KoAF7oxhtv1KhRo0zHyNWxY8dUoUIF7d+/X5K0cuVKORyOYj+RYlFfZ/bs2SpdunShHtOkSRN9/PHHhXoMgNxRVABc0qFDh3TXXXfp6quvlp+fX54l6KOPPlKdOnUUFBSkOnXqaMGCBTnGxMXFqUePHqpRo0bxhjboqaee0uOPP66MjAzTUQCPR1EBcEkpKSkqX768nnzySdWvXz/XMWvXrtWdd96pfv36aevWrerXr5/uuOMOrVu3LmvM2bNn9eabb+ree+8tqehGdOvWTYmJiVqyZInpKIDHo6gAXu7EiRPq37+/ypQpo9DQUHXp0kU//fST05g33nhDMTExCg0NVa9evTR16lSnzR01atTQf//7X/Xv319RUVG5vs5LL72kDh06aNy4capdu7bGjRundu3a6aWXXsoas2jRIpUqVSrfM3MfO3ZMffr0UdWqVRUaGqrrrrtO8+bNcxpz4403asSIERo1apTKlCmjihUr6vXXX9fp06c1aNAgRUREqFatWlq0aFGO5//2229Vv359BQcHq1mzZjlOZz979mxVq1Yt63tx7Ngxp6/v3btXPXv2VMWKFRUeHq4mTZpo+fLlTmP8/f3VtWvXHLkBFB5FBfByAwcO1MaNG/XZZ59p7dq1sixLXbt21fnz5yXZH9xDhw7VyJEjtWXLFnXo0EHPPvtsoV9n7dq16tixo9N9nTp10po1a7Juf/3117r++uvzfZ5z586pcePG+vzzz7V9+3bdd9996tevn9OaGUmaM2eOoqOjtX79eo0YMUIPPPCAevfurRYtWuj7779Xp06d1K9fP505c8bpcY8++qief/55bdiwQRUqVNDNN9+c9b1Yt26dBg8erGHDhmnLli1q27atJk2a5PT4U6dOqWvXrlq+fLk2b96sTp06qUePHjpw4IDTuKZNm2r16tUF++YByJuRczYDKFaZp2Tfs2ePJcn69ttvs772559/WiEhIdb8+fMty7KsO++80+rWrZvT4/v27WtFRUXl+9wXCwgIsN59912n+959910rMDAw63bPnj2twYMHO41ZsWKFJck6ceJEnu+na9eu1iOPPOKUoVWrVlm309LSrLCwMKtfv35Z9x06dMiSZK1du9bpdeLj47PGHDt2zAoJCbHef/99y7Isq0+fPlbnzp2dXvvOO+/M83uRqU6dOtbLL7/sdN+nn35q+fn5Wenp6fk+FkD+WKMCeLGdO3eqVKlSatasWdZ95cqV09VXX62dO3dKknbv3q2mTZs6Pe7i2wXlcDicbluW5XTf2bNnFRwcnO9zpKen69lnn1W9evVUrlw5hYeHa+nSpTnWWNSrVy/rur+/v8qVK6frrrsu676KFStKko4cOeL0uAs3O5UtW9bpe7Fz584cm6Uuvn369Gk99thjqlOnjkqXLq3w8HDt2rUrR76QkBBlZGQoJSUl3/cLIH+lTAcAUHwsy8rz/swCcXGZyO9x+alUqZIOHz7sdN+RI0eyCoMkRUdH68SJE/k+zwsvvKAXX3xRL730kq677jqFhYVp1KhRSk1NdRoXEBDgdNvhcDjdl/meCnLkzYXfi0t59NFHtWTJEj3//PO68sorFRISottvvz1HvuPHjys0NFQhISGXfE4AeWONCuDF6tSpo7S0NKf9O44dO6Y9e/bommuukSTVrl1b69evd3rcxo0bC/1azZs317Jly5zuW7p0qVq0aJF1u2HDhvrxxx/zfZ7Vq1erZ8+euvvuu1W/fn3VrFkzx86/l+O7777Lun7ixAnt2bNHtWvXlmR/vy78+sXjM/MNHDhQvXr10nXXXadKlSplzQlzoe3bt6tRo0Yuyw34KooK4MWuuuoq9ezZU0OGDNE333yjrVu36u6779YVV1yhnj17SpJGjBihL774QlOnTtVPP/2kGTNmaNGiRTnWsmzZskVbtmzRqVOndPToUW3ZssWpdIwcOVJLly7V5MmTtWvXLk2ePFnLly93mnOlU6dO2rFjR75rVa688kotW7ZMa9as0c6dO3X//ffnWFNzOSZOnKgvv/xS27dv18CBAxUdHa1bbrlFkvTQQw9p8eLFmjJlivbs2aNXXnlFixcvzpHv448/1pYtW7R161bdddddua61Wb16dY6diwEUHkUF8HKzZs1S48aN1b17dzVv3lyWZemLL77I2kzSsmVLTZ8+XVOnTlX9+vW1ePFiPfzwwzn2JWnYsKEaNmyoTZs26b333lPDhg3VtWvXrK+3aNFC8fHxmjVrlurVq6fZs2fr/fffd9o/5rrrrtP111+v+fPn55n3qaeeUqNGjdSpUyfdeOONqlSpUlaRcIXnnntOI0eOVOPGjXXo0CF99tlnCgwMlCTdcMMNmjlzpl5++WU1aNBAS5cu1T//+U+nx7/44osqU6aMWrRooR49eqhTp0451pz8/vvvWrNmjQYNGuSy3ICvclhF2RgNwKsNGTJEu3btKpbDa7/44guNGTNG27dvl5+fd/6t9OijjyoxMVGvv/666SiAx2NnWgB6/vnn1aFDB4WFhWnRokWaM2eOXn311WJ5ra5du+qnn37S77//rpiYmGJ5DdMqVKigMWPGmI4BeAXWqADQHXfcoZUrVyo5OVk1a9bUiBEjNHToUNOxAICiAgAA3Jd3biAGAABegaICAADcFkUFAAC4LYoKAABwWxQVAADgtigqAADAbVFUAACA26KoAAAAt/X/J+Yjt6Z/fRcAAAAASUVORK5CYII=",
- "text/plain": [
- ""
- ]
- },
- "metadata": {},
- "output_type": "display_data"
- }
- ],
+ "outputs": [],
"source": [
"import os\n",
"import numpy as np\n",
@@ -3809,7 +4806,7 @@
},
{
"cell_type": "markdown",
- "id": "5f6a1a60",
+ "id": "d69f7030",
"metadata": {
"editable": true
},
@@ -3819,7 +4816,7 @@
},
{
"cell_type": "markdown",
- "id": "885d9cc9",
+ "id": "a8f9315a",
"metadata": {
"editable": true
},
@@ -3829,236 +4826,13 @@
},
{
"cell_type": "code",
- "execution_count": 6,
- "id": "76f8b826",
+ "execution_count": 8,
+ "id": "041fe053",
"metadata": {
"collapsed": false,
- "editable": true,
- "jupyter": {
- "outputs_hidden": false
- }
+ "editable": true
},
- "outputs": [
- {
- "name": "stdout",
- "output_type": "stream",
- "text": [
- "[2. 2.]\n",
- "Training MSE for OLS\n",
- "3.0\n",
- "[1.99995 1.99980002]\n",
- "[1.999925 1.9997 ]\n",
- "[1.99993978 1.99975913]\n",
- "[1.99990966 1.99963865]\n",
- "[1.99992746 1.99970988]\n",
- "[1.99989119 1.99956475]\n",
- "[1.99991263 1.99965056]\n",
- "[1.99986894 1.99947574]\n",
- "[1.99989476 1.99957911]\n",
- "[1.99984213 1.99936853]\n",
- "[1.99987324 1.99949306]\n",
- "[1.99980985 1.99923939]\n",
- "[1.99984732 1.99938942]\n",
- "[1.99977096 1.99908384]\n",
- "[1.9998161 1.99926459]\n",
- "[1.99972412 1.99889649]\n",
- "[1.99977849 1.99911427]\n",
- "[1.9996677 1.99867081]\n",
- "[1.9997332 1.99893323]\n",
- "[1.99959975 1.99839899]\n",
- "[1.99967865 1.99871521]\n",
- "[1.99951789 1.99807158]\n",
- "[1.99961294 1.99845267]\n",
- "[1.9994193 1.99767721]\n",
- "[1.99953381 1.99813653]\n",
- "[1.99930055 1.99720219]\n",
- "[1.9994385 1.99775587]\n",
- "[1.99915751 1.99663003]\n",
- "[1.9993237 1.99729756]\n",
- "[1.99898521 1.99594086]\n",
- "[1.99918546 1.9967458 ]\n",
- "[1.99877769 1.99511075]\n",
- "[1.99901896 1.99608161]\n",
- "[1.99852772 1.99411088]\n",
- "[1.99881845 1.99528218]\n",
- "[1.99822663 1.99290653]\n",
- "[1.998577 1.9943201]\n",
- "[1.99786397 1.99145589]\n",
- "[1.99828624 1.99316252]\n",
- "[1.99742715 1.98970859]\n",
- "[1.99793613 1.99176998]\n",
- "[1.99690099 1.98760396]\n",
- "[1.99751458 1.99009525]\n",
- "[1.99626723 1.98506893]\n",
- "[1.99700706 1.98808176]\n",
- "[1.99550387 1.98201547]\n",
- "[1.9963961 1.98566191]\n",
- "[1.99458439 1.97833757]\n",
- "[1.99566069 1.98275501]\n",
- "[1.99347688 1.97390753]\n",
- "[1.9947756 1.97926491]\n",
- "[1.99214288 1.96857153]\n",
- "[1.99371056 1.97507735]\n",
- "[1.99053607 1.96214429]\n",
- "[1.99242921 1.97005689]\n",
- "[1.98860067 1.95440267]\n",
- "[1.99088801 1.9640435 ]\n",
- "[1.98626946 1.94507785]\n",
- "[1.9890348 1.95684892]\n",
- "[1.98346152 1.93384608]\n",
- "[1.98680716 1.9482527 ]\n",
- "[1.98007934 1.92031737]\n",
- "[1.98413059 1.93799826]\n",
- "[1.9760055 1.90402199]\n",
- "[1.98091621 1.92578916]\n",
- "[1.97109854 1.88439414]\n",
- "[1.97705827 1.91128596]\n",
- "[1.96518808 1.86075233]\n",
- "[1.97243128 1.89410423]\n",
- "[1.95806892 1.83227569]\n",
- "[1.96688672 1.87381451]\n",
- "[1.94949387 1.79797548]\n",
- "[1.96024953 1.84994524]\n",
- "[1.93916519 1.75666075]\n",
- "[1.95231424 1.82198978]\n",
- "[1.92672425 1.70689701]\n",
- "[1.94284104 1.78941903]\n",
- "[1.9117391 1.64695641]\n",
- "[1.93155188 1.75170092]\n",
- "[1.89368944 1.57475775]\n",
- "[1.91812702 1.70832814]\n",
- "[1.87194855 1.48779421]\n",
- "[1.90220243 1.65885453]\n",
- "[1.84576158 1.38304631]\n",
- "[1.88336879 1.60293962]\n",
- "[1.81421927 1.25687709]\n",
- "[1.86117291 1.54039921]\n",
- "[1.77622646 1.10490583]\n",
- "[1.83512277 1.47125748]\n",
- "[1.73046398 0.9218559 ]\n",
- "[1.80469739 1.39579407]\n",
- "[1.6753429 0.70137162]\n",
- "[1.76936315 1.31457796]\n",
- "[1.60894938 0.43579751]\n",
- "[1.72859758 1.22847924]\n",
- "[1.52897814 0.11591257]\n",
- "[1.68192193 1.13865173]\n",
- "[1.4326525 0. ]\n",
- "[1.62894215 1.04648335]\n",
- "[1.31662793 0. ]\n",
- "[1.56939714 0.95351665]\n",
- "[1.17687593 0. ]\n",
- "[1.50321091 0.86134827]\n",
- "[1.00854414 0. ]\n",
- "[1.43054282 0.77152076]\n",
- "[0.8057879 0. ]\n",
- "[1.35182854 0.68542204]\n",
- "[0.5615673 0. ]\n",
- "[1.26780278 0.60420593]\n",
- "[0.26740272 0. ]\n",
- "[1.17949575 0.52874252]\n",
- "[0. 0.]\n",
- "[1.0881981 0.45960079]\n",
- "[0. 0.]\n",
- "[0.99539415 0.39706038]\n",
- "[0. 0.]\n",
- "[0.90266948 0.34114547]\n",
- "[0. 0.]\n",
- "[0.81160425 0.29167186]\n",
- "[0. 0.]\n",
- "[0.7236674 0.24829908]\n",
- "[0. 0.]\n",
- "[0.64012627 0.21058097]\n",
- "[0. 0.]\n",
- "[0.56198284 0.17801022]\n",
- "[0. 0.]\n",
- "[0.48994188 0.15005476]\n",
- "[0. 0.]\n",
- "[0.42441033 0.12618549]\n",
- "[0. 0.]\n",
- "[0.3655222 0.10589577]\n",
- "[0. 0.]\n",
- "[0.31318084 0.08871404]\n",
- "[0. 0.]\n",
- "[0.26710969 0.07421084]\n",
- "[0. 0.]\n",
- "[0.22690428 0.06200174]\n",
- "[0. 0.]\n",
- "[0.19207979 0.0517473 ]\n",
- "[0. 0.]\n",
- "[0.16211139 0.04315108]\n",
- "[0. 0.]\n",
- "[0.13646574 0.0359565 ]\n",
- "[0. 0.]\n",
- "[0.11462415 0.02994311]\n",
- "[0. 0.]\n",
- "[0.09609807 0.02492265]\n",
- "[0. 0.]\n",
- "[0.08043851 0.02073509]\n",
- "[0. 0.]\n",
- "[0.06724062 0.01724499]\n",
- "[0. 0.]\n",
- "[0.05614483 0.01433809]\n",
- "[0. 0.]\n",
- "[0.04683565 0.01191824]\n",
- "[0. 0.]\n",
- "[0.039039 0.00990475]\n",
- "[0. 0.]\n",
- "[0.03251863 0.00823002]\n",
- "[0. 0.]\n",
- "[0.02707227 0.00683748]\n",
- "[0. 0.]\n",
- "[0.02252765 0.0056799 ]\n",
- "[0. 0.]\n",
- "[0.01873869 0.00471782]\n",
- "[0. 0.]\n",
- "[0.01558197 0.00391839]\n",
- "[0. 0.]\n",
- "[0.01295356 0.0032542 ]\n",
- "[0. 0.]\n",
- "[0.01076611 0.00270244]\n",
- "[0. 0.]\n",
- "[0.00894639 0.00224413]\n",
- "[0. 0.]\n",
- "[0.0074331 0.00186347]\n",
- "[0. 0.]\n",
- "[0.00617499 0.00154733]\n",
- "[0. 0.]\n",
- "[0.00512927 0.00128479]\n",
- "[0. 0.]\n",
- "[0.00426027 0.00106677]\n",
- "[0. 0.]\n",
- "[0.00353823 0.00088573]\n",
- "[0. 0.]\n",
- "[0.00293838 0.00073541]\n",
- "[0. 0.]\n",
- "[0.0024401 0.00061058]\n",
- "[0. 0.]\n",
- "[0.00202624 0.00050694]\n",
- "[0. 0.]\n",
- "[0.00168251 0.00042089]\n",
- "[0. 0.]\n",
- "[0.00139705 0.00034944]\n",
- "[0. 0.]\n",
- "[0.00115999 0.00029012]\n",
- "[0. 0.]\n",
- "[0.00096314 0.00024087]\n",
- "[0. 0.]\n",
- "[0.00079968 0.00019998]\n",
- "[0. 0.]\n"
- ]
- },
- {
- "data": {
- "image/png": "iVBORw0KGgoAAAANSUhEUgAAAioAAAGwCAYAAACHJU4LAAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjguNCwgaHR0cHM6Ly9tYXRwbG90bGliLm9yZy8fJSN1AAAACXBIWXMAAA9hAAAPYQGoP6dpAABVRklEQVR4nO3dd3hT1RsH8G+6dxmllNFCAWXJHhVEhmwqVkBAQLYoQwRRhKJgHYjwQ0BBZEorIIgsESkUZMpeRWTvvUfaQmlpe35/HJM2dNCUpCfj+3me+9ybm5N734SWvD1TI4QQICIiIrJADqoDICIiIsoOExUiIiKyWExUiIiIyGIxUSEiIiKLxUSFiIiILBYTFSIiIrJYTFSIiIjIYjmpDuBZpKWl4erVq/D29oZGo1EdDhEREeWCEALx8fEoXrw4HBxyrjOx6kTl6tWrCAwMVB0GERER5cGlS5dQsmTJHMtYdaLi7e0NQL5RHx8fxdEQERFRbsTFxSEwMFD/PZ4Tq05UdM09Pj4+TFSIiIisTG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i1qxZqkMhsnrsTEtEmDhxIpo3bw5PT09ER0cjKioK06dPN8u92rRpg1OnTuHKlSsIDAw0yz1U8/f3x0cffaQ6DCKbwBoVIkKnTp2wefNmxMfHo0yZMhg8eDD69++vOiwiIiYqREREZLlss4GYiIiIbAITFSIiIrJYTFSIiIjIYjFRISIiIovFRIWIiIgsFhMVIiIislhMVIiIiMhiMVEhIiIii/V/Q1S6XH7Exj0AAAAASUVORK5CYII=",
- "text/plain": [
- ""
- ]
- },
- "metadata": {},
- "output_type": "display_data"
- }
- ],
+ "outputs": [],
"source": [
"import os\n",
"import numpy as np\n",
@@ -4120,7 +4894,7 @@
},
{
"cell_type": "markdown",
- "id": "b3da2bd5",
+ "id": "47db85e5",
"metadata": {
"editable": true
},
@@ -4130,38 +4904,13 @@
},
{
"cell_type": "code",
- "execution_count": 7,
- "id": "4504fbc8",
+ "execution_count": 9,
+ "id": "400b4a2a",
"metadata": {
"collapsed": false,
- "editable": true,
- "jupyter": {
- "outputs_hidden": false
- }
+ "editable": true
},
- "outputs": [
- {
- "name": "stdout",
- "output_type": "stream",
- "text": [
- "[ 2.03099776 -0.17917768 5.18029127]\n",
- "Training MSE for OLS\n",
- "0.009163470508352218\n",
- "Test MSE OLS\n",
- "0.008675369724975977\n"
- ]
- },
- {
- "data": {
- "image/png": "iVBORw0KGgoAAAANSUhEUgAAAjMAAAGwCAYAAABcnuQpAAAAOXRFWHRTb2Z0d2FyZQBNYXRwbG90bGliIHZlcnNpb24zLjguNCwgaHR0cHM6Ly9tYXRwbG90bGliLm9yZy8fJSN1AAAACXBIWXMAAA9hAAAPYQGoP6dpAAB+lElEQVR4nO3dd3hT5dvA8W+StunelLbQySp7b2QoUIaIgIiKyBAEGYIoAirzpyK8CigICirgAhyAi42UjcwCykb2KqN00N2c949DA6EDCi0nae/PdeU6I89J7qRpc/eZOkVRFIQQQgghbJRe6wCEEEIIIR6GJDNCCCGEsGmSzAghhBDCpkkyI4QQQgibJsmMEEIIIWyaJDNCCCG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5f/48W7dupXfv3gUWtxDFlU55kIZvIUSx169fPw4fPlwoQ4uXL1/Om2++yT///INeXzT/5xoxYgRxcXHMmTNH61CEsHnSAVgIcV8++ugjWrVqhYuLCytWrGDBggXMmjWrUJ6rXbt2HDt2jPPnzxMUFFQoz6E1Pz8/3nzzTa3DEKJIkJoZIcR9efbZZ4mKiiIhIYHw8HCGDBnCgAEDtA5LCCEkmRFCCCGEbSuajdFCCCGEKDYkmRFCCCGETZNkRgghhBA2TZIZIYQQQtg0SWaEEEIIYdMkmRFCCCGETZNkRgghhBA2TZIZIYQQQti0/wcb2+8OhZ1arAAAAABJRU5ErkJggg==",
- "text/plain": [
- ""
- ]
- },
- "metadata": {},
- "output_type": "display_data"
- }
- ],
+ "outputs": [],
"source": [
"import os\n",
"import numpy as np\n",
@@ -4242,35 +4991,9 @@
"plt.legend()\n",
"plt.show()"
]
- },
- {
- "cell_type": "code",
- "execution_count": null,
- "id": "d83f92e7-bb4a-42bf-bdb0-82a290be49f0",
- "metadata": {},
- "outputs": [],
- "source": []
}
],
- "metadata": {
- "kernelspec": {
- "display_name": "Python 3 (ipykernel)",
- "language": "python",
- "name": "python3"
- },
- "language_info": {
- "codemirror_mode": {
- "name": "ipython",
- "version": 3
- },
- "file_extension": ".py",
- "mimetype": "text/x-python",
- "name": "python",
- "nbconvert_exporter": "python",
- "pygments_lexer": "ipython3",
- "version": "3.9.15"
- }
- },
+ "metadata": {},
"nbformat": 4,
"nbformat_minor": 5
}
diff --git a/doc/src/week36/week36.do.txt b/doc/src/week36/week36.do.txt
index 581192358..c47d11b20 100644
--- a/doc/src/week36/week36.do.txt
+++ b/doc/src/week36/week36.do.txt
@@ -19,7 +19,7 @@ o Presentation and discussion of the first project
_Reading suggestion:_
o Goodfellow et al, Deep Learning, introduction to gradient descent, see chapter 4.3 at https://www.deeplearningbook.org/contents/numerical.html
o Rashcka et al, pages 37-44 and pages 278-283 with focus on linear regression.
-
+o Video on gradient descent at URL:"https://www.youtube.com/watch?v=sDv4f4s2SB8"
!split
===== Material for lecture Monday September 2 =====
@@ -987,7 +987,614 @@ We can redefine $\lambda$ to absorb the constant $n/2$ and we rewrite the last e
!et
-This equation does not lead to a nice analytical equation as in either Ridge regression or ordinary least squares. This equation can however be solved by using standard convex optimization algorithms.We will discuss how to code the above methods using gardient descent methods.
+This equation does not lead to a nice analytical equation as in either Ridge regression or ordinary least squares. This equation can however be solved by using standard convex optimization algorithms.We will discuss how to code the above methods using gradient descent methods.
+
+!split
+===== Optimization and gradient descent, the central part of any Machine Learning algortithm =====
+
+
+Almost every problem in machine learning and data science starts with
+a dataset $X$, a model $g(\theta)$, which is a function of the
+parameters $\theta$ and a cost function $C(X, g(\theta))$ that allows
+us to judge how well the model $g(\theta)$ explains the observations
+$X$. The model is fit by finding the values of $\theta$ that minimize
+the cost function. Ideally we would be able to solve for $\theta$
+analytically, however this is not possible in general and we must use
+some approximative/numerical method to compute the minimum.
+
+
+
+!split
+===== Reminder on Newton-Raphson's method =====
+
+Let us quickly remind ourselves how we derive the above method.
+
+Perhaps the most celebrated of all one-dimensional root-finding
+routines is Newton's method, also called the Newton-Raphson
+method. This method requires the evaluation of both the
+function $f$ and its derivative $f'$ at arbitrary points.
+If you can only calculate the derivative
+numerically and/or your function is not of the smooth type, we
+normally discourage the use of this method.
+
+!split
+===== The equations =====
+
+The Newton-Raphson formula consists geometrically of extending the
+tangent line at a current point until it crosses zero, then setting
+the next guess to the abscissa of that zero-crossing. The mathematics
+behind this method is rather simple. Employing a Taylor expansion for
+$x$ sufficiently close to the solution $s$, we have
+
+
+!bt
+\[
+ f(s)=0=f(x)+(s-x)f'(x)+\frac{(s-x)^2}{2}f''(x) +\dots.
+ \label{eq:taylornr}
+\]
+!et
+
+For small enough values of the function and for well-behaved
+functions, the terms beyond linear are unimportant, hence we obtain
+
+
+!bt
+\[
+ f(x)+(s-x)f'(x)\approx 0,
+\]
+!et
+yielding
+!bt
+\[
+ s\approx x-\frac{f(x)}{f'(x)}.
+\]
+!et
+
+Having in mind an iterative procedure, it is natural to start iterating with
+!bt
+\[
+ x_{n+1}=x_n-\frac{f(x_n)}{f'(x_n)}.
+\]
+!et
+
+!split
+===== Simple geometric interpretation =====
+
+The above is Newton-Raphson's method. It has a simple geometric
+interpretation, namely $x_{n+1}$ is the point where the tangent from
+$(x_n,f(x_n))$ crosses the $x$-axis. Close to the solution,
+Newton-Raphson converges fast to the desired result. However, if we
+are far from a root, where the higher-order terms in the series are
+important, the Newton-Raphson formula can give grossly inaccurate
+results. For instance, the initial guess for the root might be so far
+from the true root as to let the search interval include a local
+maximum or minimum of the function. If an iteration places a trial
+guess near such a local extremum, so that the first derivative nearly
+vanishes, then Newton-Raphson may fail totally
+
+
+!split
+===== Extending to more than one variable =====
+
+Newton's method can be generalized to systems of several non-linear equations
+and variables. Consider the case with two equations
+!bt
+\[
+ \begin{array}{cc} f_1(x_1,x_2) &=0\\
+ f_2(x_1,x_2) &=0,\end{array}
+\]
+!et
+which we Taylor expand to obtain
+
+!bt
+\[
+ \begin{array}{cc} 0=f_1(x_1+h_1,x_2+h_2)=&f_1(x_1,x_2)+h_1
+ \partial f_1/\partial x_1+h_2
+ \partial f_1/\partial x_2+\dots\\
+ 0=f_2(x_1+h_1,x_2+h_2)=&f_2(x_1,x_2)+h_1
+ \partial f_2/\partial x_1+h_2
+ \partial f_2/\partial x_2+\dots
+ \end{array}.
+\]
+!et
+Defining the Jacobian matrix ${\bf \bm{J}}$ we have
+!bt
+\[
+ {\bf \bm{J}}=\left( \begin{array}{cc}
+ \partial f_1/\partial x_1 & \partial f_1/\partial x_2 \\
+ \partial f_2/\partial x_1 &\partial f_2/\partial x_2
+ \end{array} \right),
+\]
+!et
+we can rephrase Newton's method as
+!bt
+\[
+\left(\begin{array}{c} x_1^{n+1} \\ x_2^{n+1} \end{array} \right)=
+\left(\begin{array}{c} x_1^{n} \\ x_2^{n} \end{array} \right)+
+\left(\begin{array}{c} h_1^{n} \\ h_2^{n} \end{array} \right),
+\]
+!et
+where we have defined
+!bt
+\[
+ \left(\begin{array}{c} h_1^{n} \\ h_2^{n} \end{array} \right)=
+ -{\bf \bm{J}}^{-1}
+ \left(\begin{array}{c} f_1(x_1^{n},x_2^{n}) \\ f_2(x_1^{n},x_2^{n}) \end{array} \right).
+\]
+!et
+We need thus to compute the inverse of the Jacobian matrix and it
+is to understand that difficulties may
+arise in case ${\bf \bm{J}}$ is nearly singular.
+
+It is rather straightforward to extend the above scheme to systems of
+more than two non-linear equations. In our case, the Jacobian matrix is given by the Hessian that represents the second derivative of cost function.
+
+
+
+!split
+===== Steepest descent =====
+
+The basic idea of gradient descent is
+that a function $F(\mathbf{x})$,
+$\mathbf{x} \equiv (x_1,\cdots,x_n)$, decreases fastest if one goes from $\bf {x}$ in the
+direction of the negative gradient $-\nabla F(\mathbf{x})$.
+
+It can be shown that if
+!bt
+\[
+\mathbf{x}_{k+1} = \mathbf{x}_k - \gamma_k \nabla F(\mathbf{x}_k),
+\]
+!et
+with $\gamma_k > 0$.
+
+For $\gamma_k$ small enough, then $F(\mathbf{x}_{k+1}) \leq
+F(\mathbf{x}_k)$. This means that for a sufficiently small $\gamma_k$
+we are always moving towards smaller function values, i.e a minimum.
+
+!split
+===== More on Steepest descent =====
+
+The previous observation is the basis of the method of steepest
+descent, which is also referred to as just gradient descent (GD). One
+starts with an initial guess $\mathbf{x}_0$ for a minimum of $F$ and
+computes new approximations according to
+
+!bt
+\[
+\mathbf{x}_{k+1} = \mathbf{x}_k - \gamma_k \nabla F(\mathbf{x}_k), \ \ k \geq 0.
+\]
+!et
+
+The parameter $\gamma_k$ is often referred to as the step length or
+the learning rate within the context of Machine Learning.
+
+!split
+===== The ideal =====
+
+Ideally the sequence $\{\mathbf{x}_k \}_{k=0}$ converges to a global
+minimum of the function $F$. In general we do not know if we are in a
+global or local minimum. In the special case when $F$ is a convex
+function, all local minima are also global minima, so in this case
+gradient descent can converge to the global solution. The advantage of
+this scheme is that it is conceptually simple and straightforward to
+implement. However the method in this form has some severe
+limitations:
+
+In machine learing we are often faced with non-convex high dimensional
+cost functions with many local minima. Since GD is deterministic we
+will get stuck in a local minimum, if the method converges, unless we
+have a very good intial guess. This also implies that the scheme is
+sensitive to the chosen initial condition.
+
+Note that the gradient is a function of $\mathbf{x} =
+(x_1,\cdots,x_n)$ which makes it expensive to compute numerically.
+
+
+!split
+===== The sensitiveness of the gradient descent =====
+
+The gradient descent method
+is sensitive to the choice of learning rate $\gamma_k$. This is due
+to the fact that we are only guaranteed that $F(\mathbf{x}_{k+1}) \leq
+F(\mathbf{x}_k)$ for sufficiently small $\gamma_k$. The problem is to
+determine an optimal learning rate. If the learning rate is chosen too
+small the method will take a long time to converge and if it is too
+large we can experience erratic behavior.
+
+Many of these shortcomings can be alleviated by introducing
+randomness. One such method is that of Stochastic Gradient Descent
+(SGD), to be discussed next week.
+
+
+!split
+===== Convex functions =====
+
+Ideally we want our cost/loss function to be convex(concave).
+
+First we give the definition of a convex set: A set $C$ in
+$\mathbb{R}^n$ is said to be convex if, for all $x$ and $y$ in $C$ and
+all $t \in (0,1)$ , the point $(1 − t)x + ty$ also belongs to
+C. Geometrically this means that every point on the line segment
+connecting $x$ and $y$ is in $C$ as discussed below.
+
+The convex subsets of $\mathbb{R}$ are the intervals of
+$\mathbb{R}$. Examples of convex sets of $\mathbb{R}^2$ are the
+regular polygons (triangles, rectangles, pentagons, etc...).
+
+!split
+===== Convex function =====
+
+_Convex function_: Let $X \subset \mathbb{R}^n$ be a convex set. Assume that the function $f: X \rightarrow \mathbb{R}$ is continuous, then $f$ is said to be convex if $$f(tx_1 + (1-t)x_2) \leq tf(x_1) + (1-t)f(x_2) $$ for all $x_1, x_2 \in X$ and for all $t \in [0,1]$. If $\leq$ is replaced with a strict inequaltiy in the definition, we demand $x_1 \neq x_2$ and $t\in(0,1)$ then $f$ is said to be strictly convex. For a single variable function, convexity means that if you draw a straight line connecting $f(x_1)$ and $f(x_2)$, the value of the function on the interval $[x_1,x_2]$ is always below the line as illustrated below.
+
+!split
+===== Conditions on convex functions =====
+
+In the following we state first and second-order conditions which
+ensures convexity of a function $f$. We write $D_f$ to denote the
+domain of $f$, i.e the subset of $R^n$ where $f$ is defined. For more
+details and proofs we refer to: "S. Boyd and L. Vandenberghe. Convex Optimization. Cambridge University Press":"http://stanford.edu/boyd/cvxbook/, 2004".
+
+!bblock First order condition
+Suppose $f$ is differentiable (i.e $\nabla f(x)$ is well defined for
+all $x$ in the domain of $f$). Then $f$ is convex if and only if $D_f$
+is a convex set and $$f(y) \geq f(x) + \nabla f(x)^T (y-x) $$ holds
+for all $x,y \in D_f$. This condition means that for a convex function
+the first order Taylor expansion (right hand side above) at any point
+a global under estimator of the function. To convince yourself you can
+make a drawing of $f(x) = x^2+1$ and draw the tangent line to $f(x)$ and
+note that it is always below the graph.
+!eblock
+
+!bblock Second order condition
+Assume that $f$ is twice
+differentiable, i.e the Hessian matrix exists at each point in
+$D_f$. Then $f$ is convex if and only if $D_f$ is a convex set and its
+Hessian is positive semi-definite for all $x\in D_f$. For a
+single-variable function this reduces to $f''(x) \geq 0$. Geometrically this means that $f$ has nonnegative curvature
+everywhere.
+!eblock
+
+This condition is particularly useful since it gives us an procedure for determining if the function under consideration is convex, apart from using the definition.
+
+!split
+===== More on convex functions =====
+
+The next result is of great importance to us and the reason why we are
+going on about convex functions. In machine learning we frequently
+have to minimize a loss/cost function in order to find the best
+parameters for the model we are considering.
+
+Ideally we want the
+global minimum (for high-dimensional models it is hard to know
+if we have local or global minimum). However, if the cost/loss function
+is convex the following result provides invaluable information:
+
+!bblock Any minimum is global for convex functions
+Consider the problem of finding $x \in \mathbb{R}^n$ such that $f(x)$
+is minimal, where $f$ is convex and differentiable. Then, any point
+$x^*$ that satisfies $\nabla f(x^*) = 0$ is a global minimum.
+!eblock
+
+This result means that if we know that the cost/loss function is convex and we are able to find a minimum, we are guaranteed that it is a global minimum.
+
+!split
+===== Some simple problems =====
+
+o Show that $f(x)=x^2$ is convex for $x \in \mathbb{R}$ using the definition of convexity. Hint: If you re-write the definition, $f$ is convex if the following holds for all $x,y \in D_f$ and any $\lambda \in [0,1]$ $\lambda f(x)+(1-\lambda)f(y)-f(\lambda x + (1-\lambda) y ) \geq 0$.
+
+o Using the second order condition show that the following functions are convex on the specified domain.
+ * $f(x) = e^x$ is convex for $x \in \mathbb{R}$.
+ * $g(x) = -\ln(x)$ is convex for $x \in (0,\infty)$.
+o Let $f(x) = x^2$ and $g(x) = e^x$. Show that $f(g(x))$ and $g(f(x))$ is convex for $x \in \mathbb{R}$. Also show that if $f(x)$ is any convex function than $h(x) = e^{f(x)}$ is convex.
+
+o A norm is any function that satisfy the following properties
+ * $f(\alpha x) = |\alpha| f(x)$ for all $\alpha \in \mathbb{R}$.
+ * $f(x+y) \leq f(x) + f(y)$
+ * $f(x) \leq 0$ for all $x \in \mathbb{R}^n$ with equality if and only if $x = 0$
+
+Using the definition of convexity, try to show that a function satisfying the properties above is convex (the third condition is not needed to show this).
+
+
+
+
+
+
+!split
+===== Revisiting Ordinary Least Squares =====
+
+We will use linear regression as a case study for the gradient descent
+methods. Linear regression is a great test case for the gradient
+descent methods discussed in the lectures since it has several
+desirable properties such as:
+
+o An analytical solution (recall homework sets for week 35).
+o The gradient can be computed analytically.
+o The cost function is convex which guarantees that gradient descent converges for small enough learning rates
+
+We revisit an example similar to what we had in the first homework set. We had a function of the type
+
+!bc pycod
+x = 2*np.random.rand(m,1)
+y = 4+3*x+np.random.randn(m,1)
+!ec
+with $x_i \in [0,1] $ is chosen randomly using a uniform distribution. Additionally we have a stochastic noise chosen according to a normal distribution $\cal {N}(0,1)$.
+The linear regression model is given by
+!bt
+\[
+h_\theta(x) = \bm{y} = \theta_0 + \theta_1 x,
+\]
+!et
+such that
+!bt
+\[
+\bm{y}_i = \theta_0 + \theta_1 x_i.
+\]
+!et
+
+!split
+===== Gradient descent example =====
+
+Let $\mathbf{y} = (y_1,\cdots,y_n)^T$, $\mathbf{\bm{y}} = (\bm{y}_1,\cdots,\bm{y}_n)^T$ and $\theta = (\theta_0, \theta_1)^T$
+
+It is convenient to write $\mathbf{\bm{y}} = X\theta$ where $X \in \mathbb{R}^{100 \times 2} $ is the design matrix given by (we keep the intercept here)
+!bt
+\[
+X \equiv \begin{bmatrix}
+1 & x_1 \\
+\vdots & \vdots \\
+1 & x_{100} & \\
+\end{bmatrix}.
+\]
+!et
+The cost/loss/risk function is given by (
+!bt
+\[
+C(\theta) = \frac{1}{n}||X\theta-\mathbf{y}||_{2}^{2} = \frac{1}{n}\sum_{i=1}^{100}\left[ (\theta_0 + \theta_1 x_i)^2 - 2 y_i (\theta_0 + \theta_1 x_i) + y_i^2\right]
+\]
+!et
+and we want to find $\theta$ such that $C(\theta)$ is minimized.
+
+!split
+===== The derivative of the cost/loss function =====
+
+Computing $\partial C(\theta) / \partial \theta_0$ and $\partial C(\theta) / \partial \theta_1$ we can show that the gradient can be written as
+!bt
+\[
+\nabla_{\theta} C(\theta) = \frac{2}{n}\begin{bmatrix} \sum_{i=1}^{100} \left(\theta_0+\theta_1x_i-y_i\right) \\
+\sum_{i=1}^{100}\left( x_i (\theta_0+\theta_1x_i)-y_ix_i\right) \\
+\end{bmatrix} = \frac{2}{n}X^T(X\theta - \mathbf{y}),
+\]
+!et
+where $X$ is the design matrix defined above.
+
+!split
+===== The Hessian matrix =====
+The Hessian matrix of $C(\theta)$ is given by
+!bt
+\[
+\bm{H} \equiv \begin{bmatrix}
+\frac{\partial^2 C(\theta)}{\partial \theta_0^2} & \frac{\partial^2 C(\theta)}{\partial \theta_0 \partial \theta_1} \\
+\frac{\partial^2 C(\theta)}{\partial \theta_0 \partial \theta_1} & \frac{\partial^2 C(\theta)}{\partial \theta_1^2} & \\
+\end{bmatrix} = \frac{2}{n}X^T X.
+\]
+!et
+This result implies that $C(\theta)$ is a convex function since the matrix $X^T X$ always is positive semi-definite.
+
+
+
+
+!split
+===== Simple program =====
+
+We can now write a program that minimizes $C(\theta)$ using the gradient descent method with a constant learning rate $\gamma$ according to
+!bt
+\[
+\theta_{k+1} = \theta_k - \gamma \nabla_\theta C(\theta_k), \ k=0,1,\cdots
+\]
+!et
+
+We can use the expression we computed for the gradient and let use a
+$\theta_0$ be chosen randomly and let $\gamma = 0.001$. Stop iterating
+when $||\nabla_\theta C(\theta_k) || \leq \epsilon = 10^{-8}$. _Note that the code below does not include the latter stop criterion_.
+
+And finally we can compare our solution for $\theta$ with the analytic result given by
+$\theta= (X^TX)^{-1} X^T \mathbf{y}$.
+
+!split
+===== Gradient Descent Example =====
+
+Here our simple example
+!bc pycod
+
+# Importing various packages
+from random import random, seed
+import numpy as np
+import matplotlib.pyplot as plt
+from mpl_toolkits.mplot3d import Axes3D
+from matplotlib import cm
+from matplotlib.ticker import LinearLocator, FormatStrFormatter
+import sys
+
+# the number of datapoints
+n = 100
+x = 2*np.random.rand(n,1)
+y = 4+3*x+np.random.randn(n,1)
+
+X = np.c_[np.ones((n,1)), x]
+# Hessian matrix
+H = (2.0/n)* X.T @ X
+# Get the eigenvalues
+EigValues, EigVectors = np.linalg.eig(H)
+print(f"Eigenvalues of Hessian Matrix:{EigValues}")
+
+theta_linreg = np.linalg.inv(X.T @ X) @ X.T @ y
+print(theta_linreg)
+theta = np.random.randn(2,1)
+
+eta = 1.0/np.max(EigValues)
+Niterations = 1000
+
+for iter in range(Niterations):
+ gradient = (2.0/n)*X.T @ (X @ theta-y)
+ theta -= eta*gradient
+
+print(theta)
+xnew = np.array([[0],[2]])
+xbnew = np.c_[np.ones((2,1)), xnew]
+ypredict = xbnew.dot(theta)
+ypredict2 = xbnew.dot(theta_linreg)
+plt.plot(xnew, ypredict, "r-")
+plt.plot(xnew, ypredict2, "b-")
+plt.plot(x, y ,'ro')
+plt.axis([0,2.0,0, 15.0])
+plt.xlabel(r'$x$')
+plt.ylabel(r'$y$')
+plt.title(r'Gradient descent example')
+plt.show()
+
+!ec
+
+!split
+===== And a corresponding example using _scikit-learn_ =====
+
+!bc pycod
+# Importing various packages
+from random import random, seed
+import numpy as np
+import matplotlib.pyplot as plt
+from sklearn.linear_model import SGDRegressor
+
+n = 100
+x = 2*np.random.rand(n,1)
+y = 4+3*x+np.random.randn(n,1)
+
+X = np.c_[np.ones((n,1)), x]
+theta_linreg = np.linalg.inv(X.T @ X) @ (X.T @ y)
+print(theta_linreg)
+sgdreg = SGDRegressor(max_iter = 50, penalty=None, eta0=0.1)
+sgdreg.fit(x,y.ravel())
+print(sgdreg.intercept_, sgdreg.coef_)
+
+!ec
+
+
+
+!split
+===== Gradient descent and Ridge =====
+
+We have also discussed Ridge regression where the loss function contains a regularized term given by the $L_2$ norm of $\theta$,
+!bt
+\[
+C_{\text{ridge}}(\theta) = \frac{1}{n}||X\theta -\mathbf{y}||^2 + \lambda ||\theta||^2, \ \lambda \geq 0.
+\]
+!et
+
+In order to minimize $C_{\text{ridge}}(\theta)$ using GD we adjust the gradient as follows
+!bt
+\[
+\nabla_\theta C_{\text{ridge}}(\theta) = \frac{2}{n}\begin{bmatrix} \sum_{i=1}^{100} \left(\theta_0+\theta_1x_i-y_i\right) \\
+\sum_{i=1}^{100}\left( x_i (\theta_0+\theta_1x_i)-y_ix_i\right) \\
+\end{bmatrix} + 2\lambda\begin{bmatrix} \theta_0 \\ \theta_1\end{bmatrix} = 2 (\frac{1}{n}X^T(X\theta - \mathbf{y})+\lambda \theta).
+\]
+!et
+
+We can easily extend our program to minimize $C_{\text{ridge}}(\theta)$ using gradient descent and compare with the analytical solution given by
+!bt
+\[
+\theta_{\text{ridge}} = \left(X^T X + n\lambda I_{2 \times 2} \right)^{-1} X^T \mathbf{y}.
+\]
+!et
+
+!split
+===== The Hessian matrix for Ridge Regression =====
+The Hessian matrix of Ridge Regression for our simple example is given by
+!bt
+\[
+\bm{H} \equiv \begin{bmatrix}
+\frac{\partial^2 C(\theta)}{\partial \theta_0^2} & \frac{\partial^2 C(\theta)}{\partial \theta_0 \partial \theta_1} \\
+\frac{\partial^2 C(\theta)}{\partial \theta_0 \partial \theta_1} & \frac{\partial^2 C(\theta)}{\partial \theta_1^2} & \\
+\end{bmatrix} = \frac{2}{n}X^T X+2\lambda\bm{I}.
+\]
+!et
+This implies that the Hessian matrix is positive definite, hence the stationary point is a
+minimum.
+Note that the Ridge cost function is convex being a sum of two convex
+functions. Therefore, the stationary point is a global
+minimum of this function.
+
+
+!split
+===== Program example for gradient descent with Ridge Regression =====
+!bc pycod
+from random import random, seed
+import numpy as np
+import matplotlib.pyplot as plt
+from mpl_toolkits.mplot3d import Axes3D
+from matplotlib import cm
+from matplotlib.ticker import LinearLocator, FormatStrFormatter
+import sys
+
+# the number of datapoints
+n = 100
+x = 2*np.random.rand(n,1)
+y = 4+3*x+np.random.randn(n,1)
+
+X = np.c_[np.ones((n,1)), x]
+XT_X = X.T @ X
+
+#Ridge parameter lambda
+lmbda = 0.001
+Id = n*lmbda* np.eye(XT_X.shape[0])
+
+# Hessian matrix
+H = (2.0/n)* XT_X+2*lmbda* np.eye(XT_X.shape[0])
+# Get the eigenvalues
+EigValues, EigVectors = np.linalg.eig(H)
+print(f"Eigenvalues of Hessian Matrix:{EigValues}")
+
+
+theta_linreg = np.linalg.inv(XT_X+Id) @ X.T @ y
+print(theta_linreg)
+# Start plain gradient descent
+theta = np.random.randn(2,1)
+
+eta = 1.0/np.max(EigValues)
+Niterations = 100
+
+for iter in range(Niterations):
+ gradients = 2.0/n*X.T @ (X @ (theta)-y)+2*lmbda*theta
+ theta -= eta*gradients
+
+print(theta)
+ypredict = X @ theta
+ypredict2 = X @ theta_linreg
+plt.plot(x, ypredict, "r-")
+plt.plot(x, ypredict2, "b-")
+plt.plot(x, y ,'ro')
+plt.axis([0,2.0,0, 15.0])
+plt.xlabel(r'$x$')
+plt.ylabel(r'$y$')
+plt.title(r'Gradient descent example for Ridge')
+plt.show()
+
+
+!ec
+
+!split
+===== Using gradient descent methods, limitations =====
+
+* _Gradient descent (GD) finds local minima of our function_. Since the GD algorithm is deterministic, if it converges, it will converge to a local minimum of our cost/loss/risk function. Because in ML we are often dealing with extremely rugged landscapes with many local minima, this can lead to poor performance.
+
+* _GD is sensitive to initial conditions_. One consequence of the local nature of GD is that initial conditions matter. Depending on where one starts, one will end up at a different local minima. Therefore, it is very important to think about how one initializes the training process. This is true for GD as well as more complicated variants of GD.
+
+* _Gradients are computationally expensive to calculate for large datasets_. In many cases in statistics and ML, the cost/loss/risk function is a sum of terms, with one term for each data point. For example, in linear regression, $E \propto \sum_{i=1}^n (y_i - \mathbf{w}^T\cdot\mathbf{x}_i)^2$; for logistic regression, the square error is replaced by the cross entropy. To calculate the gradient we have to sum over *all* $n$ data points. Doing this at every GD step becomes extremely computationally expensive. An ingenious solution to this, is to calculate the gradients using small subsets of the data called ``mini batches''. This has the added benefit of introducing stochasticity into our algorithm.
+
+* _GD is very sensitive to choices of learning rates_. GD is extremely sensitive to the choice of learning rates. If the learning rate is very small, the training process take an extremely long time. For larger learning rates, GD can diverge and give poor results. Furthermore, depending on what the local landscape looks like, we have to modify the learning rates to ensure convergence. Ideally, we would *adaptively* choose the learning rates to match the landscape.
+
+* _GD treats all directions in parameter space uniformly._ Another major drawback of GD is that unlike Newton's method, the learning rate for GD is the same in all directions in parameter space. For this reason, the maximum learning rate is set by the behavior of the steepest direction and this can significantly slow down training. Ideally, we would like to take large steps in flat directions and small steps in steep directions. Since we are exploring rugged landscapes where curvatures change, this requires us to keep track of not only the gradient but second derivatives. The ideal scenario would be to calculate the Hessian but this proves to be too computationally expensive.
+
+* GD can take exponential time to escape saddle points, even with random initialization. As we mentioned, GD is extremely sensitive to initial condition since it determines the particular local minimum GD would eventually reach. However, even with a good initialization scheme, through the introduction of randomness, GD can still take exponential time to escape saddle points.
+
@@ -1070,14 +1677,14 @@ Let us remind ourselves about the expression for the standard Mean Squared Error
our optimization problem is
!bt
\[
-{\displaystyle \min_{\bm{\beta}\in {\mathbb{R}}^{p}}}\frac{1}{n}\left\{\left(\bm{y}-\bm{X}\bm{\beta}\right)^T\left(\bm{y}-\bm{X}\bm{\beta}\right)\right\}.
+{\displaystyle \min_{\bm{\theta}\in {\mathbb{R}}^{p}}}\frac{1}{n}\left\{\left(\bm{y}-\bm{X}\bm{\theta}\right)^T\left(\bm{y}-\bm{X}\bm{\theta}\right)\right\}.
\]
!et
or we can state it as
!bt
\[
-{\displaystyle \min_{\bm{\beta}\in
-{\mathbb{R}}^{p}}}\frac{1}{n}\sum_{i=0}^{n-1}\left(y_i-\tilde{y}_i\right)^2=\frac{1}{n}\vert\vert \bm{y}-\bm{X}\bm{\beta}\vert\vert_2^2,
+{\displaystyle \min_{\bm{\theta}\in
+{\mathbb{R}}^{p}}}\frac{1}{n}\sum_{i=0}^{n-1}\left(y_i-\tilde{y}_i\right)^2=\frac{1}{n}\vert\vert \bm{y}-\bm{X}\bm{\theta}\vert\vert_2^2,
\]
!et
where we have used the definition of a norm-2 vector, that is
@@ -1091,34 +1698,34 @@ where we have used the definition of a norm-2 vector, that is
===== From OLS to Ridge and Lasso =====
By minimizing the above equation with respect to the parameters
-$\bm{\beta}$ we could then obtain an analytical expression for the
-parameters $\bm{\beta}$. We can add a regularization parameter $\lambda$ by
+$\bm{\theta}$ we could then obtain an analytical expression for the
+parameters $\bm{\theta}$. We can add a regularization parameter $\lambda$ by
defining a new cost function to be optimized, that is
!bt
\[
-{\displaystyle \min_{\bm{\beta}\in
-{\mathbb{R}}^{p}}}\frac{1}{n}\vert\vert \bm{y}-\bm{X}\bm{\beta}\vert\vert_2^2+\lambda\vert\vert \bm{\beta}\vert\vert_2^2
+{\displaystyle \min_{\bm{\theta}\in
+{\mathbb{R}}^{p}}}\frac{1}{n}\vert\vert \bm{y}-\bm{X}\bm{\theta}\vert\vert_2^2+\lambda\vert\vert \bm{\theta}\vert\vert_2^2
\]
!et
which leads to the Ridge regression minimization problem where we
-require that $\vert\vert \bm{\beta}\vert\vert_2^2\le t$, where $t$ is
+require that $\vert\vert \bm{\theta}\vert\vert_2^2\le t$, where $t$ is
a finite number larger than zero. We do not include such a constraints in the discussions here.
By defining
!bt
\[
-C(\bm{X},\bm{\beta})=\frac{1}{n}\vert\vert \bm{y}-\bm{X}\bm{\beta}\vert\vert_2^2+\lambda\vert\vert \bm{\beta}\vert\vert_1,
+C(\bm{X},\bm{\theta})=\frac{1}{n}\vert\vert \bm{y}-\bm{X}\bm{\theta}\vert\vert_2^2+\lambda\vert\vert \bm{\theta}\vert\vert_1,
\]
!et
we have a new optimization equation
!bt
\[
-{\displaystyle \min_{\bm{\beta}\in
-{\mathbb{R}}^{p}}}\frac{1}{n}\vert\vert \bm{y}-\bm{X}\bm{\beta}\vert\vert_2^2+\lambda\vert\vert \bm{\beta}\vert\vert_1
+{\displaystyle \min_{\bm{\theta}\in
+{\mathbb{R}}^{p}}}\frac{1}{n}\vert\vert \bm{y}-\bm{X}\bm{\theta}\vert\vert_2^2+\lambda\vert\vert \bm{\theta}\vert\vert_1
\]
!et
which leads to Lasso regression. Lasso stands for least absolute shrinkage and selection operator.
@@ -1138,17 +1745,17 @@ Using the matrix-vector expression for Ridge regression and dropping the paramet
!bt
\[
-C(\bm{X},\bm{\beta})=\left\{(\bm{y}-\bm{X}\bm{\beta})^T(\bm{y}-\bm{X}\bm{\beta})\right\}+\lambda\bm{\beta}^T\bm{\beta},
+C(\bm{X},\bm{\theta})=\left\{(\bm{y}-\bm{X}\bm{\theta})^T(\bm{y}-\bm{X}\bm{\theta})\right\}+\lambda\bm{\theta}^T\bm{\theta},
\]
!et
and
-taking the derivatives with respect to $\bm{\beta}$ we obtain then
+taking the derivatives with respect to $\bm{\theta}$ we obtain then
a slightly modified matrix inversion problem which for finite values
of $\lambda$ does not suffer from singularity problems. We obtain
the optimal parameters
!bt
\[
-\hat{\bm{\beta}}_{\mathrm{Ridge}} = \left(\bm{X}^T\bm{X}+\lambda\bm{I}\right)^{-1}\bm{X}^T\bm{y},
+\hat{\bm{\theta}}_{\mathrm{Ridge}} = \left(\bm{X}^T\bm{X}+\lambda\bm{I}\right)^{-1}\bm{X}^T\bm{y},
\]
!et
@@ -1158,7 +1765,7 @@ with $\bm{I}$ being a $p\times p$ identity matrix with the constraint that
!bt
\[
-\sum_{i=0}^{p-1} \beta_i^2 \leq t,
+\sum_{i=0}^{p-1} \theta_i^2 \leq t,
\]
!et
@@ -1168,11 +1775,11 @@ with $t$ a finite positive number.
!split
===== Note on Scikit-Learn =====
-Note well that a library like _Scikit-Learn_ does not include the $1/n$ factor in the expression for the mean-squared error. If you include it, the optimal parameter $\beta$ becomes
+Note well that a library like _Scikit-Learn_ does not include the $1/n$ factor in the expression for the mean-squared error. If you include it, the optimal parameter $\theta$ becomes
!bt
\[
-\hat{\bm{\beta}}_{\mathrm{Ridge}} = \left(\bm{X}^T\bm{X}+n\lambda\bm{I}\right)^{-1}\bm{X}^T\bm{y}.
+\hat{\bm{\theta}}_{\mathrm{Ridge}} = \left(\bm{X}^T\bm{X}+n\lambda\bm{I}\right)^{-1}\bm{X}^T\bm{y}.
\]
!et
@@ -1184,7 +1791,7 @@ In our codes where we compare our own codes with _Scikit-Learn_, we do thus not
When we compare this with the ordinary least squares result we have
!bt
\[
-\hat{\bm{\beta}}_{\mathrm{OLS}} = \left(\bm{X}^T\bm{X}\right)^{-1}\bm{X}^T\bm{y},
+\hat{\bm{\theta}}_{\mathrm{OLS}} = \left(\bm{X}^T\bm{X}\right)^{-1}\bm{X}^T\bm{y},
\]
!et
which can lead to singular matrices. However, with the SVD, we can always compute the inverse of the matrix $\bm{X}^T\bm{X}$.
@@ -1194,7 +1801,7 @@ We see that Ridge regression is nothing but the standard OLS with a
modified diagonal term added to $\bm{X}^T\bm{X}$. The consequences, in
particular for our discussion of the bias-variance tradeoff are rather
interesting. We will see that for specific values of $\lambda$, we may
-even reduce the variance of the optimal parameters $\bm{\beta}$. These topics and other related ones, will be discussed after the more linear algebra oriented analysis here.
+even reduce the variance of the optimal parameters $\bm{\theta}$. These topics and other related ones, will be discussed after the more linear algebra oriented analysis here.
!split
===== SVD analysis =====
@@ -1203,7 +1810,7 @@ Using our insights about the SVD of the design matrix $\bm{X}$
We have already analyzed the OLS solutions in terms of the eigenvectors (the columns) of the right singular value matrix $\bm{U}$ as
!bt
\[
-\tilde{\bm{y}}_{\mathrm{OLS}}=\bm{X}\bm{\beta} =\bm{U}\bm{U}^T\bm{y}.
+\tilde{\bm{y}}_{\mathrm{OLS}}=\bm{X}\bm{\theta} =\bm{U}\bm{U}^T\bm{y}.
\]
!et
@@ -1212,7 +1819,7 @@ For Ridge regression this becomes
!bt
\[
-\tilde{\bm{y}}_{\mathrm{Ridge}}=\bm{X}\bm{\beta}_{\mathrm{Ridge}} = \bm{U\Sigma V^T}\left(\bm{V}\bm{\Sigma}^2\bm{V}^T+\lambda\bm{I} \right)^{-1}(\bm{U\Sigma V^T})^T\bm{y}=\sum_{j=0}^{p-1}\bm{u}_j\bm{u}_j^T\frac{\sigma_j^2}{\sigma_j^2+\lambda}\bm{y},
+\tilde{\bm{y}}_{\mathrm{Ridge}}=\bm{X}\bm{\theta}_{\mathrm{Ridge}} = \bm{U\Sigma V^T}\left(\bm{V}\bm{\Sigma}^2\bm{V}^T+\lambda\bm{I} \right)^{-1}(\bm{U\Sigma V^T})^T\bm{y}=\sum_{j=0}^{p-1}\bm{u}_j\bm{u}_j^T\frac{\sigma_j^2}{\sigma_j^2+\lambda}\bm{y},
\]
!et
@@ -1252,7 +1859,7 @@ For the sake of simplicity, let us assume that the design matrix is orthonormal,
In this case the standard OLS results in
!bt
\[
-\bm{\beta}^{\mathrm{OLS}} = \bm{X}^T\bm{y}=\sum_{i=0}^{n-1}\bm{u}_i\bm{u}_i^T\bm{y},
+\bm{\theta}^{\mathrm{OLS}} = \bm{X}^T\bm{y}=\sum_{i=0}^{n-1}\bm{u}_i\bm{u}_i^T\bm{y},
\]
!et
@@ -1260,7 +1867,7 @@ and
!bt
\[
-\bm{\beta}^{\mathrm{Ridge}} = \left(\bm{I}+\lambda\bm{I}\right)^{-1}\bm{X}^T\bm{y}=\left(1+\lambda\right)^{-1}\bm{\beta}^{\mathrm{OLS}},
+\bm{\theta}^{\mathrm{Ridge}} = \left(\bm{I}+\lambda\bm{I}\right)^{-1}\bm{X}^T\bm{y}=\left(1+\lambda\right)^{-1}\bm{\theta}^{\mathrm{OLS}},
\]
!et
@@ -1280,27 +1887,27 @@ Using the matrix-vector expression for Lasso regression, we have the following _
!bt
\[
-C(\bm{X},\bm{\beta})=\frac{1}{n}\left\{(\bm{y}-\bm{X}\bm{\beta})^T(\bm{y}-\bm{X}\bm{\beta})\right\}+\lambda\vert\vert\bm{\beta}\vert\vert_1,
+C(\bm{X},\bm{\theta})=\frac{1}{n}\left\{(\bm{y}-\bm{X}\bm{\theta})^T(\bm{y}-\bm{X}\bm{\theta})\right\}+\lambda\vert\vert\bm{\theta}\vert\vert_1,
\]
!et
-Taking the derivative with respect to $\bm{\beta}$ and recalling that the derivative of the absolute value is (we drop the boldfaced vector symbol for simplicity)
+Taking the derivative with respect to $\bm{\theta}$ and recalling that the derivative of the absolute value is (we drop the boldfaced vector symbol for simplicity)
!bt
\[
-\frac{d \vert \beta\vert}{d \beta}=\mathrm{sgn}(\beta)=\left\{\begin{array}{cc} 1 & \beta > 0 \\-1 & \beta < 0, \end{array}\right.
+\frac{d \vert \theta\vert}{d \theta}=\mathrm{sgn}(\theta)=\left\{\begin{array}{cc} 1 & \theta > 0 \\-1 & \theta < 0, \end{array}\right.
\]
!et
we have that the derivative of the cost function is
!bt
\[
-\frac{\partial C(\bm{X},\bm{\beta})}{\partial \bm{\beta}}=-\frac{2}{n}\bm{X}^T(\bm{y}-\bm{X}\bm{\beta})+\lambda sgn(\bm{\beta})=0,
+\frac{\partial C(\bm{X},\bm{\theta})}{\partial \bm{\theta}}=-\frac{2}{n}\bm{X}^T(\bm{y}-\bm{X}\bm{\theta})+\lambda sgn(\bm{\theta})=0,
\]
!et
and reordering we have
!bt
\[
-\bm{X}^T\bm{X}\bm{\beta}+\lambda sgn(\bm{\beta})=\bm{X}^T\bm{y}.
+\bm{X}^T\bm{X}\bm{\theta}+\lambda sgn(\bm{\theta})=\bm{X}^T\bm{y}.
\]
!et
This equation does not lead to a nice analytical equation as in Ridge regression or ordinary least squares. We have absorbed the factor $2/n$ in a redefinition of the parameter $\lambda$. We will solve this type of problems using libraries like _scikit-learn_ and using our own gradient descent code in project 1.
@@ -1314,16 +1921,16 @@ This equation does not lead to a nice analytical equation as in Ridge regression
Let us assume that our design matrix is given by unit (identity) matrix, that is a square diagonal matrix with ones only along the
diagonal. In this case we have an equal number of rows and columns $n=p$.
-Our model approximation is just $\tilde{\bm{y}}=\bm{\beta}$ and the mean squared error and thereby the cost function for ordinary least sqquares (OLS) is then (we drop the term $1/n$)
+Our model approximation is just $\tilde{\bm{y}}=\bm{\theta}$ and the mean squared error and thereby the cost function for ordinary least sqquares (OLS) is then (we drop the term $1/n$)
!bt
\[
-C(\bm{\beta})=\sum_{i=0}^{p-1}(y_i-\beta_i)^2,
+C(\bm{\theta})=\sum_{i=0}^{p-1}(y_i-\theta_i)^2,
\]
!et
and minimizing we have that
!bt
\[
-\hat{\beta}_i^{\mathrm{OLS}} = y_i.
+\hat{\theta}_i^{\mathrm{OLS}} = y_i.
\]
!et
@@ -1333,13 +1940,13 @@ and minimizing we have that
For Ridge regression our cost function is
!bt
\[
-C(\bm{\beta})=\sum_{i=0}^{p-1}(y_i-\beta_i)^2+\lambda\sum_{i=0}^{p-1}\beta_i^2,
+C(\bm{\theta})=\sum_{i=0}^{p-1}(y_i-\theta_i)^2+\lambda\sum_{i=0}^{p-1}\theta_i^2,
\]
!et
and minimizing we have that
!bt
\[
-\hat{\beta}_i^{\mathrm{Ridge}} = \frac{y_i}{1+\lambda}.
+\hat{\theta}_i^{\mathrm{Ridge}} = \frac{y_i}{1+\lambda}.
\]
!et
@@ -1350,25 +1957,25 @@ and minimizing we have that
For Lasso regression our cost function is
!bt
\[
-C(\bm{\beta})=\sum_{i=0}^{p-1}(y_i-\beta_i)^2+\lambda\sum_{i=0}^{p-1}\vert\beta_i\vert=\sum_{i=0}^{p-1}(y_i-\beta_i)^2+\lambda\sum_{i=0}^{p-1}\sqrt{\beta_i^2},
+C(\bm{\theta})=\sum_{i=0}^{p-1}(y_i-\theta_i)^2+\lambda\sum_{i=0}^{p-1}\vert\theta_i\vert=\sum_{i=0}^{p-1}(y_i-\theta_i)^2+\lambda\sum_{i=0}^{p-1}\sqrt{\theta_i^2},
\]
!et
and minimizing we have that
!bt
\[
--2\sum_{i=0}^{p-1}(y_i-\beta_i)+\lambda \sum_{i=0}^{p-1}\frac{(\beta_i)}{\vert\beta_i\vert}=0,
+-2\sum_{i=0}^{p-1}(y_i-\theta_i)+\lambda \sum_{i=0}^{p-1}\frac{(\theta_i)}{\vert\theta_i\vert}=0,
\]
!et
which leads to
!bt
\[
-\hat{\bm{\beta}}_i^{\mathrm{Lasso}} = \left\{\begin{array}{ccc}y_i-\frac{\lambda}{2} &\mathrm{if} & y_i> \frac{\lambda}{2}\\
+\hat{\bm{\theta}}_i^{\mathrm{Lasso}} = \left\{\begin{array}{ccc}y_i-\frac{\lambda}{2} &\mathrm{if} & y_i> \frac{\lambda}{2}\\
y_i+\frac{\lambda}{2} &\mathrm{if} & y_i< -\frac{\lambda}{2}\\
0 &\mathrm{if} & \vert y_i\vert\le \frac{\lambda}{2}\end{array}\right.\\.
\]
!et
-Plotting these results shows clearly that Lasso regression suppresses (sets to zero) values of $\beta_i$ for specific values of $\lambda$. Ridge regression reduces on the other hand the values of $\beta_i$ as function of $\lambda$.
+Plotting these results shows clearly that Lasso regression suppresses (sets to zero) values of $\theta_i$ for specific values of $\lambda$. Ridge regression reduces on the other hand the values of $\theta_i$ as function of $\lambda$.
@@ -1388,7 +1995,7 @@ and our inputs as a $3\times 2$ design matrix
\bm{X}=\begin{bmatrix}2 & 0\\ 0 & 1 \\ 0 & 0\end{bmatrix},
\]
!et
-meaning that we have two features and two unknown parameters $\beta_0$ and $\beta_1$ to be determined either by ordinary least squares, Ridge or Lasso regression.
+meaning that we have two features and two unknown parameters $\theta_0$ and $\theta_1$ to be determined either by ordinary least squares, Ridge or Lasso regression.
!split
===== The OLS case =====
@@ -1397,14 +2004,14 @@ For ordinary least squares (OLS) we know that the optimal solution is
!bt
\[
-\hat{\bm{\beta}}^{\mathrm{OLS}}=\left( \bm{X}^T\bm{X}\right)^{-1}\bm{X}^T\bm{y}.
+\hat{\bm{\theta}}^{\mathrm{OLS}}=\left( \bm{X}^T\bm{X}\right)^{-1}\bm{X}^T\bm{y}.
\]
!et
Inserting the above values we obtain that
!bt
\[
-\hat{\bm{\beta}}^{\mathrm{OLS}}=\begin{bmatrix}2 \\ 2\end{bmatrix},
+\hat{\bm{\theta}}^{\mathrm{OLS}}=\begin{bmatrix}2 \\ 2\end{bmatrix},
\]
!et
@@ -1417,19 +2024,19 @@ For Ridge regression we have
!bt
\[
-\hat{\bm{\beta}}^{\mathrm{Ridge}}=\left( \bm{X}^T\bm{X}+\lambda\bm{I}\right)^{-1}\bm{X}^T\bm{y}.
+\hat{\bm{\theta}}^{\mathrm{Ridge}}=\left( \bm{X}^T\bm{X}+\lambda\bm{I}\right)^{-1}\bm{X}^T\bm{y}.
\]
!et
Inserting the above values we obtain that
!bt
\[
-\hat{\bm{\beta}}^{\mathrm{Ridge}}=\begin{bmatrix}\frac{8}{4+\lambda} \\ \frac{2}{1+\lambda}\end{bmatrix},
+\hat{\bm{\theta}}^{\mathrm{Ridge}}=\begin{bmatrix}\frac{8}{4+\lambda} \\ \frac{2}{1+\lambda}\end{bmatrix},
\]
!et
-There is normally a constraint on the value of $\vert\vert \bm{\beta}\vert\vert_2$ via the parameter $\lambda$.
-Let us for simplicity assume that $\beta_0^2+\beta_1^2=1$ as constraint. This will allow us to find an expression for the optimal values of $\beta$ and $\lambda$.
+There is normally a constraint on the value of $\vert\vert \bm{\theta}\vert\vert_2$ via the parameter $\lambda$.
+Let us for simplicity assume that $\theta_0^2+\theta_1^2=1$ as constraint. This will allow us to find an expression for the optimal values of $\theta$ and $\lambda$.
To see this, let us write the cost function for Ridge regression.
@@ -1440,63 +2047,63 @@ To see this, let us write the cost function for Ridge regression.
We define the MSE without the $1/n$ factor and have then, using that
!bt
\[
-\bm{X}\bm{\beta}=\begin{bmatrix} 2\beta_0 \\ \beta_1 \\0 \end{bmatrix},
+\bm{X}\bm{\theta}=\begin{bmatrix} 2\theta_0 \\ \theta_1 \\0 \end{bmatrix},
\]
!et
!bt
\[
-C(\bm{\beta})=(4-2\beta_0)^2+(2-\beta_1)^2+\lambda(\beta_0^2+\beta_1^2),
+C(\bm{\theta})=(4-2\theta_0)^2+(2-\theta_1)^2+\lambda(\theta_0^2+\theta_1^2),
\]
!et
-and taking the derivative with respect to $\beta_0$ we get
+and taking the derivative with respect to $\theta_0$ we get
!bt
\[
-\beta_0=\frac{8}{4+\lambda},
+\theta_0=\frac{8}{4+\lambda},
\]
!et
-and for $\beta_1$ we obtain
+and for $\theta_1$ we obtain
!bt
\[
-\beta_1=\frac{2}{1+\lambda},
+\theta_1=\frac{2}{1+\lambda},
\]
!et
-Using the constraint for $\beta_0^2+\beta_1^2=1$ we can constrain $\lambda$ by solving
+Using the constraint for $\theta_0^2+\theta_1^2=1$ we can constrain $\lambda$ by solving
!bt
\[
\left(\frac{8}{4+\lambda}\right)^2+\left(\frac{2}{1+\lambda}\right)^2=1,
\]
!et
-which gives $\lambda=4.571$ and $\beta_0=0.933$ and $\beta_1=0.359$.
+which gives $\lambda=4.571$ and $\theta_0=0.933$ and $\theta_1=0.359$.
!split
===== Lasso case =====
-For Lasso we need now, keeping a constraint on $\vert\beta_0\vert+\vert\beta_1\vert=1$, to take the derivative of the absolute values of $\beta_0$
-and $\beta_1$. This gives us the following derivatives of the cost function
+For Lasso we need now, keeping a constraint on $\vert\theta_0\vert+\vert\theta_1\vert=1$, to take the derivative of the absolute values of $\theta_0$
+and $\theta_1$. This gives us the following derivatives of the cost function
!bt
\[
-C(\bm{\beta})=(4-2\beta_0)^2+(2-\beta_1)^2+\lambda(\vert\beta_0\vert+\vert\beta_1\vert),
+C(\bm{\theta})=(4-2\theta_0)^2+(2-\theta_1)^2+\lambda(\vert\theta_0\vert+\vert\theta_1\vert),
\]
!et
!bt
\[
-\frac{\partial C(\bm{\beta})}{\partial \beta_0}=-4(4-2\beta_0)+\lambda\mathrm{sgn}(\beta_0)=0,
+\frac{\partial C(\bm{\theta})}{\partial \theta_0}=-4(4-2\theta_0)+\lambda\mathrm{sgn}(\theta_0)=0,
\]
!et
and
!bt
\[
-\frac{\partial C(\bm{\beta})}{\partial \beta_1}=-2(2-\beta_1)+\lambda\mathrm{sgn}(\beta_1)=0.
+\frac{\partial C(\bm{\theta})}{\partial \theta_1}=-2(2-\theta_1)+\lambda\mathrm{sgn}(\theta_1)=0.
\]
!et
-We have now four cases to solve besides the trivial cases $\beta_0$ and/or $\beta_1$ are zero, namely
-o $\beta_0 > 0$ and $\beta_1 > 0$,
-o $\beta_0 > 0$ and $\beta_1 < 0$,
-o $\beta_0 < 0$ and $\beta_1 > 0$,
-o $\beta_0 < 0$ and $\beta_1 < 0$.
+We have now four cases to solve besides the trivial cases $\theta_0$ and/or $\theta_1$ are zero, namely
+o $\theta_0 > 0$ and $\theta_1 > 0$,
+o $\theta_0 > 0$ and $\theta_1 < 0$,
+o $\theta_0 < 0$ and $\theta_1 > 0$,
+o $\theta_0 < 0$ and $\theta_1 < 0$.
!split
===== The first Case =====
@@ -1504,30 +2111,30 @@ o $\beta_0 < 0$ and $\beta_1 < 0$.
If we consider the first case, we have then
!bt
\[
--4(4-2\beta_0)+\lambda=0,
+-4(4-2\theta_0)+\lambda=0,
\]
!et
and
!bt
\[
--2(2-\beta_1)+\lambda=0.
+-2(2-\theta_1)+\lambda=0.
\]
!et
which yields
!bt
\[
-\beta_0=\frac{16+\lambda}{8},
+\theta_0=\frac{16+\lambda}{8},
\]
!et
and
!bt
\[
-\beta_1=\frac{4+\lambda}{2}.
+\theta_1=\frac{4+\lambda}{2}.
\]
!et
-Using the constraint on $\beta_0$ and $\beta_1$ we can then find the optimal value of $\lambda$ for the different cases. We leave this as an exercise to you.
+Using the constraint on $\theta_0$ and $\theta_1$ we can then find the optimal value of $\lambda$ for the different cases. We leave this as an exercise to you.
!split
===== Simple code for solving the above problem =====
@@ -1744,3 +2351,5 @@ plt.show()
+
+