title: How to access parameters of the underlying model in ML Pipeline?
body: <p>I have a DataFrame that is processed with LinearRegression. If I do it directly, like below, I can display the details of the model:</p>
  
  <pre><code>val lr = new LinearRegression()
  val lrModel = lr.fit(df)
  
  lrModel: org.apache.spark.ml.regression.LinearRegressionModel = linReg_b22a7bb88404
  
  println(s"Coefficients: ${lrModel.coefficients} Intercept: ${lrModel.intercept}")
  Coefficients: [0.9705748115939526] Intercept: 0.31041486689532866
  </code></pre>
  
  <p>However, if I use it inside a pipeline (like in the simplified example below), </p>
  
  <pre><code>val pipeline = new Pipeline().setStages(Array(lr))
  val lrModel = pipeline.fit(df)
  </code></pre>
  
  <p>then I get the following error.</p>
  
  <pre><code>scala&gt; lrModel
  res9: org.apache.spark.ml.PipelineModel = pipeline_99ca9cba48f8
  
  scala&gt; println(s"Coefficients: ${lrModel.coefficients} Intercept: ${lrModel.intercept}")
  &lt;console&gt;:68: error: value coefficients is not a member of org.apache.spark.ml.PipelineModel
         println(s"Coefficients: ${lrModel.coefficients} Intercept: ${lrModel.intercept}")
                                           ^
  &lt;console&gt;:68: error: value intercept is not a member of org.apache.spark.ml.PipelineModel
         println(s"Coefficients: ${lrModel.coefficients} Intercept: ${lrModel.intercept}")
  </code></pre>
  
  <p>I understand what it means (it's obvious I got a different class, because of the pipeline), but don't know how to get to the real underlying model. </p>