In this recipe, we explore the model export facility available in Spark 2.0 to use Predictive Model Markup Language (PMML). This standard XML-based language you to export and run your on other systems (some limitations apply). You can explore the There's more... section for more information.
- Start a new project in IntelliJ or in an IDE of your choice. Make sure that the necessary JAR files are included.
- Set up the package location where the program will reside:
package spark.ml.cookbook.chapter4
- Import the necessary packages for SparkContext to get access to the cluster:
import org.apache.spark.mllib.linalg.Vectors import org.apache.spark.sql.SparkSession import org.apache.spark.mllib.clustering.KMeans
- Create Spark's configuration and SparkContext:
val spark = SparkSession .builder .master("local[*]") // if use cluster master("spark://master:7077") .appName("myPMMLExport") .config("spark.sql.warehouse.dir", ".") .getOrCreate()
- We read...