Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

mlpWeightDecayML - learnFuncParams decay parameter at wrong index #392

Closed
smlek opened this issue Mar 11, 2016 · 1 comment
Closed

mlpWeightDecayML - learnFuncParams decay parameter at wrong index #392

smlek opened this issue Mar 11, 2016 · 1 comment

Comments

@smlek
Copy link

@smlek smlek commented Mar 11, 2016

when using mlpWeightDecayML and mlpWeightDecay methods and specifying decay parameter in tuneGrid, the decay value is passed incorrectly during the call to RSNNS::mlp() learnFuncParams.

Decay value should be at learnFuncParams[2], but instead it shows up in learnFuncParams[3].
This is an error in mlpWeightDecayML$fit

mlpWeightDecayML$fit
.
.
if (any(names(theDots) == "learnFuncParams")) 
        prms <- theDots$learnFuncParams

        prms[3] <- param$decay

This should be prms[2] <- param$decay

debugging call to mlp() gives:
learnFunc = "BackpropWeightDecay", learnFuncParams = c(0.01, 5e-05, 1e-05, 0), size = 4, ...

Minimal dataset:

library(caret)
data("infert")

Minimal, runnable code:

cvCtrl <- trainControl(method = "none", number = 1)
tune_grid <- expand.grid(layer1 = c(4),
                         layer2 = 0,
                         layer3 = 0,
                         decay = 0.00001
                         )

mlpwdMLModel <- train(x = infert[, c(2, 3, 4, 6)],
                 y = infert[, 5],
                 #y = factor(trainOutputs, levels=c("0","1"), labels=c("Down","Up")),
                 method = "mlpWeightDecayML",
                 learnFuncParams=c(0.01, .00005, 0, 0),
                 #tuneLength = 30,
                 #metric = "Accuracy",
                 trControl = cvCtrl,
                 tuneGrid = tune_grid,
                 maxit=500,
                 linOut = FALSE            
                 )
)
print(mlpwdMLModel)

Session Info:

>sessionInfo()

R version 3.2.3 (2015-12-10)
Platform: x86_64-w64-mingw32/x64 (64-bit)
Running under: Windows 7 x64 (build 7601) Service Pack 1

locale:
[1] LC_COLLATE=English_United States.1252 LC_CTYPE=English_United States.1252
[3] LC_MONETARY=English_United States.1252 LC_NUMERIC=C
[5] LC_TIME=English_United States.1252

attached base packages:
[1] stats graphics grDevices utils datasets methods base

other attached packages:
[1] caret_6.0-64 ggplot2_2.0.0 lattice_0.20-33 RSNNS_0.4-7 Rcpp_0.12.2

loaded via a namespace (and not attached):
[1] knitr_1.12 magrittr_1.5 splines_3.2.3 MASS_7.3-45 munsell_0.4.3
[6] colorspace_1.2-6 foreach_1.4.3 minqa_1.2.4 stringr_1.0.0 car_2.1-1
[11] plyr_1.8.3 tools_3.2.3 parallel_3.2.3 nnet_7.3-11 pbkrtest_0.4-6
[16] grid_3.2.3 gtable_0.1.2 nlme_3.1-124 mgcv_1.8-10 quantreg_5.21
[21] MatrixModels_0.4-1 iterators_1.0.8 lme4_1.1-11 Matrix_1.2-3 nloptr_1.0.4
[26] reshape2_1.4.1 codetools_0.2-14 stringi_1.0-1 scales_0.3.0 stats4_3.2.3
[31] SparseM_1.7

topepo added a commit that referenced this issue Mar 12, 2016
topepo added a commit that referenced this issue Mar 12, 2016
@topepo
Copy link
Owner

@topepo topepo commented Mar 12, 2016

True. I've committed the fixes and they will be in the next version.

Thanks,

Max

@topepo topepo closed this Mar 12, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
2 participants
You can’t perform that action at this time.