我正在尝试使用“ mxnet”软件包训练分类模型
train_matrix.x <- train_matrix[,-92]
train_matrix.y <- train_matrix[,92]
# normalize
train_matrix.x <- t(lapply(train_matrix.x , normalize))
test_matrix <- t(lapply(test_matrix , normalize))
# check the distribution of the classes
table(train_matrix.y)
## Network Configuration
data <- mx.symbol.Variable("data")
fc1 <- mx.symbol.FullyConnected(data, name="fc1", num_hidden=10)
act1 <- mx.symbol.Activation(fc1, name="relu1", act_type="relu")
fc2 <- mx.symbol.FullyConnected(act1, name="fc2", num_hidden=10)
devices <- mx.cpu()
# train the model
mx.set.seed(0)
model <- mx.model.FeedForward.create(array.layout = "colmajor", softmax, X=data.matrix(train_matrix.x), y=array(train_matrix.y),
ctx=devices, num.round=10, array.batch.size=100,
learning.rate=0.07, momentum=0.9, eval.metric=mx.metric.accuracy,
initializer=mx.init.uniform(0.07),
epoch.end.callback=mx.callback.log.train.metric(100))
但是我一直收到此错误:
Error in mx.io.internal.arrayiter(as.array(data), as.array(label), unif.rnds, :
Not compatible with requested type: [type=list; target=double].
由于我不是深度学习编码的新手,所以我不明白这是怎么回事。 预先谢谢你