I have successfully installed sklearn
. However, when I run sklearn.metrics.accuracy_score
, it givies an error ImportError: No module named 'sklearn.metrics.accuracy_score'
sklearn
version is 0.17
numpy
version is 1.8.2
scipy
version is 0.13.3
Btw I'm using python3
. Thanks.
accuracy_score
is a function, not a module, you have to import it from a module, thus
from sklearn.metrics import accuracy_score #works
print(accuracy_score([1, 1, 0], [1, 0, 1]))
gives
0.333333333333
as expected.
and not
import sklearn.metrics.accuracy_score #error
from sklearn.metrics import accuracy_score
print(accuracy_score([1, 1, 0], [1, 0, 1]))
Note: it's metrics
not metric
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