Tamer Warshl
Tamer Warshl

Reputation: 11

Running Neural network in R

I have a csv file for well-B2 that has five variables, I am trying to use simple neural network trial taking 2 variables "EC, CorrP" to predict the Grainsize,

I followed some examples from training materials, but it does not work

# 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)

all the steps run okay, however, I got that message after ann

# weights:  401
initial  value 0.000000 
final  value 0.000000 
converged

when I tried to run plot(ann), it gave me that error

Error in xy.coords(x, y, xlabel, ylabel, log) : 
  'x' is a list, but does not have components 'x' and 'y'

Upvotes: 1

Views: 39

Answers (0)

Related Questions