# #11 Machine Learning Specialization [Course 1, Week 1, Lesson 3] | Summary and Q&A

34.6K views
December 1, 2022
by
DeepLearningAI
#11 Machine Learning Specialization [Course 1, Week 1, Lesson 3]

## TL;DR

Linear regression involves finding the best-fit line to a set of data, and the cost function measures how well the line fits the data.

## Key Insights

• 🫥 Linear regression involves adjusting parameters to fit a line to data.
• 🏙️ The parameters W and B determine the slope and y-intercept of the line.
• 🇨🇷 The cost function measures the fit between predicted and actual values.
• 🍹 The cost function is calculated by summing the squared errors between predicted and actual values.
• 🫥 Minimizing the cost function improves the fit of the line to the data.
• 🇨🇷 The cost function is commonly used in linear regression and other regression problems.
• 🤶 The cost function can be divided by 2 times M for neatness, but it is not necessary.

## Transcript

in order to implement linear regression the first key step is for us to define something called a cost function this is something we built in this video and the cost function will tell us how well the model is doing so that we can try to get it to do better let's look at what this means recall that you have a training set that contains input featur... Read More

### Q: What are the parameters in linear regression?

In linear regression, the parameters are W and B, which represent the slope and y-intercept of the line, respectively. These values are adjusted during training to fit the data.

### Q: How does the cost function relate to linear regression?

The cost function measures how well the model fits the training data. It calculates the squared error between the predicted values and the actual targets. The goal is to minimize the cost function to achieve a better fit.

### Q: What does the cost function tell us about the model's performance?

The cost function provides a quantitative measure of how well the model is performing. A smaller cost function value indicates a better fit of the line to the data, while a larger value indicates a poorer fit.

### Q: Why is the squared error used in the cost function?

The squared error is used because it penalizes larger errors more than smaller ones. Squaring the errors ensures that negative and positive errors do not cancel each other out, giving a more accurate representation of overall error.

## Summary & Key Takeaways

• Linear regression involves fitting a line to a set of training data by adjusting the parameters W and B.

• The values of W and B determine the slope and y-intercept of the line.

• The cost function measures the squared error between the predicted values and the actual targets in the training set.