Skip to content

Instantly share code, notes, and snippets.

@monogenea

monogenea/12-audioClass.R

Last active Apr 6, 2020
Embed
What would you like to do?
# Test set prediction
predXProb <- predict(model, test$X)
predXClass <- speciesClass[apply(predXProb, 1, which.max)]
trueXClass <- speciesClass[apply(test$Y, 1, which.max)]
# Plot confusion matrix
confMatTest <- confusionMatrix(data = factor(predXClass, levels = speciesClass),
reference = factor(trueXClass, levels = speciesClass))
pheatmap(confMatTest$table, cluster_rows = F, cluster_cols = F,
border_color = NA, show_colnames = F,
labels_row = speciesClass,
color = cols(max(confMatTest$table)+1))
# Accuracy in test set
mean(predXClass == trueXClass) # 0.7364
# Write sessioninfo
writeLines(capture.output(sessionInfo()), "sessionInfo")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment