Several errors running functions in FuzzyR

Hello,
I am trying to implement an Adaptive Neuro-Fuzzy Inference System (ANFIS) using the FuzzyR package but I keep getting errors.
The complete codes are shown below.

The ANFIS code is for an eight-input and one-output system.

library('FuzzyR')
train = round(nrow(concrete)*.70)
test = round((nrow(concrete)-train)*0.5)
val <- 1030
train.data = concrete[1:train,]    #training data set
train.data <- train.data[sample(1:nrow(train.data)),] # shuffled training dataset
test.data = concrete[(train+1):(train+test),] #test data set
test.data <- test.data[sample(1:nrow(test.data)),]
val.data = concrete[(train+test+1):(val), ]  #validation data set 
val.data <- val.data[sample(1:nrow(val.data)),] #shuffled validation data set
input.data = concrete[,1:8]  # input dataset
data.range <- matrix(0, ncol=2, nrow=ncol(input.data)) #zero matrix for input ranges 
for (i in 1:ncol(input.data)) {data.range[i,] = range(input.data[,i])}  #loop to fill zero matrix 
input.num <- 8

#number of membership functions in each fuzzy variable  
age.mf <- 4
cement.mf <- 4
water.mf <- 4
coarse.mf <- 3
blast.mf <- 3
super.mf <- 3
flyash.mf <- 4
fine.mf <- 3

# total number of possible rules 
mf.num <- prod(age.mf, cement.mf, water.mf, coarse.mf, blast.mf, super.mf, flyash.mf, fine.mf)
# naive accuracy case 
naive.trn <- train.data[,5]
naive.tst <- test.data[,5]
naive.chk <- val.data[, 5]
scale.mase <- mean(abs(train.data[,9] - naive.trn))
# rule base
rule.num <- 100
rule.which <- sort(sample(1:mf.num, rule.num))

#automated fis builder
concrete.strength <- fis.builder(x.range =  data.range, input.num = input.num, input.mf.num = mf.num,input.mf.type = 'T1', rule.num = rule.num, rule.which = rule.which, defuzzMethod = 'KM')

The code runs fine until it gets to fis.builder then It throws the following error.

Error in if (a == 0) a = 1 : missing value where TRUE/FALSE needed

I can't seem to understand what part of the code is causing these issues. Is there anyone that could be of assistance?
Thanks in advance

Edit: the problem has been solved. The issue was with the definition of the membership functions and the input data was is a dataframe instead of a matrix

This topic was automatically closed 21 days after the last reply. New replies are no longer allowed.

If you have a query related to it or one of the replies, start a new topic and refer back with a link.