Meine Frage basiert auf this.funken 1.6.1 python 3.5.1 building naive bayes klassifizierer
- Wäre es möglich detailliertere Kommentare/erklären sein Startcode Linie
tf = HashingTF().transform(training_raw.map(lambda doc: doc["text"], preservesPartitioning=True))
- Wie kann ich die Verwirrung Matrix drucken kann?
Was bedeutet Fehler unten? Wie kann ich es reparieren? Das Modell wird noch gebaut, und ich bekomme die Prognosen
>>> # Train and check ... model = NaiveBayes.train(training) [Stage 2:=============================> (2 + 2)/4]16/04/05 18:18:28 WARN BLAS: Failed to load implementation from: com.github.fommil.netlib.NativeSystemBLAS 16/04/05 18:18:28 WARN BLAS: Failed to load implementation from: com.github.fommil.netlib.NativeRefBLAS
Wie ich Ergebnisse für die neue Beobachtung drucken konnte. Ich habe versucht, und gescheitert
>>> model.predict("love") Traceback (most recent call last): File "<stdin>", line 1, in <module> File "c:\spark-1.6.1-bin-hadoop2.6\spark-1.6.1-bin-hadoop2.6\python\pyspark\mllib\classification.py", line 594, in predict x = _convert_to_vector(x) File "c:\spark-1.6.1-bin-hadoop2.6\spark-1.6.1-bin-hadoop2.6\python\pyspark\mllib\linalg\__init__.py", line 77, in _convert_to_vector raise TypeError("Cannot convert type %s into Vector" % type(l)) TypeError: Cannot convert type <class 'str'> into Vector
Könnten Sie ein Beispiel aus 'training_raw' hinzufügen? –
die Daten sind bei http://stackoverflow.com/questions/32231049/how-to-use-spark-naive-bayes-classifier-for-text-classification-with-idf – user2543622