O'Reilly logo

Scala Machine Learning Projects by Md. Rezaul Karim

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

Implementing a client subscription assessment model

To predict a client subscription assessment, we use the deep learning classifier implementation from H2O. First, we set up and create a Spark session:

val spark = SparkSession.builder        .master("local[*]")        .config("spark.sql.warehouse.dir", "E:/Exp/") // change accordingly        .appName(s"OneVsRestExample")        .getOrCreate()

Then we load the dataset as a data frame:

spark.sqlContext.setConf("spark.sql.caseSensitive", "false");val trainDF = spark.read.option("inferSchema","true")            .format("com.databricks.spark.csv")            .option("delimiter", ";")            .option("header", "true")            .load("data/bank-additional-full.csv")

Although there are categorical features in this dataset, there is no need to use a StringIndexer ...

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