Question
Follow the steps to produce predictions (50 points) Introduction: The iris data set gives the measurements in centimeters of the variables sepal length and width
- Follow the steps to produce predictions (50 points)
Introduction:
The iris data set gives the
measurements in centimeters of the variables sepal length and
width and petal length and width, respectively, for 50 flowers
from each of 3 species of iris.The species are _Iris setosa_,
_versicolor_, and _virginica_.
In R:
>library(class)
>tidx <- sample(nrow(iris),round(.6*nrow(iris)))
>train <- iris[tidx,-5]
>test <- iris[-tidx,-5]
>cl <- iris[tidx,5]
>orig <- iris[-tidx,5]
>pred <- knn(train,test,cl,k=3,prob=TRUE)
# Use the table below to build your confusion matrix
table(orig,pred)
2.Answer the following questions (50 points)
2.1 What method was used to provide the predictions?
2.2What is the role of the variable cl?
2.3Use the table generated above to produce your measures of performance and provide them below.
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started