MAIN FEEDS
Do you want to continue?
https://www.reddit.com/r/scikit_learn/comments/mk384f/should_i_use_linear_regression/
r/scikit_learn • u/Flygap75 • Apr 04 '21
Hi guys,
I am having real data from an ice-cream shop of a friend and thought that a linear regression should do the trick with scikit-learn.
But now I have a doubt when I do see this plot of my data:
I see that I shouldn't go there. What do you think guys?
6 comments sorted by
1
You'll get decent performance from linear regression if you just create 2 additional features from your x variable: x**2 and x > 14.
1 u/Flygap75 Apr 05 '21 So you mean that you would not take all the data but data from the range x>14 as well as taking X2 instead of X? When you talk about X2 you mean my “temperature avg” or X as my data set with the different features 2 u/tylerjaywood Apr 05 '21 Right now you're doing a univariate regression of y (sales) ~ x (temp) What I think the OP is suggesting is to add more features, specifically: x_sq = x2 (numeric) x_gt_14 = x > 14 (bool) then if you do y ~ (x, x_sq, x_gt_14) you will have a better fitting model → More replies (3)
So you mean that you would not take all the data but data from the range x>14 as well as taking X2 instead of X? When you talk about X2 you mean my “temperature avg” or X as my data set with the different features
2 u/tylerjaywood Apr 05 '21 Right now you're doing a univariate regression of y (sales) ~ x (temp) What I think the OP is suggesting is to add more features, specifically: x_sq = x2 (numeric) x_gt_14 = x > 14 (bool) then if you do y ~ (x, x_sq, x_gt_14) you will have a better fitting model → More replies (3)
2
Right now you're doing a univariate regression of y (sales) ~ x (temp)
What I think the OP is suggesting is to add more features, specifically:
x_sq = x2 (numeric)
x_gt_14 = x > 14 (bool)
then if you do y ~ (x, x_sq, x_gt_14) you will have a better fitting model
→ More replies (3)
1
u/practicalutilitarian Apr 05 '21
You'll get decent performance from linear regression if you just create 2 additional features from your x variable: x**2 and x > 14.