df = sqlContext.read.format('libsvm').load('data/mllib/sample_libsvm_data.txt')
indexer = StringIndexer(inputCol='label', outputCol='indexed').fit(df)
df_indexed = indexer.transform(df)
model = RandomForestClassifier(numTrees=3, maxDepth=2, labelCol='indexed',
    seed=42).fit(df_indexed)
How to access individual predictions in Spark RandomForest?