我的KNN算法适用于流失数据集?

时间:2019-07-13 21:29:27

标签: r knn

  1. 将数据集Cars输入到数据框“搅动”中
#Read the CSV(Comma Separated Values) file and store it in cars
Churn <- read.csv(file = "C:/Users/rizod/Desktop/data/Churn.txt", stringsAsFactors = FALSE)

#Show the new DataFrame "Churn" #Display cars
Churn 
  1. 运行KNN
knn(data,
    new,
    cl=trueclass,
    k=3,
    prob=TRUE)

当我尝试使用此数据集运行KNN时,我一直收到此错误

"Error in knn(data, new, cl = trueclass, k = 5, prob = TRUE) : 
  'train' and 'class' have different lengths

0 个答案:

没有答案