0
如何獲得性能矩陣在sparkR分類,例如,F1分數,準確率,召回,混淆矩陣SparkR 2.0分類:如何獲得性能矩陣?
# Load training data
df <- read.df("data/mllib/sample_libsvm_data.txt", source = "libsvm")
training <- df
testing <- df
# Fit a random forest classification model with spark.randomForest
model <- spark.randomForest(training, label ~ features, "classification", numTrees = 10)
# Model summary
summary(model)
# Prediction
predictions <- predict(model, testing)
head(predictions)
# Performance evaluation
我試過caret::confusionMatrix(testing$label,testing$prediction)
它顯示錯誤:
Error in unique.default(x, nmax = nmax) : unique() applies only to vectors