In my Naive Bayes implementation with using Apache Spark, I get same values for accuracy and weighted recall values all the times.
I implemented Naive Bayes algorithm from Spark's tutorials and it works fine except the thing that I mentioned above.
Dataset<Row>[] splits = dataFrame.randomSplit(new double[]
{mainController.getTrainingDataRate(), mainController.getTestDataRate()});
Dataset<Row> train = splits[0];
Dataset<Row> test = splits[1];
NaiveBayes nb = new NaiveBayes();
NaiveBayesModel model = nb.fit(train);
Dataset<Row> predictions = model.transform(test);
MulticlassClassificationEvaluator evaluator = new MulticlassClassificationEvaluator()
.setLabelCol("label")
.setPredictionCol("prediction")
.setMetricName("weightedPrecision");
precisionSum += (evaluator.evaluate(predictions));
evaluator.setMetricName("weightedRecall");
recallSum += (evaluator.evaluate(predictions));
evaluator.setMetricName("accuracy");
accuracySum += (evaluator.evaluate(predictions));
I run the code above hundred times and in every of them accuracy results were equal to weighted recall values even I tried in different data files which consists of hundreds of thousands rows. Where am I doing wrong?