What is the least squares cost function?
The least squares cost function measures the average squared difference between the predicted values (based on the model parameters and features) and the actual target values. It is commonly used in linear regression to evaluate model performance.
Conditions
- Used for regression problems where the goal is to predict a continuous value.
- Assumes a linear relationship between the features and the target variable.
Reasoning, step by step
- Identify the predicted value for a data point: .
- Identify the actual target value: .
- Calculate the error (difference) for the data point: .
- Square the error: .
- Sum the squared errors over all training examples and divide by .
- The cost function is .
Example
The video displays the formula on-screen as "" and refers to it as the least square cost function.
Common misconceptions
- Forgetting the factor of , which averages the squared errors and simplifies the derivative calculation.
- Assuming the cost function measures the absolute difference rather than the squared difference.
Watch the explanation
3:27 – 3:36Watch this moment ↗
Explore next
Answers are generated from source material and independently checked. Consult the original video or creator if something is unclear.