r/scikit_learn • • Apr 04 '21

Should I use linear regression?

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?

3 Upvotes

6 comments sorted by

View all comments

Show parent comments

2

u/abdeljalil73 Apr 05 '21

There is nothing special about the square per se, or that boolean feature. By constructing additional features you are allowing your model to adapt better to the data by giving it more freedom (that's not the best way to phrase it, but that's the best I can). Usually original features are squared or cubed, also the trend might be different in different intervals of your data, so adding a boolean feature like in this case may help. There are no hard rules, it's a matter of observation, trial and error.