2016-06-09 177 views
0

我正在使用neuralnet包。R神經網絡:神經元錯誤[[i]]%*%權重[[i]]:需要數值/複數矩陣/向量參數

我可以用訓練:

neural <- neuralnet(pricelb ~ eight + three + length + diameter + thread, 
        cleaned, hidden=10, threshold=0.01)` 

所有這些都是數字的功能,我是雙str(cleaned)

然而檢查,當我去預測:

prediction <- compute(neural, cleanedtwo) 

我得到以下錯誤:

Error in neurons[[i]] %*% weights[[i]] : requires numeric/complex matrix/vector arguments`

看起來通常這是因爲使用了非數字值,但是我已經檢查過,訓練中的所有屬性以及測試集中的相同屬性都是數字。

如果數據框中還有其他因子屬性已清理/清理過,即使它們未用於培訓,是否存在問題?

編輯:也有不缺少/ NA值

+1

你能提供'STR(cleanedtwo)的輸出'? – cdeterman

+0

沒有回答解決問題了嗎?如果沒有,請展開你的問題。 – cdeterman

回答

1

我懷疑比你在公式中指定(但是這是一個猜測,直到你展示str(cleanedtwo)cleanedtwo對象有多個變量

爲了解決這個問題。你可以將數據子集的相關列

prediction <- compute(neural, cleanedtwo[, c("eight","three","length","diameter" ,"thread"))