18 min total

Machine Learning

Multiple features & scaling

Multiple features & scaling
Multivariate linear regressionMultiple linear regression
Multiple dependent and independent variablesSingle dependent and multiple independent variables

Linear regression weight update equation:

Multiple features and gradient descent — illustration
Multiple features and gradient descent — illustration
Multiple features and gradient descent — illustration

Multiple-feature gradient descent

Multiple features and gradient descent — illustration

Normal equation

The normal equation is an alternative technique to gradient descent for linear regression. It provides a closed-form solution for the weights (w) and bias (b) without iterations.

computationally expensive when the number of features is large (> 10,000).

Normal equation uses analytical approach when solving linear regression problems

Whereas gradient descent is a numerical approach

Feature scaling techniques

  1. Relative maximum scaling
    each feature divided by maximum value, so maximum value becomes 1
Multiple features and gradient descent — illustration
  1. Mean Normalization
    features are centered around zero. Results in values between -1 and 1
    after normalization, values of features will be scaled down and centered around zero
  2. Z-score Normalization
    uses mean and std both. Transforms data into standard normal distribution where mean is 0 and std is 1
    useful when features have different variances
Learning a regression model — illustration

How to test if your model has converged?

  1. Use learning curve graph
  2. Use automatic convergence test
    let epsilon be 10^-3
    if J <= epsilon
        declare convergence