Recall & Review
beginner
What is the main goal of linear regression?
The main goal of linear regression is to find a straight line that best fits the relationship between input features and a continuous output, so it can predict new values.
Click to reveal answer
beginner
Which scikit-learn class is used to perform linear regression?The class
LinearRegression from sklearn.linear_model is used to create and train a linear regression model.Click to reveal answer
beginner
What does the
fit() method do in scikit-learn's LinearRegression?The
fit() method trains the model by finding the best line that fits the input data and output values.Click to reveal answer
intermediate
How do you evaluate the performance of a linear regression model in scikit-learn?
You can use the
score() method to get the R² score, which shows how well the model explains the data (1 is perfect, 0 means no explanation).Click to reveal answer
beginner
What is the difference between
predict() and fit() methods?fit() trains the model using data, while predict() uses the trained model to estimate outputs for new input data.Click to reveal answer
Which method in scikit-learn LinearRegression is used to train the model?
What does the R² score represent in linear regression?
Which scikit-learn module contains the LinearRegression class?
What type of problem is linear regression used for?
After training a linear regression model, which method predicts new outputs?
Explain the steps to train and evaluate a linear regression model using scikit-learn.
Describe what the R² score tells you about a linear regression model's performance.