New classification in Machine Learning KNN model

Hi everybody!

This is my example of KNN model:


db_class <- iris

row_train <- sample(nrow(db_class),nrow(db_class)*0.8)
db_train_x <- db_class[row_train,-ncol(db_class)]
db_train_y <- db_class[row_train,ncol(db_class)]
db_test_x <- db_class[-row_train,-ncol(db_class)]
db_test_y <- db_class[-row_train,ncol(db_class)]

model_knn <- knn(db_train_x,db_test_x,db_train_y,12)


CrossTable(x=db_test_y,y=model_knn,prop.chisq = FALSE)

So, this is a supervised KNN models. How can I classify a new registration?
I have this new registration:

new_record <- c(5.3,3.2,2.0,0.2)

How can I classify it using the previous model?

This topic was automatically closed 21 days after the last reply. New replies are no longer allowed.

If you have a query related to it or one of the replies, start a new topic and refer back with a link.