machine learning - R: caret and nnet Error with big data -
i've problem. i've dataset lot of features. when try perform nnet caret r give me error. if try perform smaller part of features, nnet converge.
here code:
> dim(traint) [1] 130 3413 > nnfit <- train(target ~ ., data = traint, + method = "nnet", + trcontrol = fitcontrol#, + #trcontrol = ctrl, metric = "roc", + #verbose = true#, + #tunegrid = nngrid + ) wrong; accuracy metric values missing: accuracy kappa min. : na min. : na 1st qu.: na 1st qu.: na median : na median : na mean :nan mean :nan 3rd qu.: na 3rd qu.: na max. : na max. : na na's :9 na's :9 error in train.default(x, y, weights = w, ...) : stopping in addition: there 50 or more warnings (use warnings() see first 50) > > nnfit <- train(target ~ ., data = traint[,1:100], method = "nnet", trcontrol = fitcontrol#, #trcontrol = ctrl, metric = "roc", #verbose = true#, #tunegrid = nngrid ) # weights: 102 initial value 65.440715 iter 10 value 34.586483 iter 20 value 25.531746 iter 30 value 22.930604 iter 40 value 22.919387 iter 50 value 20.326238 iter 60 value 20.018595 iter 70 value 5.289718 iter 80 value 0.016055 final value 0.000063 converged # weights: 304 initial value 85.540457 iter 10 value 25.219303 iter 20 value 5.562977 iter 30 value 4.712105 iter 40 value 4.676887 iter 50 value 4.625627 iter 60 value 4.622304 iter 70 value 4.597801 iter 80 value 4.582877 iter 90 value 4.570602 iter 100 value 4.569542 final value 4.569542 stopped after 100 iterations [...] initial value 75.037558 iter 10 value 4.301843 iter 20 value 1.495044 iter 30 value 0.159978 iter 40 value 0.118735 iter 50 value 0.110560 iter 60 value 0.101595 iter 70 value 0.079860 iter 80 value 0.073034 iter 90 value 0.065459 iter 100 value 0.052024 final value 0.052024 stopped after 100 iterations # weights: 506 initial value 95.448738 iter 10 value 20.859400 iter 20 value 6.493820 iter 30 value 5.597509 iter 40 value 5.516322 iter 50 value 5.510970 iter 60 value 5.510881 final value 5.510881 converged
can me? :)
ps: session info:
> sessioninfo() r version 3.2.0 (2015-04-16) platform: x86_64-w64-mingw32/x64 (64-bit) running under: windows 8 x64 (build 9200) locale: [1] lc_collate=italian_italy.1252 lc_ctype=italian_italy.1252 [3] lc_monetary=italian_italy.1252 lc_numeric=c [5] lc_time=italian_italy.1252 attached base packages: [1] stats graphics grdevices utils datasets methods base other attached packages: [1] nnet_7.3-9 caret_6.0-47 ggplot2_1.0.1 lattice_0.20-31 loaded via namespace (and not attached): [1] rcpp_0.11.6 magrittr_1.5 splines_3.2.0 mass_7.3-40 [5] munsell_0.4.2 colorspace_1.2-6 foreach_1.4.2 minqa_1.2.4 [9] car_2.0-25 stringr_1.0.0 plyr_1.8.2 tools_3.2.0 [13] parallel_3.2.0 pbkrtest_0.4-2 grid_3.2.0 gtable_0.1.2 [17] nlme_3.1-120 mgcv_1.8-6 quantreg_5.11 e1071_1.6-4 [21] class_7.3-12 iterators_1.0.7 gtools_3.5.0 lme4_1.1-7 [25] digest_0.6.8 matrix_1.2-0 nloptr_1.0.4 reshape2_1.4.1 [29] codetools_0.2-11 stringi_0.4-1 compiler_3.2.0 bradleyterry2_1.0-6 [33] scales_0.2.4 sparsem_1.6 brglm_0.5-9 proto_0.3-10
edit: forget comma in code :( i'm while col , test.
@cyberj0g:
i try suggested:
1- analyzing summary have seen numbers.
2- if call warning () not return anything, if try stop before completing nnet me:
> nnfit <- train(target ~ ., data = traint, + method = "nnet", + trcontrol = fitcontrol#, + #trcontrol = ctrl, metric = "roc", + #verbose = true#, + #tunegrid = nngrid + ) warning messages: 1: in eval(expr, envir, enclos) : model fit failed fold1.rep1: size=1, decay=0e+00 error in nnet.default(x, y, w, entropy = true, ...) : many (3011) weights 2: in eval(expr, envir, enclos) : model fit failed fold1.rep1: size=3, decay=0e+00 error in nnet.default(x, y, w, entropy = true, ...) : many (9031) weights 3: in eval(expr, envir, enclos) : model fit failed fold1.rep1: size=5, decay=0e+00 error in nnet.default(x, y, w, entropy = true, ...) : many (15051) weights 4: in eval(expr, envir, enclos) : model fit failed fold1.rep1: size=1, decay=1e-01 error in nnet.default(x, y, w, entropy = true, ...) : many (3011) weights 5: in eval(expr, envir, enclos) : model fit failed fold1.rep1: size=3, decay=1e-01 error in nnet.default(x, y, w, entropy = true, ...) : many (9031) weights
3- if increase number of cv (if understand refear it) problem same:
> fitcontrol <- traincontrol(## 5-fold cv + method = "repeatedcv", + number = 1000, + ## repeated 5 times + repeats = 5) > nnfit <- train(target ~ ., data = traint, + method = "nnet", + trcontrol = fitcontrol#, + #trcontrol = ctrl, metric = "roc", + #verbose = true#, + #tunegrid = nngrid + ) there 50 or more warnings (use warnings() see first 50)
it's not clear causing error, suggest following:
- check data abnormalities:
summary(traint)
- check warnings after error:
warnings()
- try increase number of iterations:
traincontrol(number=1000)
also, full dataset contains barely enough samples train model 130 predictors (it depends, though). convergence on 100 samples means nothing.
Comments
Post a Comment