且构网

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

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

更新时间:2023-12-01 22:50:34

您可以使用

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).

是数据挖掘小组开发的基于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.