【发布时间】:2017-03-20 21:51:50
【问题描述】:
我有一个由 0 和 1 组成的“label.csv”文件。
y = read.csv("./data/labels.csv", stringsAsFactors = T)
当我cbindy用数据做分类训练时,出现如下警告:
Warning message:
In train.default(x, y, weights = w, ...) :
You are trying to do regression and your outcome only has two possible values Are you trying to do classification? If so, use a 2 level factor as your outcome column.
我想将y 转换为水平因子并将其与特征数据进行cbind 以进行分类。
但是,使用as.factor(y) 会产生以下错误:
Error in sort.list(y) : 'x' must be atomic for 'sort.list'
Have you called 'sort' on a list?
我是否在正确的轨道上解决这个问题?
谢谢。
【问题讨论】:
标签: r classification type-conversion