警告在MLP模型(尖,RSNNS包)
问题描述:
我当时正在通过插入符包多层感知模型R.的代码是:警告在MLP模型(尖,RSNNS包)
LR_fitcontrol <- trainControl(method='cv',
number=2,
classProbs = T,
summaryFunction = twoClassSummary,
savePredictions = T)
Sys.time()
para.grid <-data.frame(size= c(10))
KNN_fit <- train(LR_formula_tune,data=model_data_Classification,
method="mlp",
metric='ROC',
preProc = c('center','scale'),
tuneGrid = para.grid,
trControl= LR_fitcontrol
)
我得到了警告。
1: In snnsObject$setUnitName(num, iNames[[i]]) :
SNNS error message in setUnitName : SNNS-Kernel Error: Symbol pattern invalid (must match [A-Za-z][^|, ]*)
有16个像这样的警告。
我已经在这个数据集上运行了许多其他的模型,像RF,KNN,Logistic,Naive Bayes。所以我想这个数据集很好。
当然,我GOOGLE了这个错误,并没有类似的结果。我认为需要一些帮助。谢谢!
答
我遇到了同样的问题。警告告诉您使用的符号存在一些问题。就我而言,这是一个名为“03Prüfen”的因素级别。为了避免这个警告,我将因素级别改为了'03Puuefen',它解决了这个问题。所以你应该避免像'äö'等特殊字符。检查你的数据。由于我不知道你的数据是什么样的,我不能告诉你你的问题到底在哪里。
工作例如:
library(caret)
library(RSNNS)
data(iris) #load example-data
iris$ExampleFeature <- as.factor(c(rep("01Blümchen", 50), rep("02Blume", 50), rep("03Blöme", 50))) #add factor with problematic factor level names
# Define trainControl #
control <- trainControl(method='cv',
number=2,
classProbs = TRUE,
savePredictions = "final")
# Start training which will create warnings #
KNN_fit <- train(Species~.,
data=iris,
method="mlp",
metric='Accuracy',
preProc=c('center','scale'),
trControl=control
)
# Change factor level names and re-run training #
levels(iris$ExampleFeature) <- c("01Bluemchen","02Blume","03Bloeme")
KNN_fit <- train(Species~.,
data=iris,
method="mlp",
metric='Accuracy',
preProc=c('center','scale'),
trControl=control
)
另外:当我跑步时我的Windows的笔记本电脑RStudio代码中的警告不会occure。它只发生在我在CentOS上运行的RStudio-Server上。
我从Mac系统得到这个结果,所以也许它是与平台相关的。 –
可能。变量名称或任何因子级别中是否有特殊字符?如果是这样,请更改并重试。请让我知道这对你有没有用。 –