I'm trying to import LinearModel from SKLearn:
from sklearn.base import RegressorMixin, LinearModel
I can see with my own eyes, that the class is in base.py here, but the import doesn't work. Why? How can I fix this?
ImportError: cannot import name 'LinearModel'
What exactly are you trying to do? As far as I can see it, LinearModel is only a base class.
Is this maybe what you are looking for? http://scikit-learn.org/stable/modules/linear_model.html#ordinary-least-squares
Edit:
Oh and by the way, if you really need the base class, I believe it is located in sklearn.linear_model.base. Import it using:
from sklearn.linear_model.base import LinearModel
As of sklearn v24 the previous solution from sklearn.linear_model.base import LinearModel doesn't work anymore.
New workaround is to import whatever class you need/want to inherit directly. For me, that was from sklearn.linear_model import LinearRegression
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With