I did this code and I get always this error on the line
val randomForestModel = randomForestClassifier.fit(trainingData)
the code:
val seed = 5043
val Array(trainingData, testData) = labelDf.randomSplit(Array(0.7, 0.3), seed)
trainingData.cache()
testData.cache()
// train Random Forest model with training data set
val randomForestClassifier = new RandomForestClassifier()
.setImpurity("gini")
.setMaxDepth(3)
.setNumTrees(20)
.setFeatureSubsetStrategy("auto")
.setSeed(seed)
val randomForestModel = randomForestClassifier.fit(trainingData)
println(randomForestModel.toDebugString)
The error :
ERROR Instrumentation: org.apache.spark.SparkException: Task not serializable