How to Access Spark PipelineModel Parameters
<p>I am running a linear regression using <a href="https://spark.apache.org/docs/latest/ml-pipeline.html#ml-pipelines" rel="noreferrer">Spark Pipelines</a> in pyspark.  Once the linear regression model is trained, how do I get the coefficients out?</p>

<p>Here is my pipeline code:</p>

<pre><code># Get all of our features together into one array called "features".  Do not include the label!
feature_assembler = VectorAssembler(inputCols=get_column_names(df_train), outputCol="features")

# Define our model
lr = LinearRegression(maxIter=100, elasticNetParam=0.80, labelCol="label", featuresCol="features", 
                  predictionCol = "prediction")

# Define our pipeline
pipeline_baseline = Pipeline(stages=[feature_assembler, lr])

# Train our model using the training data
model_baseline = pipeline_baseline.fit(df_train)

# Use our trained model to make predictions using the validation data
output_baseline = model_baseline.transform(df_val)  #.select("features", "label", "prediction", "coefficients")
predictions_baseline = output_baseline.select("label", "prediction")
</code></pre>

<p>I have tried using methods from the <a href="https://spark.apache.org/docs/latest/api/python/pyspark.ml.html?highlight=pipeline#pyspark.ml.PipelineModel" rel="noreferrer">PipelineModel class</a>.  Here are my attempts to get the coefficients, but I only get an empty list and an empty dictionary:</p>

<pre><code>params = model_baseline.stages[1].params
print 'Try 1 - Parameters: %s' %(params)
params = model_baseline.stages[1].extractParamMap()
print 'Try 2 - Parameters: %s' %(params)

Out[]:
Try 1 - Parameters: []
Try 2 - Parameters: {}
</code></pre>

<p>Are there methods for PipelineModel that return the trained coefficients?</p>