title: How to extract best parameters from a CrossValidatorModel
body: <p>I want to find the parameters of <code>ParamGridBuilder</code> that make the best model in CrossValidator in Spark 1.4.x,</p>
  
  <p>In <a href="http://spark.apache.org/docs/latest/ml-guide.html#example-model-selection-via-cross-validation" rel="noreferrer">Pipeline Example</a> in Spark documentation, they add different parameters (<code>numFeatures</code>, <code>regParam</code>) by using <code>ParamGridBuilder</code> in the Pipeline. Then by the following line of code they make the best model:</p>
  
  <pre><code>val cvModel = crossval.fit(training.toDF)
  </code></pre>
  
  <p>Now, I want to know what are the parameters (<code>numFeatures</code>, <code>regParam</code>) from <code>ParamGridBuilder</code> that produces the best model.</p>
  
  <p>I already used the following commands without success:</p>
  
  <pre><code>cvModel.bestModel.extractParamMap().toString()
  cvModel.params.toList.mkString("(", ",", ")")
  cvModel.estimatorParamMaps.toString()
  cvModel.explainParams()
  cvModel.getEstimatorParamMaps.mkString("(", ",", ")")
  cvModel.toString()
  </code></pre>
  
  <p>Any help?</p>
  
  <p>Thanks in advance,</p>