Ao tentar compilar o seguinte código:
from dados import carregar_acessos
X,Y = carregar_acessos()
from sklearn.naive_bayes import MultinomialNB
modelo = MultinomialNB()
modelo.fit(X, Y)
teste = [1,0,1]
vetor = [teste]
print(modelo.predict(vetor))
Me deparei com o seguinte erro:
/usr/local/lib/python2.7/dist-packages/sklearn/naive_bayes.py:689: DeprecationWarning: unorderable dtypes; returning scalar but in the future this will be an error
if np.any((X.data if issparse(X) else X) < 0):
Traceback (most recent call last):
File "processa.py", line 6, in <module>
modelo.fit(X, Y)
File "/usr/local/lib/python2.7/dist-packages/sklearn/naive_bayes.py", line 587, in fit
self._count(X, Y)
File "/usr/local/lib/python2.7/dist-packages/sklearn/naive_bayes.py", line 691, in _count
self.feature_count_ += safe_sparse_dot(Y.T, X)
File "/usr/local/lib/python2.7/dist-packages/sklearn/utils/extmath.py", line 189, in safe_sparse_dot
return fast_dot(a, b)
TypeError: Cannot cast array data from dtype('float64') to dtype('S32') according to the rule 'safe'
Depois de tentar encontrar o erro, fui no github onde há o arquivo usado pelo professor, baixei compilei e obtive o mesmo erro. Como posso resolver isso?