import sklearn.naive_bayes as sk
и использование clf = sk.GaussianNB()
работает;тогда как import sklearn as sk
и использование clf = sk.naive_bayes.GaussianNB()
не работает.
рабочий
'''
import sklearn.naive_bayes as sk
clf = sk.GaussianNB()
clf = clf.fit(x,y)
print(clf.predict([[-2,1]]))
'''
not_working
'''
import sklearn as sk
clf = sk.naive_bayes.GaussianNB()
clf = clf.fit(x,y)
print(clf.predict([[-2,1]]))
'''
ошибка
'''
Traceback (most recent call last):
File "naive.py", line 9, in <module>
clf = sk.naive_bayes.GaussianNB()
AttributeError: module 'sklearn' has no attribute 'naive_bayes'
'''