O'Reilly logo

Machine Learning with Spark - Second Edition by Nick Pentreath, Manpreet Singh Ghotra, Rajdeep Dua

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Step size

We will perform a similar analysis for step size in the following code:

Scala

val steps_param = Array(0.01, 0.025, 0.05, 0.1, 1.0) val intercept =false val i = 0 val results = new Array[String](5) val resultsMap = new scala.collection.mutable.HashMap[String, String] val dataset = new DefaultCategoryDataset() for(i <- 0 until steps_param.length) {   val step = steps_param(i)   val rmsle = LinearRegressionUtil.evaluate(train_data,          test_data,iterations,step,intercept)   resultsMap.put(step.toString,rmsle.toString)   dataset.addValue(rmsle, "RMSLE", step) } 

Output for the previous code is as follows:

    [1.7904244862988534, 1.4241062778987466, 1.3840130355866163,    1.4560061007109475, nan]

The plot for the preceding output is shown as ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required