Reputation: 165
from sklearn import linear_model
For the code above, I understand that "sklearn" is a package so what exactly is "liner_model"?
Upvotes: 0
Views: 24
Reputation: 81594
It can really be anything, a module-level variable (ie string, integer), a class, a function or a sub-module . Some examples:
from pandas import match
from pandas import json
from pandas import DataFrame
from pandas import __version__
print(match)
print(json)
print(DataFrame)
outputs
<function match at 0x0000016BE3082950> # function
<module 'pandas.json' from '\lib\site-packages\pandas\json.py'> # module
<class 'pandas.core.frame.DataFrame'> # class
0.23.4 # string
In that particualr case, sklearn.linear_model
is a module, according to its docs:
The sklearn.linear_model module ...
Upvotes: 2