# --- TRAINING PART ---
# custom context of the RHS variable
uptakeContext <- ctx3(7, 28.3, 46)
# convert data into fuzzy sets
d <- lcut(CO2, context=list(uptake=uptakeContext))
# split data into the training and testing set
testingIndices <- 1:5
trainingIndices <- setdiff(seq_len(nrow(CO2)), testingIndices)
training <- d[trainingIndices, ]
testing <- d[testingIndices, ]
# search for rules
r <- searchrules(training, lhs=1:38, rhs=39:58, minConfidence=0.5)
# --- TESTING PART ---
# prepare values and partition
v <- seq(uptakeContext[1], uptakeContext[3], length.out=1000)
p <- lcut(v, name='uptake', context=uptakeContext)
# do the inference
pbld(testing, r, p, v)
Run the code above in your browser using DataLab