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

MaxBins

Next we look at how changing the maximum number of bins affects the RMSLE values.

Scala

Let us look at the sample implementation in Scala. We will calculate the RMSLE value for maximum number of bins: 10, 16, 32, and 64.

object GradientBoostedTreesMaxBins{   def main(args: Array[String]) {     val data = GradientBoostedTreesUtil.getTrainTestData()     val train_data = data._1     val test_data = data._2     val maxBins_param = Array(10,16,32,64)     val iteration = 10     val maxDepth = 3     val i = 0     val resultsMap =      new scala.collection.mutable.HashMap[String, String]     val dataset = new DefaultCategoryDataset()     for(i <- 0 until maxBins_param.length) {       val maxBin = maxBins_param(i)       val rmsle = GradientBoostedTreesUtil.evaluate(train_data,  test_data,iteration,maxDepth, ...

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