2016-04-11 78 views
0

我有一個非常大的數據集,其中包含6個輸出列的36個功能。我試圖在這個數據集中進行MLP反向傳播神經網絡學習(迴歸),我正在使用神經網絡和插入符號。我想要兩層隱藏層,每層有6個和5個節點。我也想k重交叉驗證添加到我的神經網絡模型神經網絡,插入符號和交叉驗證

control <- trainControl(method="repeatedcv", number=5, repeats=1) 
    # train the model 
    model <- train(X,Y, method="neuralnet", 
       algorithm = "backprop", learningrate = 0.25,act.fct = 'tanh', 
       tuneGrid = data.frame(layer1 = 2:6, layer2 = 2:6, layer3 = 0),threshold = 0.1, trControl=control) 
warnings() 

其中的X和Y的特徵和分別預測數據幀

但它給錯誤和警告

Error in train.default(X, Y, method = "neuralnet", algorithm = "backprop", : 
    wrong model type for classification 
> warnings() 
Warning messages: 
1: In eval(expr, envir, enclos) : 
    model fit failed for Resample01: layer1=4, layer2=1, layer3=1 Error in if (reached.threshold < min.reached.threshold) { : 
    missing value where TRUE/FALSE needed 

2: In eval(expr, envir, enclos) : 
    model fit failed for Resample02: layer1=4, layer2=1, layer3=1 Error in if (reached.threshold < min.reached.threshold) { : 
    missing value where TRUE/FALSE needed 

3: In eval(expr, envir, enclos) : 
    model fit failed for Resample03: layer1=4, layer2=1, layer3=1 Error in if (reached.threshold < min.reached.threshold) { : 
    missing value where TRUE/FALSE needed 

4: In eval(expr, envir, enclos) : 
    model fit failed for Resample04: layer1=4, layer2=1, layer3=1 Error in if (reached.threshold < min.reached.threshold) { : 
    missing value where TRUE/FALSE needed 

5: In eval(expr, envir, enclos) : 
    model fit failed for Resample05: layer1=4, layer2=1, layer3=1 Error in if (reached.threshold < min.reached.threshold) { : 
    missing value where TRUE/FALSE needed 

6: In eval(expr, envir, enclos) : 
    model fit failed for Resample06: layer1=4, layer2=1, layer3=1 Error in if (reached.threshold < min.reached.threshold) { : 
    missing value where TRUE/FALSE needed 

7: In eval(expr, envir, enclos) : 
    model fit failed for Resample07: layer1=4, layer2=1, layer3=1 Error in if (reached.threshold < min.reached.threshold) { : 
    missing value where TRUE/FALSE needed 

8: In eval(expr, envir, enclos) : 
    model fit failed for Resample08: layer1=4, layer2=1, layer3=1 Error in if (reached.threshold < min.reached.threshold) { : 
    missing value where TRUE/FALSE needed 

9: In eval(expr, envir, enclos) : 
    model fit failed for Resample09: layer1=4, layer2=1, layer3=1 Error in if (reached.threshold < min.reached.threshold) { : 
    missing value where TRUE/FALSE needed 

10: In eval(expr, envir, enclos) : 
    model fit failed for Resample10: layer1=4, layer2=1, layer3=1 Error in if (reached.threshold < min.reached.threshold) { : 
    missing value where TRUE/FALSE needed 

11: In eval(expr, envir, enclos) : 
    model fit failed for Resample11: layer1=4, layer2=1, layer3=1 Error in if (reached.threshold < min.reached.threshold) { : 
    missing value where TRUE/FALSE needed 

12: In eval(expr, envir, enclos) : 
    model fit failed for Resample12: layer1=4, layer2=1, layer3=1 Error in if (reached.threshold < min.reached.threshold) { : 
    missing value where TRUE/FALSE needed 

13: In eval(expr, envir, enclos) : 
    model fit failed for Resample13: layer1=4, layer2=1, layer3=1 Error in if (reached.threshold < min.reached.threshold) { : 
    missing value where TRUE/FALSE needed 

14: In eval(expr, envir, enclos) : 
    model fit failed for Resample14: layer1=4, layer2=1, layer3=1 Error in if (reached.threshold < min.reached.threshold) { : 
    missing value where TRUE/FALSE needed 

15: In eval(expr, envir, enclos) : 
    model fit failed for Resample15: layer1=4, layer2=1, layer3=1 Error in if (reached.threshold < min.reached.threshold) { : 
    missing value where TRUE/FALSE needed 

16: In eval(expr, envir, enclos) : 
    model fit failed for Resample16: layer1=4, layer2=1, layer3=1 Error in if (reached.threshold < min.reached.threshold) { : 
    missing value where TRUE/FALSE needed 

17: In eval(expr, envir, enclos) : 
    model fit failed for Resample17: layer1=4, layer2=1, layer3=1 Error in if (reached.threshold < min.reached.threshold) { : 
    missing value where TRUE/FALSE needed 

18: In eval(expr, envir, enclos) : 
    model fit failed for Resample18: layer1=4, layer2=1, layer3=1 Error in if (reached.threshold < min.reached.threshold) { : 
    missing value where TRUE/FALSE needed 

19: In eval(expr, envir, enclos) : 
    model fit failed for Resample19: layer1=4, layer2=1, layer3=1 Error in if (reached.threshold < min.reached.threshold) { : 
    missing value where TRUE/FALSE needed 

20: In eval(expr, envir, enclos) : 
    model fit failed for Resample20: layer1=4, layer2=1, layer3=1 Error in if (reached.threshold < min.reached.threshold) { : 
    missing value where TRUE/FALSE needed 

21: In eval(expr, envir, enclos) : 
    model fit failed for Resample21: layer1=4, layer2=1, layer3=1 Error in if (reached.threshold < min.reached.threshold) { : 
    missing value where TRUE/FALSE needed 

22: In eval(expr, envir, enclos) : 
    model fit failed for Resample22: layer1=4, layer2=1, layer3=1 Error in if (reached.threshold < min.reached.threshold) { : 
    missing value where TRUE/FALSE needed 

23: In eval(expr, envir, enclos) : 
    model fit failed for Resample23: layer1=4, layer2=1, layer3=1 Error in if (reached.threshold < min.reached.threshold) { : 
    missing value where TRUE/FALSE needed 

24: In eval(expr, envir, enclos) : 
    model fit failed for Resample24: layer1=4, layer2=1, layer3=1 Error in if (reached.threshold < min.reached.threshold) { : 
    missing value where TRUE/FALSE needed 

25: In eval(expr, envir, enclos) : 
    model fit failed for Resample25: layer1=4, layer2=1, layer3=1 Error in if (reached.threshold < min.reached.threshold) { : 
    missing value where TRUE/FALSE needed 

26: In nominalTrainWorkflow(x = x, y = y, wts = weights, info = trainInfo, ... : 
    There were missing values in resampled performance measures. 
+0

您對列車命令的使用是錯誤的。如果在此處指定了調整參數,則會出現錯誤。在這種情況下,隱藏的層。 – phiver

+0

我用適當的圖層參數編輯了代碼,但仍然給出錯誤 – Eka

+0

實際數據是什麼樣的?你只有1個預測變量,還是x有多列的矩陣?你的Y是一個因素嗎? – Alos

回答