2016-02-12 95 views
4

語境管道:保存與DecisionTreeModel星火ML

我有一個Spark ML管道包含VectorAssembler,StringIndexer和DecisionTreeClassifier。使用這條管道,我能夠成功地適應模型並轉換我的數據框架。我想存儲該模型以備將來使用,但我不斷收到以下錯誤:

Pipeline write will fail on this Pipeline because it contains a stage which does not implement Writable. 
Non-Writable stage: dtc_9c04161ed2d1 of type class org.apache.spark.ml.classification.DecisionTreeClassificationModel 

我已經試過

val pipeline = new Pipeline().setStages(Array(assembler, labelIndexer, dt)) 
val model = pipeline.fit(dfIndexed) 
model.write.overwrite().save("test/model/pipeline") 

這正常工作,當我刪除分類(即DT)。有沒有保存DecisionTreeClassifier模型的方法?

我的數據由一些索引的分類值組成,我必須映射回其原始形式(我知道這將需要使用IndexToString)。我正在使用Spark 1.6。

+1

這是值得JIRA與功能的要求(如果它不存在)。你總是可以使用'mllib'模型,這個模型是可寫的,並且傳回數據,但是我懷疑它會是令人滿意的解決方案。 – zero323

+0

這很奇怪,因爲幾乎所有的模型都有'save'方法 –

回答

1

這不能從Spark 1.6開始。該問題正在追蹤here