ham*_*miq 8 python logistic-regression apache-spark pyspark
我正在使用 spark 版本在 pyspark 中运行逻辑回归:2.1.2
我知道可以按如下方式保存回归模型:
# Initialise the logistic regression
model = LogisticRegression(featuresCol='features', labelCol='is_clickout',regParam=0, fitIntercept=False, family="binomial")
model = pipeline.fit(data)
# save model for future use
save_path = "model_0"
model.save(save_path)
Run Code Online (Sandbox Code Playgroud)
问题是保存的模型没有保存摘要:
from pyspark.ml.classification import LogisticRegressionModel
model2 = LogisticRegressionModel.load(save_path)
model2.hasSummary ##### Returns FALSE
Run Code Online (Sandbox Code Playgroud)
我可以按如下方式提取摘要,但它没有附加保存方法: # Get the model summary summary = model.stages[-1].summary
有没有一种快速的方法来保存摘要对象?对于多元回归?
目前我读取了对象的所有属性并将其保存为pandas df。
| 归档时间: |
|
| 查看次数: |
629 次 |
| 最近记录: |