What is the right way to save\load models in Spark\PySpark

后端 未结 4 1029
天命终不由人
天命终不由人 2021-02-04 08:02

I\'m working with Spark 1.3.0 using PySpark and MLlib and I need to save and load my models. I use code like this (taken from the official documentation )

from p         


        
4条回答
  •  有刺的猬
    2021-02-04 08:31

    Use pipeline in ML to train the model, and then use MLWriter and MLReader to save models and read them back.

    from pyspark.ml import Pipeline
    from pyspark.ml import PipelineModel
    
    pipeTrain.write().overwrite().save(outpath)
    model_in = PipelineModel.load(outpath)
    

提交回复
热议问题