O'Reilly logo

Java Deep 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

Feature engineering and input dataset preparation

In this sub-section, we will see some basic feature engineering and dataset preparation that can be fed into the MLP classifier. So let's start by creating SparkSession, which is the gateway to access Spark:

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

Then let's read the training set and see a glimpse of it:

Dataset<Row> df = spark.sqlContext()                .read()                .format("com.databricks.spark.csv")                .option("header", "true")                .option("inferSchema", "true")                .load("data/train.csv");df.show();

A snapshot of the dataset can be seen as follows:

A snapshot of the Titanic survival dataset

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