2017-12-18 143 views
1

我在Spark 2.2和Python 2.7.11中使用pyspark,我嘗試使用.toDebugString方法從隨機森林分類器的決策樹中提取規則。rfModel.toDebugString錯誤

我成功吧,但是因爲從2.1到2.2的更新,星火崩潰我使用這個命令後,我得到這個錯誤:

完整的錯誤:

rfModel.toDebugString 

----------------------------------------u'RandomForestClassificationModel (uid=RandomForestClassifier_4e99b85432585e2e32a2) with 30 trees\n Tr' Exception happened during processing of request from ('127.0.0.1', 42374) Traceback (most recent call last): File "/usr/local/lib/python2.7/SocketServer.py", line 295, in _handle_request_noblock self.process_request(request, client_address) File "/usr/local/lib/python2.7/SocketServer.py", line 321, in process_request self.finish_request(request, client_address) File "/usr/local/lib/python2.7/SocketServer.py", line 334, in finish_request self.RequestHandlerClass(request, client_address, self) File "/usr/local/lib/python2.7/SocketServer.py", line 655, in init self.handle() File "/opt/cloudera/parcels/SPARK2/lib/spark2/python/pyspark/accumulators.py", line 235, in handle num_updates = read_int(self.rfile) File "/opt/cloudera/parcels/SPARK2/lib/spark2/python/pyspark/serializers.py", line 577, in read_int ---------------------------------------- raise EOFError EOFError

如果我在我得到這個錯誤後再次運行命令:

Py4JError: An error occurred while calling o1129.toString

我的代碼相當簡單,我非常。

#Get random forest from pipeline 
rfModel = model.stages[1] 

rfModel.toDebugString 

我知道rfModel是一個randomForestClassifier對象。任何想法,爲什麼我得到這個錯誤?

+0

你需要發佈更多的錯誤信息 – eliasah

+0

找到了解決方案。 Python版本正在創建這個問題。將重新創建錯誤,併爲未來的用戶使用日誌進行更新。 – Toutsos

+0

_「/ opt/cloudera/parcels/SPARK2」_您是否使用CDH? CDH的版本是什麼? –

回答

0

我的問題的解決方案是python版本。通過使用python3 +與spark 2.2我設法工作.toDebugString方法沒有問題。對於任何未來看到此內容的人,我都會更新完整的錯誤日誌。