Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to compute confusion matrix on Iris dataset?

Tags:

r

lda

Data set: Iris How to compute the confusion matrix on the data set for an LDA (Linear Discriminant Analysis) model?

>iris.lda = lda(Species ~ . , data = iris)

>table(predict(iris.lda, type="class"), iris$Species)
Error in sort.list(y) : 'x' must be atomic for 'sort.list'
Have you called 'sort' on a list?
like image 563
Andy Dufresn Avatar asked Nov 14 '12 09:11

Andy Dufresn


People also ask

How to calculate a confusion matrix?

How to Calculate a Confusion Matrix 1 First, you need to test dataset with its expected outcome values. 2 Predict all the rows in the test dataset. 3 Calculate the expected predictions and outcomes:

What is the iris dataset?

Iris Dataset is considered as the Hello World for data science. It contains five columns namely – Petal Length, Petal Width, Sepal Length, Sepal Width, and Species Type. Iris is a flowering plant, the researchers have measured various features of the different iris flowers and recorded them digitally.

What is an iris?

Iris is a flowering plant, the researchers have measured various features of the different iris flowers and recorded them digitally. Note: This dataset can be downloaded from here. You can download the Iris.csv file from the above link.

What is the Spatial Analyst confusion analysis tool?

Available with Spatial Analyst license. Computes a confusion matrix with errors of omission and commission and derives a kappa index of agreement and an overall accuracy between the classified map and the reference data. This tool uses the outputs from the Create Accuracy Assessment Points tool or the Update Accuracy Assessment Points tool.


1 Answers

Try this one

library(MASS)
iris.lda <- lda(Species ~ . , data = iris)
table(predict(iris.lda, type="class")$class, iris$Species)


          setosa versicolor virginica
  setosa         50          0         0
  versicolor      0         48         1
  virginica       0          2        49
like image 156
MYaseen208 Avatar answered Sep 20 '22 16:09

MYaseen208