Lecture13-14 Gradient(RSS)

📚 Lecture13-14_Gradient(RSS).pdf

Brief overview

This document introduces the concept of the Residual Sum of Squares (RSS) as a metric for evaluating model performance. Understanding RSS is crucial for gradient-based optimization methods used in statistical modeling.

Key points

  • Calculating the residual sum of squares using its formula.
  • Expressing RSS in vectorial form for computational efficiency.
  • Methods for finding the RSS in a vectorial representation.

1. Calculating the residual sum of squares

1.1 The residual sum of squares formula

The residual sum of squares (RSS) measures the difference between observed values and predicted values. It quantifies the error in a model's predictions.

The formula for RSS, denoted as RSS(W), involves summing the squared differences between the actual values (yiy_i) and the predicted values (<W, x_i>).

The RSS can be expressed in several equivalent forms. One form is: RSS(W)=∑i=1N(yi−⟨W,xi⟩)2\text{RSS}(W) = \sum_{i=1}^{N} (y_i - \langle W, x_i \rangle)^2.

This can be expanded to: RSS(W)=∑i=1N(yi2+⟨W,xi⟩2−2yi⟨W,xi⟩)\text{RSS}(W) = \sum_{i=1}^{N} (y_i^2 + \langle W, x_i \rangle^2 - 2 y_i \langle W, x_i \rangle).

1.2 Vectorial form of RSS

In vectorial form, the RSS calculation becomes more compact. The design matrix XX contains the feature vectors xix_i as rows.

The vector yy contains the observed values. The vector WW represents the model's weights.

The RSS can be written as: RSS(W)=∥y−XW∥2\text{RSS}(W) = \| y - XW \|^2.

This is equivalent to: RSS(W)=(y−XW)T(y−XW)\text{RSS}(W) = (y - XW)^T (y - XW).

1.3 Calculating the gradient of RSS

To minimize the RSS, we often compute its gradient with respect to the weights WW. The gradient tells us the direction of the steepest increase in RSS.

The gradient of RSS(W) is given by: ∇WRSS(W)=−2XT(y−XW)\nabla_{\text{W}} \text{RSS}(W) = -2 X^T (y - XW).

This formula shows how changes in the weights WW affect the total error. Setting this gradient to zero helps find the optimal weights that minimize the RSS.

🔑 Important: Minimizing the RSS is a common objective in regression tasks, as it seeks to find the model that best fits the training data 1.

© 2026 Maeve. All rights reserved. This content is protected by copyright.

See also