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

This is an assignment to implement a KNN model to classify the

\f

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Mathematics Questions!