KNN in R: 'train and class have different lengths'?

前端 未结 5 1135
清酒与你
清酒与你 2020-12-11 01:49

Here is my code:

train_points <- read.table(\"kaggle_train_points.txt\", sep=\"\\t\")
train_labels <- read.table(\"kaggle_train_labels.txt\", sep=\"\\t         


        
5条回答
  •  生来不讨喜
    2020-12-11 02:16

    Try converting the data into a dataframe using as.dataframe(). I was having the same problem & afterwards it worked fine:

    train_pointsdf <- as.data.frame(train_points)
    train_labelsdf <- as.data.frame(train_labels)
    test_pointsdf <- as.data.frame(test_points)
    

提交回复
热议问题