[Least-squares loss] What are a, b, and c in the quadratic expansion f(w)=0.5*a*w^2-b*w+c?
a=sum_i x_i^2, b=sum_i x_i*y_i, and c=0.5*sum_i y_i^2.
49
New cards
[Least-squares loss] What is the least-squares solution for one feature and no intercept?
w_star = [sum_i x_i*y_i]/[sum_i x_i^2], provided the denominator is positive.
50
New cards
[Least-squares loss] How is the no-intercept least-squares formula derived?
Differentiate half-SSE, set w*sum_i x_i^2-sum_i x_i*y_i=0, and solve for w.
51
New cards
[Least-squares loss] What is the second derivative of half-SSE for one feature and no intercept?
f''(w) = sum_i x_i^2.
52
New cards
[Least-squares loss] When is the no-intercept one-feature least-squares minimum unique?
When at least one input x_i is nonzero, so sum_i x_i^2 > 0.
53
New cards
[Least-squares loss] What happens if every x_i is zero in the no-intercept model?
Every prediction is zero regardless of w, so all values of w have the same loss and the usual ratio formula is undefined.
54
New cards
[Least-squares loss] For no-intercept data (x,y)={(1,2),(2,3)}, what is the fitted slope?
w_star = (1*2+2*3)/(1^2+2^2) = 8/5 = 1.6.
55
New cards
[Least-squares loss] For no-intercept data {(1,2),(2,3)} and w=1.6, what is SSE?
Predictions are 1.6 and 3.2; SSE = (-0.4)^2+(0.2)^2 = 0.20.
56
New cards
[Multivariable optimization] What is the d-dimensional least-squares objective?
f(w) = sum_i (w^T*x_i-y_i)^2, or a positive constant multiple such as half that sum.
57
New cards
[Multivariable optimization] What is a gradient?
The column vector of partial derivatives of an objective with respect to all its parameters.
58
New cards
[Multivariable optimization] What is the jth partial derivative of half-SSE?
partial f/partial w_j = sum_i x_ij*(w^T*x_i-y_i).
59
New cards
[Multivariable optimization] What stationary-point condition replaces f'(w)=0 for several parameters?
Set the gradient vector equal to the zero vector: grad f(w)=0.
60
New cards
[Multivariable optimization] What is the matrix gradient of f(w)=0.5*||X*w-y||^2?
grad f(w) = X^T*(X*w-y).
61
New cards
[Multivariable optimization] What equations result from setting the least-squares matrix gradient to zero?
X^T*X*w = X^T*y, called the normal equations.
62
New cards
[Multivariable optimization] When can the normal-equation solution be written using an inverse?
If X has full column rank, w_star=(X^T*X)^(-1)*X^T*y. If not, a unique inverse-based solution is not available.
63
New cards
[Multivariable optimization] Why is linear least squares convex?
Its Hessian X^T*X is positive semidefinite, so every stationary point is a global minimum.
64
New cards
[Multivariable optimization] Does convexity always imply a unique least-squares parameter vector?
No. If the columns of X are linearly dependent, multiple parameter vectors can give the same minimum predictions/loss.
65
New cards
[Multivariable optimization] What is the gradient-descent update rule?
w <- w - eta*grad f(w), where eta > 0 is the learning rate.
66
New cards
[Multivariable optimization] Why does gradient descent subtract the gradient?
The gradient points toward local steepest increase, so its negative gives a direction of local decrease.
67
New cards
[Multivariable optimization] What does the learning rate control?
The step size of each parameter update.
68
New cards
[Multivariable optimization] What can happen if the learning rate is too large?
Updates can overshoot the minimum, oscillate, or diverge.
69
New cards
[Multivariable optimization] What can happen if the learning rate is very small?
Progress toward the minimum can be very slow.
70
New cards
[Multivariable optimization] If w=2, grad f(w)=3, and eta=0.1, what is the next gradient-descent value?
2-0.1*3 = 1.7.
71
New cards
[Multivariable optimization] How do an analytical solution and gradient descent differ?
An analytical approach solves the stationary equations directly; gradient descent approaches a solution through repeated numerical updates.
72
New cards
[Regularization] What regression behavior illustrates overfitting in the slides?
As models become more flexible and weights grow, training error falls while test error can rise.
73
New cards
[Regularization] What is regularization?
Adding a penalty or constraint that discourages overly complex parameter settings and can improve generalization.
74
New cards
[Regularization] What is the ridge objective using the half-SSE convention shown in the slides?
J_ridge(w) = 0.5*sum_i(y_i-w^T*x_i)^2 + alpha*||w||_2^2, with alpha >= 0.
75
New cards
[Regularization] What is the ridge penalty ||w||_2^2?
The sum of squared penalized coefficients: sum_j w_j^2.
76
New cards
[Regularization] What is the lasso objective using the half-SSE convention shown in the slides?
J_lasso(w) = 0.5*sum_i(y_i-w^T*x_i)^2 + alpha*||w||_1, with alpha >= 0.
77
New cards
[Regularization] What is the lasso penalty ||w||_1?
The sum of absolute values of the penalized coefficients: sum_j |w_j|.
78
New cards
[Regularization] What does alpha control in ridge and lasso?
The relative strength of the coefficient penalty compared with fitting the training targets.
79
New cards
[Regularization] What happens at alpha=0 in the regularized regression objectives?
The penalty disappears, leaving ordinary least squares.
80
New cards
[Regularization] What generally happens as regularization strength increases?
Coefficients are pushed more strongly toward smaller values; too much regularization can underfit.
81
New cards
[Regularization] What is a typical difference between ridge and lasso coefficients?
Ridge shrinks coefficients continuously and usually retains them; lasso can set some coefficients exactly to zero.
82
New cards
[Regularization] Why can lasso act as feature selection?
A zero coefficient removes that feature's direct contribution to the linear prediction.
83
New cards
[Regularization] What geometry represents a two-coefficient L2 constraint?
A disk or circular boundary centered at the origin.
84
New cards
[Regularization] What geometry represents a two-coefficient L1 constraint?
A diamond with corners on the coefficient axes.
85
New cards
[Regularization] Why do the corners of the L1 constraint help explain sparse lasso solutions?
A loss contour can first meet a corner where one coefficient is exactly zero.
86
New cards
[Regularization] Why can regularization improve test error while worsening training fit?
It sacrifices some fit to the observed sample to reduce unstable, sample-specific parameter choices.
87
New cards
[Regularization] How does regularization relate to bias and variance?
Stronger regularization often increases bias while reducing variance; the useful strength balances these effects.
88
New cards
[Regularization] How should alpha be chosen?
Use validation or cross-validation on development data rather than optimizing final test-set performance.
89
New cards
[Regularization] Why should coefficient scale be considered before applying L1 or L2 penalties?
Rescaling a feature changes the coefficient needed for the same prediction and therefore changes its penalty; comparable feature scales often make penalties more meaningful.
90
New cards
[Regularization] For w=(3,-4), what are ||w||_1 and ||w||_2^2?
||w||_1=|3|+|-4|=7; ||w||_2^2=3^2+(-4)^2=25.
91
New cards
[Regularization] If alpha=0.1 and w=(3,-4), what are the L1 and squared-L2 penalty contributions?