这是我的代码:
train_points <- read.table("kaggle_train_points.txt", sep="\t")
train_labels <- read.table("kaggle_train_labels.txt", sep="\t")
test_points <- read.table("kaggle_test_points.txt", sep="\t")
#uses package 'class'
library(class)
knn(train_points, test_points, train_labels, k = 5);
dim(train_points)
是 42000 x 784
dim(train_labels)
是 42000 x 1
我没有看到问题,但我收到了错误:
knn(train_points, test_points, train_labels, k = 5) 中的错误:
“train”和“class”的长度不同。
有什么问题?