Question: This is an assignment to implement a KNN model to classify the animals. I've encountered an error when trying to do the data training. see
This is an assignment to implement a KNN model to classify the animals.
I've encountered an error when trying to do the data training. see below and please help me. Many Thanks
Error in knn.cv(d, d_target, k, prob = TRUE) :
NA/NaN/Inf in foreign function call (arg 6)
In addition: Warning messages:
1: In knn.cv(d, d_target, k, prob = TRUE) : NAs introduced by coercion
2: In knn.cv(d, d_target, k, prob = TRUE) : NAs introduced by coercion
see below coding in R.
#Load Data
set.seed(1)
library(class)
d = read.csv(file.choose(), sep=",", header = FALSE)
d = data.frame(d)
#Data Conditioning
names(d)
"aquatic", "predator", "toothed", "backbone", "breathes", "venomous",
"fins", "legs", "tail", "domestic", "size", "type")
types
d_target
d_key
d$animal
#Exploratory Investigation
names(types)
types
summary(d)
str(d)
#Training
k = sqrt(17) + 1
m1

\f
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
