I've been trying to use the R Statistical software to build a Takagi Sugeno fuzzy system. Using the R package 'frbs' I've managed to set up the most of components of the FIS following the example in the demo files. Unfortunately I've hit a problem: Error in validate.params(object, newdata) : Please check your num.labels parameters I've been trying to predict some value, and I don't know what is wrong in this script. When i comment the last line everything seems to be ok, but only one plot is drawing.
# rm(list=ls()) # not generally appreciated
library(frbs)
varinp.mf <- matrix(c( 5, -1, 0.8493, NA, NA, 5, 1, 0.8493, NA, NA,
5, -1, 0.8493, NA, NA, 5, 1, 0.8493, NA, NA),
nrow = 5, byrow = FALSE)
num.fvalinput <- matrix(c(2,2), nrow=1)
x1 <- c("a1","a2")
x2 <- c("b1","b2")
names.varinput <- c(x1, x2)
range.data <- matrix(c(-1.5,1.5, -1.5, 1.5), nrow=2)
type.defuz <- "5"
type.tnorm <- "MIN"
type.snorm <- "MAX"
type.implication.func <- "MIN"
name <- "Przykład"
newdata <- matrix(c(-0.6, 0.3), ncol = 2, byrow = TRUE)
colnames.var <- c("x1", "x2")
type.model <- "TSK"
func.tsk <- matrix(c(1, 1, 1,
2, 1, 0,
1, -2, -1,
-1, 0.5, -2),
nrow = 4, byrow = TRUE)
rule <- matrix(c("A1","and","B1","->",
"A1","and","B2","->",
"A2","and","B1","->",
"A2","and","B2","->"),
nrow = 4, byrow = TRUE)
object <- frbs.gen( range.data, num.fvalinput, names.varinput,
num.fvaloutput, varout.mf=NULL, names.varoutput, rule,
varinp.mf, type.model, type.defuz, type.tnorm, type.snorm,
func.tsk, colnames.var, type.implication.func)
plotMF(object)
res <- predict(object, newdata)$predicted.val