问题描述
我正在尝试使用 deepenet 包的 dbn.dnn.train 函数训练 MNIST 数据集.任务是分类任务.我正在使用以下命令
I am trying to train the MNIST dataset using deepenet package's dbn.dnn.train function. The task is a classification one.I am using the following command
dbn.deepnet <- dbn.dnn.train(train.image.data,train.image.labels,hidden=c(5,5))
我面临的问题是:
1) 标签应该是因子类型向量.但是当我输入标签作为因子时,函数给出了一个错误,即y 应该是一个矩阵或向量".所以,我使用标签作为数字.如何进行分类任务
1) The labels should be factor type vector. But when i input the labels as factor the function gives an error that "y should be a matrix or vector". So, I am using labels as numeric. How to proceed for a classification task
2) 对 dbn.dnn.train 进行预测的功能是什么.我正在使用 nn.predict 但文档提到输入应该是由函数 nn.train 训练的神经网络(没有提到 dbn.dnn.train).所有记录的输出为 0.9986
2) What it the function to make the predictions for dbn.dnn.train. I am using nn.predict but the documentation mentions that the input should be neural network trained by function nn.train (dbn.dnn.train is not mentioned).The output is 0.9986 for all records
nn.predict(dbn.deepnet,train.image.data)
推荐答案
不知道你是否还在研究它,或者你是否已经找到了解决方案但是:1/试试这个:train.image.labels <- data.matrix(train.image.labels)
Don't know if you are still working on it, or if you've found the solution but : 1/ try this : train.image.labels <- data.matrix(train.image.labels)
2/我使用 nn.predict,即使神经网络是由 dbn.dnn.train 训练的.
2/ i use nn.predict, even if the neural network is trained by dbn.dnn.train.
这篇关于R 包 Deepnet:训练和测试 MNIST 数据集的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!