quando tento executar isso:
from dados import carregar_acessos
from sklearn.naive_bayes import MultinomialNB
x,y = carregar_acessos()
modelo = MultinomialNB()
modelo.fit(x,y)
print(modelo.predict([[1,0,1]]))
tenho esse erro:
/home/karl/.local/lib/python3.8/site-packages/sklearn/utils/validation.py:63: FutureWarning: Arrays of bytes/strings is being converted to decimal numbers if dtype='numeric'. This behavior is deprecated in 0.24 and will be removed in 1.1 (renaming of 0.26). Please convert your data to numeric values explicitly instead.
return f(*args, **kwargs)
Traceback (most recent call last):
File "/home/karl/.local/lib/python3.8/site-packages/sklearn/utils/validation.py", line 710, in check_array
array = array.astype(np.float64)
ValueError: could not convert string to float: 'acessou_home'
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "/home/karl/projetos/machine_learning/main.py", line 7, in <module>
modelo.fit(x,y)
File "/home/karl/.local/lib/python3.8/site-packages/sklearn/naive_bayes.py", line 612, in fit
X, y = self._check_X_y(X, y)
File "/home/karl/.local/lib/python3.8/site-packages/sklearn/naive_bayes.py", line 477, in _check_X_y
return self._validate_data(X, y, accept_sparse='csr')
File "/home/karl/.local/lib/python3.8/site-packages/sklearn/base.py", line 433, in _validate_data
X, y = check_X_y(X, y, **check_params)
File "/home/karl/.local/lib/python3.8/site-packages/sklearn/utils/validation.py", line 63, in inner_f
return f(*args, **kwargs)
File "/home/karl/.local/lib/python3.8/site-packages/sklearn/utils/validation.py", line 871, in check_X_y
X = check_array(X, accept_sparse=accept_sparse,
File "/home/karl/.local/lib/python3.8/site-packages/sklearn/utils/validation.py", line 63, in inner_f
return f(*args, **kwargs)
File "/home/karl/.local/lib/python3.8/site-packages/sklearn/utils/validation.py", line 712, in check_array
raise ValueError(
ValueError: Unable to convert array of bytes/strings into decimal numbers with dtype='numeric'