如何解决Caret 中用于 mlpML 的激活函数
我在 R 中使用 Caret 包,尝试实现多层感知器来对卫星图像进行分类。我正在使用 method=mlpML
,我想知道正在使用哪个激活函数。
这是我的代码:
controlparameters<-trainControl(method = "repeatedcv",number=5,repeats = 5,savePredictions=TRUE,classprobs = TRUE)
mlp_grid<-expand.grid(layer1=13,layer2=0,layer3=0)
model< train(as.factor(Species)~.,data = smotedata,method='mlpML',preProc = c('center','scale'),trcontrol=controlparameters,tuneGrid=mlp_grid,importance=T)
我使用了单层,因为它比使用多层表现最好。
解决方法
查看 mlpML
的插入符号源代码,发现它使用了 RSNNS package 的 mlp
函数。
根据RSNNS mlp
documentation,它的默认参数是:
mlp(x,...)
## Default S3 method:
mlp(x,y,size = c(5),maxit = 100,initFunc = "Randomize_Weights",initFuncParams = c(-0.3,0.3),learnFunc = "Std_Backpropagation",learnFuncParams = c(0.2,0),updateFunc = "Topological_Order",updateFuncParams = c(0),hiddenActFunc = "Act_Logistic",shufflePatterns = TRUE,linOut = FALSE,outputActFunc = if (linOut) "Act_Identity" else
"Act_Logistic",inputsTest = NULL,targetsTest = NULL,pruneFunc = NULL,pruneFuncParams = NULL,...)
从中可以看出,hiddenActFunc = "Act_Logistic"
,即隐藏层的激活函数,是逻辑函数。
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。