title: How to fix "java.lang.Integer cannot be cast to java.lang.Double" Error in Spark (Scala)?
body: <p>I have a 2 column (1 int and 1 double) dataframe "fit_comparison", of predicted values and linear regression results.</p>
  
  <p>I have used the following code to get regression metrics:</p>
  
  <pre><code>val rm = new RegressionMetrics(
    fit_comparison.rdd.map(x =&gt;
    (x(0).asInstanceOf[Double], x(1).asInstanceOf[Double])))
  </code></pre>
  
  <p>When I try to get specific regression metrics as below, I get the "java.lang.Integer cannot be case to java.lang.Double" error.</p>
  
  <pre><code>println("MSE: " + rm.meanSquaredError)
  </code></pre>
  
  <p>Do I first have to convert the first column of "fit_comparison" to a double?</p>
  
  <p>Any help is appreciated, thank you,</p>