O'Reilly logo

Mastering Apache Spark 2.x - Second Edition by Romeo Kienzler

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

Example code – income

This section examines the Scala-based H2O Sparkling Water Deep Learning example using the previous Canadian income data source. First, the Spark (Context, Conf, MLlib, and RDD) and H2O (h2o, deeplearning, and water) classes are imported:

import org.apache.spark.SparkContextimport org.apache.spark.SparkContext._import org.apache.spark.SparkConf import hex.deeplearning.{DeepLearningModel, DeepLearning}import hex.deeplearning.DeepLearningModel.DeepLearningParametersimport org.apache.spark.h2o._import org.apache.spark.mllibimport org.apache.spark.mllib.feature.{IDFModel, IDF, HashingTF}import org.apache.spark.rdd.RDDimport water.Key

Next, an application class called h2o_spark_dl2 is defined, the master URL is created, and ...

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