Step 2 - Creating a Spark session and importing implicits

We then need to create a Spark session as the gateway of our program:

val spark = SparkSession        .builder        .master("local[*]")        .config("spark.sql.warehouse.dir", "tmp/")        .appName("Fraud Detection")        .getOrCreate()

Additionally, we need to import implicits for spark.sql and h2o:

implicit val sqlContext = spark.sqlContextimport sqlContext.implicits._val h2oContext = H2OContext.getOrCreate(spark)import h2oContext._import h2oContext.implicits._

Get Scala Machine Learning Projects now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.