且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

如何在 Apache Spark 中保存和加载 MLLib 模型?

更新时间:2023-12-01 22:40:40

您可以使用 保存方法 mllib 模型.

You can save your model by using the save method of mllib models.

# let lrm be a LogisticRegression Model
lrm.save(sc, "lrm_model.model")

存储后,您可以将其加载到另一个应用程序中.

After storing it you can load it in another application.

sameModel = LogisticRegressionModel.load(sc, "lrm_model.model")

正如@zero323 之前所述,还有另一种方法可以实现这一点,即使用 预测模型标记语言 (PMML).

As @zero323 stated before, there is another way to achieve this, and is by using the Predictive Model Markup Language (PMML).

是由 Data Mining Group 开发的一种基于 XML 的文件格式,为应用程序提供一种方法来描述和交换由数据挖掘和机器学习算法生成的模型.

is an XML-based file format developed by the Data Mining Group to provide a way for applications to describe and exchange models produced by data mining and machine learning algorithms.