How to do it...

  1. Start a new project in IntelliJ or in an IDE of your choice. Make sure the necessary JAR files are included.
  1. JFreeChart JAR can be downloaded from the https://sourceforge.net/projects/jfreechart/files/ site.
  1. Please make sure that the JFreeChart library and its dependencies (JCommon) are on the classpath for the chapter.
  1. We define the package information for the Scala program:
package spark.ml.cookbook.chapter7
  1. Import the necessary packages:
import java.text.DecimalFormat import org.apache.log4j.{Level, Logger} import org.apache.spark.sql.SparkSession import org.jfree.chart.{ChartFactory, ChartFrame, JFreeChart} import org.jfree.chart.axis.NumberAxis import org.jfree.chart.plot.PlotOrientation import org.jfree.data.xy.{XYSeries, ...

Get Apache Spark 2.x Machine Learning Cookbook 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.