I am running a logistic regression in PySpark using spark version: 2.1.2
I know it is possible to save a regression model as follows:
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)
The problem is that the saved model does not save the summary:
from pyspark.ml.classification import LogisticRegressionModel
model2 = LogisticRegressionModel.load(save_path)
model2.hasSummary ##### Returns FALSE
I can extract the summary as follows, but it has no save method attached to it:
# Get the model summary
summary = model.stages[-1].summary
Is there a quick way to save the summary object? For multiple regressions?
Currently, I read all the object attributes and save them as a Pandas dataframe df
.