我的問題是根據。火花1.6.1蟒蛇3.5.1建設樸素貝葉斯分類器
- 是否可以更詳細的評論/解釋代碼開始 線
tf = HashingTF().transform(training_raw.map(lambda doc: doc["text"], preservesPartitioning=True))
- 我怎麼能打印混淆矩陣?
下面的錯誤是什麼意思?我該如何解決它?該模型仍然得到建立,我得到的預測
>>> # 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
我怎麼能打印新的觀察結果。我嘗試和失敗
>>> 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
你可以從'training_raw'添加一個示例嗎? –
的數據是在2,我明白什麼是BLAS代表的數據是http://stackoverflow.com/questions/32231049/how-to-use-spark-naive-bayes-classifier-for-text-classification-with-idf – user2543622