-2

I generated random data points from three bivariate Gaussian densities as follows.

set1 <- rmvnorm(n = 100, mean = c(0, 1.5), sigma = matrix(c(1,.2,.2,3.2),nrow=2))

I generated three set of random data points and I need to calculate the confusion matrix. I cannot find how to generate referance.

I checked the online sources but couldn't find any solution. Do you have any recomendation or code?

1 Answers1

1

A confusion matrix requires categorical data, e.g. the actual and predicted categories output from a classifier. It doesn't really make sense to build such a matrix given variables from a multivariate normal distribution, as these are continuous rather than categorical.

As a side note, if you have categorical data, you can build a confusion matrix using the confusionMatrix function from caret.

jruf003
  • 980
  • 5
  • 19
  • Thank you for your answers, but I still need predicted values as a referance in confusionMatrix and I don't know how to do. :( Do you have a recommentation –  Oct 19 '17 at 22:40
  • Can you elaborate on what you're trying to achieve? The reason you'd build a confusion matrix is because you've generated the predicted values already and want to know how well they compare to your actual values. If you want to generate categorical values at random you could do something like `factor(sample(c("Y", "N"), 100, replace = T))`, but as mentioned above this kind of defeats the purpose of having a confusion matrix (i.e., because you know these won't have any relation to your actual values). – jruf003 Oct 19 '17 at 22:46