我無法保存使用ml包python/spark生成的隨機森林模型。Pyspark ML - 如何保存管道和RandomForestClassificationModel
>>> rf = RandomForestClassifier(labelCol="label", featuresCol="features")
>>> pipeline = Pipeline(stages=early_stages + [rf])
>>> model = pipeline.fit(trainingData)
>>> model.save("fittedpipeline")
Traceback (most recent call last): File "", line 1, in AttributeError: 'PipelineModel' object has no attribute 'save'
>>> rfModel = model.stages[8]
>>> print(rfModel)
RandomForestClassificationModel(UID = rfc_46c07f6d7ac8)用20種樹木
>> rfModel.save("rfmodel")
Traceback (most recent call last): File "", line 1, in AttributeError: 'RandomForestClassificationModel' object has no attribute 'save'**
另外,通過通 'SC' 嘗試作爲第一個參數,以節省方法。
您正在使用什麼版本的火花? – eliasah
我正在使用spark 1.6.0。不幸的是,由於某些原因,我無法升級到更高版本。我們是否有一些解決方法可以在1.6.0中保存模型? –
pyspark <2.0.0沒有任何開箱即用的功能。 – eliasah