K
K
kolomiec_artiom2019-02-19 11:46:53
Python
kolomiec_artiom, 2019-02-19 11:46:53

How to fix builtins.TypeError: '>' not supported between instances of 'numpy.ndarray' and 'float'?

I want to write a neural network that recognizes what language the words are written in. I'm trying to implement using
sklearn.naive_bayes import GaussianNB but an error occurs. How can this be fixed?

#coding=utf8
import numpy as np
from sklearn.naive_bayes import GaussianNB

x_training = np.array()
y_training = np.array(['ru', 'en', 'en', 'ru'])

clf = GaussianNB()
clf.fit(x_training, y_training)

print(clf.predict(np.array(['при'])))

Answer the question

In order to leave comments, you need to log in

2 answer(s)
D
dmshar, 2019-02-19
@dmshar

So
from sklearn.naive_bayes import GaussianNB
or
clf = BernoulliNB()

A
Arseny Kravchenko, 2019-02-19
@Arseny_Info

First you need to vectorize the input https://scikit-learn.org/stable/modules/feature_ex...

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question