Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Why do we import scikit-learn with sklearn?

Why is that we install the scikit-learn package with:

conda install scikit-learn 

but then import (modules from) the package in a script using the name sklearn, e.g.:

from sklearn import x
like image 241
zthomas.nc Avatar asked Jul 12 '16 21:07

zthomas.nc


1 Answers

scikit-learn isn't a valid identifier in python, so it can't be that. I suppose that they could have named the package scikit_learn, but that's a lot to type so I suppose they just decided to shorten the package name for convenience.

Of course, if you're so inclined, you can:

import sklearn as scikit_learn

:-)

like image 188
mgilson Avatar answered Oct 14 '22 20:10

mgilson