Training the Model
Import
import org.apache.spark.mllib.regression.LinearRegressionWithSGD
Code
val regression=new LinearRegressionWithSGD().setIntercept(true)
regression.optimizer.setNumIterations(1000).setStepSize(0.1)
//Let's create a model out of our training examples.
val model=regression.run(scaledTrainingSet)