0
Я пытаюсь реализовать основную нейронную сетьОшибка с neuralnet в R
library (neuralnet)
set.seed(2016)
attribute <- as.data.frame(sample(seq(-2,2, length =50),50, replace = FALSE),ncol =1)
response <- attribute ^2
data <- cbind (attribute , response)
colnames(data) <- c(" attribute "," response")
head (data ,10)
fit <- neuralnet(response~attribute, data = data,hidden =c(3 ,3),threshold =0.01)
testdata <- as.matrix(sample(seq(-2,2,length =10), 10, replace = FALSE), ncol =1)
pred <- compute(fit , testdata)
result <- cbind (testdata , pred $net.result, testdata ^2)
colnames (result) <- c(" Attribute ","Prediction ", " Actual ")
round (result ,4)
Я получаю следующее сообщение об ошибке для команды neuralnet
Error in model.frame.default(formula.reverse, data) :invalid type (list) for variable 'attribute'
Может кто-нибудь объяснить, как это можно решить? Благодаря