May 2017
Intermediate to advanced
294 pages
7h 33m
English
Let's apply the decision tree to the diabetes dataset we worked on in the previous recipe:
$ spark-shell scala> import org.apache.spark.ml.classification.DecisionTreeClassifier scala> import org.apache.spark.ml.evaluation.BinaryClassificationEvaluator
scala> val data = spark.read.format("libsvm").option("inferschema","true") .load("s3a://sparkcookbook/medicaldata/diabetes.libsvm")
scala> val Array(trainingData, testData) = data.randomSplit(Array(0.7, 0.3))
scala> val dt = new DecisionTreeClassifier() ...
Read now
Unlock full access