repl.it
@sidonduarte/

scikit-naive1

Python

No description

fork
loading
Files
  • main.py
main.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
# https://pt.stackoverflow.com/a/237613/7412
from sklearn.naive_bayes import MultinomialNB
import numpy as np

vaca1=    [1,1,0]    
vaca2=    [1,1,0]    
vaca3=    [1,1,0]    
cavalo4= [1,1,1]    
cavalo5= [0,1,1]    
cavalo6= [0,1,1]   

dados = np.array([vaca1,vaca2,vaca3,cavalo4,cavalo5,cavalo6])
marcacoes= np.array([1, 1, 1, -1, -1, -1])
misterioso = np.array([[1, 1, 1]])

modelo= MultinomialNB()
modelo.fit(dados, marcacoes)
MultinomialNB(alpha=1.0, class_prior=None, fit_prior=True)
print(modelo.predict(misterioso))
Fetching token
?