提问人:Tamer Warshl 提问时间:4/2/2023 最后编辑:r2evansTamer Warshl 更新时间:4/3/2023 访问量:33
在 R 中运行神经网络
Running Neural network in R
问:
我有一个 well-B2 的 csv 文件,其中包含五个变量,我正在尝试使用简单的神经网络试验,采用 2 个变量“EC,CorrP”来预测晶粒尺寸,
我遵循了培训材料中的一些示例,但它不起作用
# Neural netwwork
(df1_B2)
df1_B2, class)
(df1_B2)
#### Normalize (Min-Max 0-1) ###
df1_B2$EC=(df1_B2$EC - min(df1_B2$EC))/(max(df1_B2$EC) - min(df1_B2$EC))
df1_B2$CorrP=(df1_B2$CorrP - min(df1_B2$CorrP))/(max(df1_B2$CorrP) - min(df1_B2$CorrP))
df1_B2$GrainSize=(df1_B2$GrainSize - min(df1_B2$GrainSize))/(max(df1_B2$GrainSize) - min(df1_B2$GrainSize))
### Partitioning of the data ######
set.seed(222)
ind=sample(2,nrow(df1_B2), replace=TRUE, prob = c(0.7,0.3))
training=df1_B2[ind==1,]
testing=df1_B2[ind==2,]
library(nnet)
set.seed(333)
ann=nnet(GrainSize~ EC+CorrP, data=training, hidden=1, size = 100, err.fct="ce", linear.output=FALSE)
plot(ann)
所有步骤都运行良好,但是,我在 ann 之后收到了该消息
# weights: 401
initial value 0.000000
final value 0.000000
converged
当我尝试运行plot(ann)时,它给了我那个错误
Error in xy.coords(x, y, xlabel, ylabel, log) :
'x' is a list, but does not have components 'x' and 'y'
答: 暂无答案
评论
df1_B2