我正在尝试使用frbs
包生成一些默认参数的模型。我没有得到任何错误,但结果是只有一个值(最低值)的列。
当我为不同的方法运行相同的代码时,我得到了合理的结果。
这个方法和我的代码出了什么问题?
train <- iris[1 : 100, 1:4]
test <- iris[101 : 150, 1 : 3]
real <- matrix(iris[101 : 150, 4], ncol = 1)
my_range=apply(iris[,1:4],2,range)
method.type <- "ANFIS"
control <- list(num.labels = 3, max.iter = 10, step.size = 0.01, type.tnorm = "MIN", type.snorm = "MAX", type.implication.func = "ZADEH", name = "diams")
mod <- frbs.learn(train, my_range, method.type, control)
prd<- predict(mod, test)
答案 0 :(得分:1)
你需要有num.labels = 4(也包括响应变量):
control <- list(num.labels = 4, max.iter = 10, step.size = 0.01, type.tnorm = "MIN", type.snorm = "MAX", type.implication.func = "ZADEH", name = "diams")
mod <- frbs.learn(train, my_range, method.type, control)
prd<- predict(mod, newdata=test)
head(prd)
[,1]
[1,] 1.680819
[2,] 1.422430
[3,] 1.957765
[4,] 1.693969
[5,] 1.770748
[6,] 2.262179