我无法保存使用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