Aidin Biibosunov

Welcome to my blog

Note on linear regression

Posted at — Jul 4, 2023
Last updated at — Apr 24, 2024

Question: We train a linear regression model on a data set where all the labels are positive. Can this trained model predict a negative value (at least one) on some other data set?

Answer: Yes, it can. Since the model is a linear function \[y=a+bx\] it will predict negative \(y\) values for some \(x\) unless \(a>0\) and \(b=0\).

Notebook: And here is a simple demonstration:

Click here to view this notebook in full screen

comments powered by Disqus