Challenge: Predicting Prices Using Two Features
For this challenge, the same housing dataset will be used. However, now it has two features: age and area of the house (columns 'age' and 'square_feet').
1234import pandas as pd df = pd.read_csv('https://codefinity-content-media.s3.eu-west-1.amazonaws.com/b22d1166-efda-45e8-979e-6c3ecfc566fc/houseprices.csv') print(df.head())
Swipe to start coding
- Assign the
'age'and'square_feet'columns ofdftoX. - Initialize the
LinearRegressionmodel. - Fit the model using
Xandy. - Predict the target for
X_newand store it iny_pred. - Print the model's intercept and coefficients.
Solution
If you did everything right, you got the p-values close to zero. That means all our features are significant for the model.
Thanks for your feedback!
single
Ask AI
Ask AI
Ask anything or try one of the suggested questions to begin our chat
Awesome!
Completion rate improved to 3.33
Challenge: Predicting Prices Using Two Features
Swipe to show menu
For this challenge, the same housing dataset will be used. However, now it has two features: age and area of the house (columns 'age' and 'square_feet').
1234import pandas as pd df = pd.read_csv('https://codefinity-content-media.s3.eu-west-1.amazonaws.com/b22d1166-efda-45e8-979e-6c3ecfc566fc/houseprices.csv') print(df.head())
Swipe to start coding
- Assign the
'age'and'square_feet'columns ofdftoX. - Initialize the
LinearRegressionmodel. - Fit the model using
Xandy. - Predict the target for
X_newand store it iny_pred. - Print the model's intercept and coefficients.
Solution
If you did everything right, you got the p-values close to zero. That means all our features are significant for the model.
Thanks for your feedback!
single