Deu certo de instalar estas bibliotecas, porém continua dando erro.
Agora o código que está sendo exibido e esse:
Traceback (most recent call last):
File "classificacao.py", line 17, in
print(modelo.predict(misterioso))
File "/home/mr-luiza/anaconda3/lib/python3.6/site-packages/sklearn/naive_bayes.py", line 66, in predict
jll = self._joint_log_likelihood(X)
File "/home/mr-luiza/anaconda3/lib/python3.6/site-packages/sklearn/naive_bayes.py", line 724, in _joint_log_likelihood
X = check_array(X, accept_sparse='csr')
File "/home/mr-luiza/anaconda3/lib/python3.6/site-packages/sklearn/utils/validation.py", line 441, in check_array
"if it contains a single sample.".format(array))
ValueError: Expected 2D array, got 1D array instead:
array=[1 1 1].
Reshape your data either using array.reshape(-1, 1) if your data has a single feature or array.reshape(1, -1) if it contains a single sample.
Segue abaixo o meu código:
porco1 = [1, 1, 0]
porco2 = [1, 1, 0]
porco3 = [1, 1, 0]
cachorro1 = [1, 1, 1]
cachorro2 = [0, 1, 1]
cachorro3 = [0, 1, 1]
dados = [porco1,porco2,porco3,cachorro1,cachorro2,cachorro3]
marcacoes = [1,1,1,-1,-1,-1]
from sklearn.naive_bayes import MultinomialNB
modelo = MultinomialNB()
modelo.fit(dados, marcacoes)
misterioso = [1,1,1]
print(modelo.predict(misterioso))