Running examples in ‘frbs-Ex.R’ failed
The error most likely occurred in:

> base::assign(".ptime", proc.time(), pos = "CheckExEnv")
> ### Name: frbs-package
> ### Title: Getting started with the frbs package
> ### Aliases: frbs frbs-package
> 
> ### ** Examples
> 
> ##################################
> ## I. Regression Problem
> ## In this example, we are using the gas furnace dataset that
> ## contains two input and one output variables.
> ##################################
> 
> ## Input data: Using the Gas Furnace dataset
> ## then split the data to be training and testing datasets
> data(frbsData)
> data.train <- frbsData$GasFurnance.dt[1 : 204, ]
> data.tst <- frbsData$GasFurnance.dt[205 : 292, 1 : 2]
> real.val <- matrix(frbsData$GasFurnance.dt[205 : 292, 3], ncol = 1)
> 
> ## Define interval of data
> range.data <-apply(data.train, 2, range)
> 
> ## Set the method and its parameters,
> ## for example, we use Wang and Mendel's algorithm
> method.type <- "WM"
> control <- list(num.labels = 15, type.mf = "GAUSSIAN", type.defuz = "WAM",
+            type.tnorm = "MIN", type.snorm = "MAX", type.implication.func = "ZADEH",
+                name = "sim-0")
> 
> ## Learning step: Generate an FRBS model
> object.reg <- frbs.learn(data.train, range.data, method.type, control)
> 
> ## Predicting step: Predict for newdata
> res.test <- predict(object.reg, data.tst)
> 
> ## Display the FRBS model
> summary(object.reg)
The name of model:  sim-0 
Model was trained using:  WM 
The names of attributes:  var.1 var.2 var.3 
The interval of training data:  
     var.1 var.2 var.3
min -2.716  45.6  45.6
max  2.834  60.5  60.5
Type of FRBS model: 
[1] "MAMDANI"
Type of membership functions: 
[1] "GAUSSIAN"
Type of t-norm method: 
[1] "Standard t-norm (min)"
Type of s-norm method: 
[1] "Standard s-norm"
Type of defuzzification technique: 
[1] "Weighted average method"
Type of implication function: 
[1] "ZADEH"
The names of linguistic terms on the input variables:  
 [1] "v.1_a.1"  "v.1_a.2"  "v.1_a.3"  "v.1_a.4"  "v.1_a.5"  "v.1_a.6" 
 [7] "v.1_a.7"  "v.1_a.8"  "v.1_a.9"  "v.1_a.10" "v.1_a.11" "v.1_a.12"
[13] "v.1_a.13" "v.1_a.14" "v.1_a.15" "v.2_a.1"  "v.2_a.2"  "v.2_a.3" 
[19] "v.2_a.4"  "v.2_a.5"  "v.2_a.6"  "v.2_a.7"  "v.2_a.8"  "v.2_a.9" 
[25] "v.2_a.10" "v.2_a.11" "v.2_a.12" "v.2_a.13" "v.2_a.14" "v.2_a.15"
The parameter values of membership function on the input variable (normalized):  
     v.1_a.1    v.1_a.2   v.1_a.3   v.1_a.4   v.1_a.5   v.1_a.6   v.1_a.7
[1,]   5.000 5.00000000 5.0000000 5.0000000 5.0000000 5.0000000 5.0000000
[2,]   0.000 0.07142857 0.1428571 0.2142857 0.2857143 0.3571429 0.4285714
[3,]   0.025 0.02500000 0.0250000 0.0250000 0.0250000 0.0250000 0.0250000
[4,]      NA         NA        NA        NA        NA        NA        NA
[5,]      NA         NA        NA        NA        NA        NA        NA
     v.1_a.8   v.1_a.9  v.1_a.10  v.1_a.11  v.1_a.12  v.1_a.13  v.1_a.14
[1,]   5.000 5.0000000 5.0000000 5.0000000 5.0000000 5.0000000 5.0000000
[2,]   0.500 0.5714286 0.6428571 0.7142857 0.7857143 0.8571429 0.9285714
[3,]   0.025 0.0250000 0.0250000 0.0250000 0.0250000 0.0250000 0.0250000
[4,]      NA        NA        NA        NA        NA        NA        NA
[5,]      NA        NA        NA        NA        NA        NA        NA
     v.1_a.15 v.2_a.1    v.2_a.2   v.2_a.3   v.2_a.4   v.2_a.5   v.2_a.6
[1,]    5.000   5.000 5.00000000 5.0000000 5.0000000 5.0000000 5.0000000
[2,]    1.000   0.000 0.07142857 0.1428571 0.2142857 0.2857143 0.3571429
[3,]    0.025   0.025 0.02500000 0.0250000 0.0250000 0.0250000 0.0250000
[4,]       NA      NA         NA        NA        NA        NA        NA
[5,]       NA      NA         NA        NA        NA        NA        NA
       v.2_a.7 v.2_a.8   v.2_a.9  v.2_a.10  v.2_a.11  v.2_a.12  v.2_a.13
[1,] 5.0000000   5.000 5.0000000 5.0000000 5.0000000 5.0000000 5.0000000
[2,] 0.4285714   0.500 0.5714286 0.6428571 0.7142857 0.7857143 0.8571429
[3,] 0.0250000   0.025 0.0250000 0.0250000 0.0250000 0.0250000 0.0250000
[4,]        NA      NA        NA        NA        NA        NA        NA
[5,]        NA      NA        NA        NA        NA        NA        NA
      v.2_a.14 v.2_a.15
[1,] 5.0000000    5.000
[2,] 0.9285714    1.000
[3,] 0.0250000    0.025
[4,]        NA       NA
[5,]        NA       NA
The names of linguistic terms on the output variable:  
 [1] "c.1"  "c.2"  "c.3"  "c.4"  "c.5"  "c.6"  "c.7"  "c.8"  "c.9"  "c.10"
[11] "c.11" "c.12" "c.13" "c.14" "c.15"
The parameter values of membership function on the output variable (normalized):  
       c.1        c.2       c.3       c.4       c.5       c.6       c.7   c.8
[1,] 5.000 5.00000000 5.0000000 5.0000000 5.0000000 5.0000000 5.0000000 5.000
[2,] 0.000 0.07142857 0.1428571 0.2142857 0.2857143 0.3571429 0.4285714 0.500
[3,] 0.025 0.02500000 0.0250000 0.0250000 0.0250000 0.0250000 0.0250000 0.025
[4,]    NA         NA        NA        NA        NA        NA        NA    NA
[5,]    NA         NA        NA        NA        NA        NA        NA    NA
           c.9      c.10      c.11      c.12      c.13      c.14  c.15
[1,] 5.0000000 5.0000000 5.0000000 5.0000000 5.0000000 5.0000000 5.000
[2,] 0.5714286 0.6428571 0.7142857 0.7857143 0.8571429 0.9285714 1.000
[3,] 0.0250000 0.0250000 0.0250000 0.0250000 0.0250000 0.0250000 0.025
[4,]        NA        NA        NA        NA        NA        NA    NA
[5,]        NA        NA        NA        NA        NA        NA    NA
The number of linguistic terms on each variables 
     var.1 var.2 var.3
[1,]    15    15    15
The fuzzy IF-THEN rules:  
   V1    V2 V3       V4  V5    V6 V7       V8   V9   V10 V11  V12
1  IF var.1 is  v.1_a.9 and var.2 is  v.2_a.7 THEN var.3  is  c.7
2  IF var.1 is v.1_a.10 and var.2 is  v.2_a.6 THEN var.3  is  c.6
3  IF var.1 is  v.1_a.2 and var.2 is v.2_a.15 THEN var.3  is c.15
4  IF var.1 is  v.1_a.5 and var.2 is  v.2_a.8 THEN var.3  is  c.9
5  IF var.1 is  v.1_a.8 and var.2 is  v.2_a.9 THEN var.3  is  c.8
6  IF var.1 is  v.1_a.8 and var.2 is  v.2_a.6 THEN var.3  is  c.7
7  IF var.1 is  v.1_a.8 and var.2 is  v.2_a.7 THEN var.3  is  c.7
8  IF var.1 is  v.1_a.6 and var.2 is  v.2_a.7 THEN var.3  is  c.8
9  IF var.1 is  v.1_a.4 and var.2 is v.2_a.12 THEN var.3  is c.12
10 IF var.1 is v.1_a.15 and var.2 is  v.2_a.1 THEN var.3  is  c.1
11 IF var.1 is v.1_a.10 and var.2 is  v.2_a.4 THEN var.3  is  c.5
12 IF var.1 is  v.1_a.7 and var.2 is v.2_a.10 THEN var.3  is c.10
13 IF var.1 is  v.1_a.7 and var.2 is  v.2_a.9 THEN var.3  is  c.9
14 IF var.1 is v.1_a.11 and var.2 is  v.2_a.6 THEN var.3  is  c.5
15 IF var.1 is  v.1_a.4 and var.2 is v.2_a.11 THEN var.3  is c.12
16 IF var.1 is v.1_a.10 and var.2 is  v.2_a.8 THEN var.3  is  c.7
17 IF var.1 is v.1_a.11 and var.2 is  v.2_a.5 THEN var.3  is  c.5
18 IF var.1 is  v.1_a.7 and var.2 is v.2_a.11 THEN var.3  is c.10
19 IF var.1 is  v.1_a.9 and var.2 is  v.2_a.5 THEN var.3  is  c.6
20 IF var.1 is  v.1_a.4 and var.2 is v.2_a.13 THEN var.3  is c.13
21 IF var.1 is  v.1_a.8 and var.2 is  v.2_a.8 THEN var.3  is  c.8
22 IF var.1 is  v.1_a.5 and var.2 is v.2_a.10 THEN var.3  is c.11
23 IF var.1 is  v.1_a.4 and var.2 is  v.2_a.9 THEN var.3  is c.11
24 IF var.1 is  v.1_a.7 and var.2 is v.2_a.10 THEN var.3  is  c.9
25 IF var.1 is  v.1_a.8 and var.2 is v.2_a.10 THEN var.3  is  c.9
26 IF var.1 is v.1_a.13 and var.2 is  v.2_a.3 THEN var.3  is  c.3
27 IF var.1 is v.1_a.10 and var.2 is  v.2_a.6 THEN var.3  is  c.5
28 IF var.1 is  v.1_a.5 and var.2 is v.2_a.13 THEN var.3  is c.12
29 IF var.1 is v.1_a.12 and var.2 is  v.2_a.4 THEN var.3  is  c.4
30 IF var.1 is  v.1_a.1 and var.2 is v.2_a.14 THEN var.3  is c.15
31 IF var.1 is  v.1_a.9 and var.2 is  v.2_a.8 THEN var.3  is  c.7
32 IF var.1 is  v.1_a.7 and var.2 is  v.2_a.7 THEN var.3  is  c.8
33 IF var.1 is  v.1_a.6 and var.2 is  v.2_a.8 THEN var.3  is  c.9
34 IF var.1 is  v.1_a.7 and var.2 is  v.2_a.6 THEN var.3  is  c.7
35 IF var.1 is v.1_a.12 and var.2 is  v.2_a.3 THEN var.3  is  c.3
36 IF var.1 is v.1_a.15 and var.2 is  v.2_a.2 THEN var.3  is  c.1
37 IF var.1 is  v.1_a.9 and var.2 is  v.2_a.8 THEN var.3  is  c.8
38 IF var.1 is  v.1_a.6 and var.2 is v.2_a.11 THEN var.3  is c.11
39 IF var.1 is  v.1_a.3 and var.2 is v.2_a.15 THEN var.3  is c.15
40 IF var.1 is  v.1_a.7 and var.2 is  v.2_a.8 THEN var.3  is  c.8
41 IF var.1 is v.1_a.11 and var.2 is  v.2_a.6 THEN var.3  is  c.6
42 IF var.1 is  v.1_a.7 and var.2 is  v.2_a.8 THEN var.3  is  c.9
43 IF var.1 is  v.1_a.8 and var.2 is  v.2_a.9 THEN var.3  is  c.9
44 IF var.1 is  v.1_a.3 and var.2 is v.2_a.12 THEN var.3  is c.13
45 IF var.1 is  v.1_a.3 and var.2 is v.2_a.13 THEN var.3  is c.13
46 IF var.1 is  v.1_a.2 and var.2 is v.2_a.11 THEN var.3  is c.13
47 IF var.1 is  v.1_a.1 and var.2 is v.2_a.13 THEN var.3  is c.14
48 IF var.1 is  v.1_a.2 and var.2 is v.2_a.13 THEN var.3  is c.14
49 IF var.1 is v.1_a.11 and var.2 is  v.2_a.3 THEN var.3  is  c.4
50 IF var.1 is  v.1_a.5 and var.2 is  v.2_a.9 THEN var.3  is c.10
51 IF var.1 is v.1_a.11 and var.2 is  v.2_a.5 THEN var.3  is  c.4
52 IF var.1 is v.1_a.11 and var.2 is  v.2_a.4 THEN var.3  is  c.4
53 IF var.1 is  v.1_a.9 and var.2 is  v.2_a.6 THEN var.3  is  c.7
54 IF var.1 is  v.1_a.7 and var.2 is  v.2_a.6 THEN var.3  is  c.8
55 IF var.1 is  v.1_a.2 and var.2 is v.2_a.14 THEN var.3  is c.15
56 IF var.1 is v.1_a.10 and var.2 is  v.2_a.7 THEN var.3  is  c.7
57 IF var.1 is v.1_a.10 and var.2 is  v.2_a.7 THEN var.3  is  c.6
58 IF var.1 is v.1_a.11 and var.2 is  v.2_a.7 THEN var.3  is  c.6
59 IF var.1 is  v.1_a.6 and var.2 is  v.2_a.9 THEN var.3  is c.10
60 IF var.1 is v.1_a.13 and var.2 is  v.2_a.4 THEN var.3  is  c.3
61 IF var.1 is v.1_a.14 and var.2 is  v.2_a.1 THEN var.3  is  c.1
62 IF var.1 is v.1_a.13 and var.2 is  v.2_a.1 THEN var.3  is  c.2
63 IF var.1 is  v.1_a.3 and var.2 is v.2_a.11 THEN var.3  is c.12
64 IF var.1 is  v.1_a.3 and var.2 is v.2_a.12 THEN var.3  is c.12
65 IF var.1 is  v.1_a.6 and var.2 is v.2_a.12 THEN var.3  is c.11
66 IF var.1 is v.1_a.10 and var.2 is  v.2_a.4 THEN var.3  is  c.4
67 IF var.1 is  v.1_a.8 and var.2 is  v.2_a.7 THEN var.3  is  c.8
68 IF var.1 is  v.1_a.9 and var.2 is  v.2_a.9 THEN var.3  is  c.8
69 IF var.1 is v.1_a.12 and var.2 is  v.2_a.5 THEN var.3  is  c.5
70 IF var.1 is  v.1_a.6 and var.2 is v.2_a.10 THEN var.3  is c.10
71 IF var.1 is  v.1_a.3 and var.2 is v.2_a.10 THEN var.3  is c.13
72 IF var.1 is  v.1_a.8 and var.2 is  v.2_a.5 THEN var.3  is  c.6
73 IF var.1 is v.1_a.12 and var.2 is  v.2_a.2 THEN var.3  is  c.3
74 IF var.1 is  v.1_a.9 and var.2 is  v.2_a.5 THEN var.3  is  c.5
75 IF var.1 is  v.1_a.5 and var.2 is  v.2_a.8 THEN var.3  is c.10
76 IF var.1 is  v.1_a.9 and var.2 is  v.2_a.3 THEN var.3  is  c.5
77 IF var.1 is v.1_a.12 and var.2 is  v.2_a.6 THEN var.3  is  c.5
78 IF var.1 is  v.1_a.6 and var.2 is v.2_a.12 THEN var.3  is c.12
79 IF var.1 is v.1_a.11 and var.2 is  v.2_a.3 THEN var.3  is  c.3
80 IF var.1 is  v.1_a.8 and var.2 is v.2_a.11 THEN var.3  is c.10
81 IF var.1 is  v.1_a.9 and var.2 is  v.2_a.7 THEN var.3  is  c.6
82 IF var.1 is  v.1_a.8 and var.2 is v.2_a.11 THEN var.3  is  c.9
83 IF var.1 is  v.1_a.5 and var.2 is  v.2_a.9 THEN var.3  is  c.9
84 IF var.1 is v.1_a.10 and var.2 is  v.2_a.5 THEN var.3  is  c.6
85 IF var.1 is  v.1_a.6 and var.2 is v.2_a.11 THEN var.3  is c.10
86 IF var.1 is  v.1_a.5 and var.2 is v.2_a.12 THEN var.3  is c.11
87 IF var.1 is v.1_a.15 and var.2 is  v.2_a.4 THEN var.3  is  c.2
88 IF var.1 is  v.1_a.9 and var.2 is  v.2_a.6 THEN var.3  is  c.6
89 IF var.1 is  v.1_a.3 and var.2 is v.2_a.15 THEN var.3  is c.14
90 IF var.1 is  v.1_a.7 and var.2 is v.2_a.12 THEN var.3  is c.11
91 IF var.1 is v.1_a.12 and var.2 is  v.2_a.4 THEN var.3  is  c.3
92 IF var.1 is  v.1_a.5 and var.2 is  v.2_a.9 THEN var.3  is c.11
93 IF var.1 is v.1_a.10 and var.2 is v.2_a.10 THEN var.3  is  c.8
94 IF var.1 is  v.1_a.9 and var.2 is  v.2_a.4 THEN var.3  is  c.5
95 IF var.1 is  v.1_a.4 and var.2 is v.2_a.14 THEN var.3  is c.13
96 IF var.1 is v.1_a.12 and var.2 is  v.2_a.5 THEN var.3  is  c.4
> 
> ## Plot the membership functions
> plotMF(object.reg)
> 
> ##################################
> ## II. Classification Problem
> ## In this example, we are using the iris dataset that
> ## contains four input and one output variables.
> ##################################
> 
> ## Input data: Using the Iris dataset
> data(iris)
> set.seed(2)
> 
> ## Shuffle the data
> ## then split the data to be training and testing datasets
> irisShuffled <- iris[sample(nrow(iris)), ]
> irisShuffled[, 5] <- unclass(irisShuffled[, 5])
> tra.iris <- irisShuffled[1 : 105, ]
> tst.iris <- irisShuffled[106 : nrow(irisShuffled), 1 : 4]
> real.iris <- matrix(irisShuffled[106 : nrow(irisShuffled), 5], ncol = 1)
> 
> ## Define range of input data. Note that it is only for the input variables.
> range.data.input <- apply(iris[, -ncol(iris)], 2, range)
> 
> ## Set the method and its parameters. In this case we use FRBCS.W algorithm
> method.type <- "FRBCS.W"
> control <- list(num.labels = 7, type.mf = "GAUSSIAN", type.tnorm = "MIN",
+                type.snorm = "MAX", type.implication.func = "ZADEH")
> 
> ## Learning step: Generate fuzzy model
> object.cls <- frbs.learn(tra.iris, range.data.input, method.type, control)
> 
> ## Predicting step: Predict newdata
> res.test <- predict(object.cls, tst.iris)
> 
> ## Display the FRBS model
> summary(object.cls)
The name of model:  sim-0 
Model was trained using:  FRBCS.W 
The names of attributes:  Sepal.Length Sepal.Width Petal.Length Petal.Width Species 
The interval of input data:  
    Sepal.Length Sepal.Width Petal.Length Petal.Width
min          4.3         2.0          1.0         0.1
max          7.9         4.4          6.9         2.5
Type of FRBS model: 
[1] "FRBCS"
Type of membership functions: 
[1] "GAUSSIAN"
Type of t-norm method: 
[1] "Standard t-norm (min)"
Type of s-norm method: 
[1] "Standard s-norm"
Type of implication function: 
[1] "ZADEH"
The names of linguistic terms on the input variables:  
 [1] "vv.small" "v.small"  "small"    "medium"   "large"    "v.large" 
 [7] "vv.large" "vv.small" "v.small"  "small"    "medium"   "large"   
[13] "v.large"  "vv.large" "vv.small" "v.small"  "small"    "medium"  
[19] "large"    "v.large"  "vv.large" "vv.small" "v.small"  "small"   
[25] "medium"   "large"    "v.large"  "vv.large"
The parameter values of membership function on the input variable (normalized):  
       vv.small    v.small      small     medium      large    v.large
[1,] 5.00000000 5.00000000 5.00000000 5.00000000 5.00000000 5.00000000
[2,] 0.00000000 0.16666667 0.33333333 0.50000000 0.66666667 0.83333333
[3,] 0.05833333 0.05833333 0.05833333 0.05833333 0.05833333 0.05833333
[4,]         NA         NA         NA         NA         NA         NA
[5,]         NA         NA         NA         NA         NA         NA
       vv.large   vv.small    v.small      small     medium      large
[1,] 5.00000000 5.00000000 5.00000000 5.00000000 5.00000000 5.00000000
[2,] 1.00000000 0.00000000 0.16666667 0.33333333 0.50000000 0.66666667
[3,] 0.05833333 0.05833333 0.05833333 0.05833333 0.05833333 0.05833333
[4,]         NA         NA         NA         NA         NA         NA
[5,]         NA         NA         NA         NA         NA         NA
        v.large   vv.large   vv.small    v.small      small     medium
[1,] 5.00000000 5.00000000 5.00000000 5.00000000 5.00000000 5.00000000
[2,] 0.83333333 1.00000000 0.00000000 0.16666667 0.33333333 0.50000000
[3,] 0.05833333 0.05833333 0.05833333 0.05833333 0.05833333 0.05833333
[4,]         NA         NA         NA         NA         NA         NA
[5,]         NA         NA         NA         NA         NA         NA
          large    v.large   vv.large   vv.small    v.small      small
[1,] 5.00000000 5.00000000 5.00000000 5.00000000 5.00000000 5.00000000
[2,] 0.66666667 0.83333333 1.00000000 0.00000000 0.16666667 0.33333333
[3,] 0.05833333 0.05833333 0.05833333 0.05833333 0.05833333 0.05833333
[4,]         NA         NA         NA         NA         NA         NA
[5,]         NA         NA         NA         NA         NA         NA
         medium      large    v.large   vv.large
[1,] 5.00000000 5.00000000 5.00000000 5.00000000
[2,] 0.50000000 0.66666667 0.83333333 1.00000000
[3,] 0.05833333 0.05833333 0.05833333 0.05833333
[4,]         NA         NA         NA         NA
[5,]         NA         NA         NA         NA
The number of linguistic terms on each variables 
     Sepal.Length Sepal.Width Petal.Length Petal.Width Species
[1,]            7           7            7           7       3
The fuzzy IF-THEN rules:  
   V1           V2 V3       V4  V5          V6 V7       V8  V9          V10 V11
1  IF Sepal.Length is    large and Sepal.Width is   medium and Petal.Length  is
2  IF Sepal.Length is   medium and Sepal.Width is    small and Petal.Length  is
3  IF Sepal.Length is   medium and Sepal.Width is    small and Petal.Length  is
4  IF Sepal.Length is    small and Sepal.Width is    small and Petal.Length  is
5  IF Sepal.Length is  v.small and Sepal.Width is   medium and Petal.Length  is
6  IF Sepal.Length is  v.large and Sepal.Width is   medium and Petal.Length  is
7  IF Sepal.Length is   medium and Sepal.Width is    small and Petal.Length  is
8  IF Sepal.Length is    large and Sepal.Width is  v.small and Petal.Length  is
9  IF Sepal.Length is    small and Sepal.Width is  v.small and Petal.Length  is
10 IF Sepal.Length is    small and Sepal.Width is  v.large and Petal.Length  is
11 IF Sepal.Length is    small and Sepal.Width is  v.large and Petal.Length  is
12 IF Sepal.Length is   medium and Sepal.Width is   medium and Petal.Length  is
13 IF Sepal.Length is   medium and Sepal.Width is   medium and Petal.Length  is
14 IF Sepal.Length is  v.small and Sepal.Width is   medium and Petal.Length  is
15 IF Sepal.Length is    small and Sepal.Width is    small and Petal.Length  is
16 IF Sepal.Length is  v.small and Sepal.Width is  v.small and Petal.Length  is
17 IF Sepal.Length is    large and Sepal.Width is    small and Petal.Length  is
18 IF Sepal.Length is  v.small and Sepal.Width is   medium and Petal.Length  is
19 IF Sepal.Length is  v.small and Sepal.Width is    large and Petal.Length  is
20 IF Sepal.Length is  v.large and Sepal.Width is    small and Petal.Length  is
21 IF Sepal.Length is  v.small and Sepal.Width is    large and Petal.Length  is
22 IF Sepal.Length is    small and Sepal.Width is    large and Petal.Length  is
23 IF Sepal.Length is    large and Sepal.Width is    small and Petal.Length  is
24 IF Sepal.Length is    small and Sepal.Width is    small and Petal.Length  is
25 IF Sepal.Length is    large and Sepal.Width is   medium and Petal.Length  is
26 IF Sepal.Length is   medium and Sepal.Width is  v.small and Petal.Length  is
27 IF Sepal.Length is    large and Sepal.Width is    small and Petal.Length  is
28 IF Sepal.Length is    small and Sepal.Width is  v.large and Petal.Length  is
29 IF Sepal.Length is   medium and Sepal.Width is   medium and Petal.Length  is
30 IF Sepal.Length is   medium and Sepal.Width is  v.small and Petal.Length  is
31 IF Sepal.Length is    small and Sepal.Width is    small and Petal.Length  is
32 IF Sepal.Length is    large and Sepal.Width is   medium and Petal.Length  is
33 IF Sepal.Length is  v.large and Sepal.Width is    small and Petal.Length  is
34 IF Sepal.Length is    large and Sepal.Width is   medium and Petal.Length  is
35 IF Sepal.Length is  v.small and Sepal.Width is    large and Petal.Length  is
36 IF Sepal.Length is   medium and Sepal.Width is    small and Petal.Length  is
37 IF Sepal.Length is    large and Sepal.Width is   medium and Petal.Length  is
38 IF Sepal.Length is vv.large and Sepal.Width is    large and Petal.Length  is
39 IF Sepal.Length is  v.small and Sepal.Width is    small and Petal.Length  is
40 IF Sepal.Length is   medium and Sepal.Width is  v.small and Petal.Length  is
41 IF Sepal.Length is    small and Sepal.Width is  v.large and Petal.Length  is
42 IF Sepal.Length is    large and Sepal.Width is    small and Petal.Length  is
43 IF Sepal.Length is    large and Sepal.Width is    small and Petal.Length  is
44 IF Sepal.Length is    small and Sepal.Width is  v.small and Petal.Length  is
45 IF Sepal.Length is vv.large and Sepal.Width is    small and Petal.Length  is
46 IF Sepal.Length is vv.small and Sepal.Width is    large and Petal.Length  is
47 IF Sepal.Length is vv.small and Sepal.Width is    small and Petal.Length  is
48 IF Sepal.Length is  v.small and Sepal.Width is  v.small and Petal.Length  is
49 IF Sepal.Length is vv.small and Sepal.Width is   medium and Petal.Length  is
50 IF Sepal.Length is    small and Sepal.Width is   medium and Petal.Length  is
51 IF Sepal.Length is  v.small and Sepal.Width is  v.small and Petal.Length  is
52 IF Sepal.Length is   medium and Sepal.Width is  v.small and Petal.Length  is
53 IF Sepal.Length is   medium and Sepal.Width is  v.small and Petal.Length  is
54 IF Sepal.Length is    small and Sepal.Width is   medium and Petal.Length  is
55 IF Sepal.Length is    small and Sepal.Width is    small and Petal.Length  is
56 IF Sepal.Length is vv.large and Sepal.Width is    large and Petal.Length  is
57 IF Sepal.Length is    small and Sepal.Width is    small and Petal.Length  is
58 IF Sepal.Length is    small and Sepal.Width is   medium and Petal.Length  is
59 IF Sepal.Length is  v.small and Sepal.Width is    small and Petal.Length  is
60 IF Sepal.Length is   medium and Sepal.Width is    small and Petal.Length  is
61 IF Sepal.Length is  v.small and Sepal.Width is vv.small and Petal.Length  is
62 IF Sepal.Length is vv.small and Sepal.Width is   medium and Petal.Length  is
63 IF Sepal.Length is    large and Sepal.Width is   medium and Petal.Length  is
        V12 V13         V14 V15      V16  V17     V18 V19 V20
1   v.large and Petal.Width  is vv.large THEN Species  is   3
2     large and Petal.Width  is    large THEN Species  is   2
3     large and Petal.Width  is   medium THEN Species  is   2
4     large and Petal.Width  is  v.large THEN Species  is   3
5  vv.small and Petal.Width  is vv.small THEN Species  is   1
6   v.large and Petal.Width  is    large THEN Species  is   3
7     large and Petal.Width  is    large THEN Species  is   3
8   v.large and Petal.Width  is    large THEN Species  is   3
9    medium and Petal.Width  is    small THEN Species  is   2
10  v.small and Petal.Width  is  v.small THEN Species  is   1
11 vv.small and Petal.Width  is  v.small THEN Species  is   1
12  v.large and Petal.Width  is vv.large THEN Species  is   3
13    large and Petal.Width  is    large THEN Species  is   2
14  v.small and Petal.Width  is  v.small THEN Species  is   1
15   medium and Petal.Width  is   medium THEN Species  is   2
16    small and Petal.Width  is    small THEN Species  is   2
17    large and Petal.Width  is   medium THEN Species  is   2
18  v.small and Petal.Width  is vv.small THEN Species  is   1
19  v.small and Petal.Width  is  v.small THEN Species  is   1
20  v.large and Petal.Width  is    large THEN Species  is   3
21 vv.small and Petal.Width  is vv.small THEN Species  is   1
22  v.small and Petal.Width  is vv.small THEN Species  is   1
23  v.large and Petal.Width  is  v.large THEN Species  is   3
24    large and Petal.Width  is    large THEN Species  is   2
25  v.large and Petal.Width  is    large THEN Species  is   3
26    large and Petal.Width  is    large THEN Species  is   3
27    large and Petal.Width  is    large THEN Species  is   2
28 vv.small and Petal.Width  is vv.small THEN Species  is   1
29    large and Petal.Width  is  v.large THEN Species  is   3
30    large and Petal.Width  is  v.large THEN Species  is   3
31    large and Petal.Width  is   medium THEN Species  is   2
32    large and Petal.Width  is  v.large THEN Species  is   3
33  v.large and Petal.Width  is  v.large THEN Species  is   3
34    large and Petal.Width  is    large THEN Species  is   2
35  v.small and Petal.Width  is vv.small THEN Species  is   1
36   medium and Petal.Width  is    large THEN Species  is   2
37  v.large and Petal.Width  is  v.large THEN Species  is   3
38 vv.large and Petal.Width  is  v.large THEN Species  is   3
39 vv.small and Petal.Width  is vv.small THEN Species  is   1
40    large and Petal.Width  is    large THEN Species  is   2
41  v.small and Petal.Width  is vv.small THEN Species  is   1
42   medium and Petal.Width  is   medium THEN Species  is   2
43  v.large and Petal.Width  is    large THEN Species  is   3
44   medium and Petal.Width  is   medium THEN Species  is   2
45  v.large and Petal.Width  is  v.large THEN Species  is   3
46 vv.small and Petal.Width  is vv.small THEN Species  is   1
47 vv.small and Petal.Width  is vv.small THEN Species  is   1
48    large and Petal.Width  is    large THEN Species  is   3
49  v.small and Petal.Width  is vv.small THEN Species  is   1
50 vv.small and Petal.Width  is vv.small THEN Species  is   1
51    small and Petal.Width  is   medium THEN Species  is   2
52   medium and Petal.Width  is   medium THEN Species  is   2
53   medium and Petal.Width  is    small THEN Species  is   2
54  v.small and Petal.Width  is vv.small THEN Species  is   1
55    large and Petal.Width  is vv.large THEN Species  is   3
56  v.large and Petal.Width  is  v.large THEN Species  is   3
57   medium and Petal.Width  is    small THEN Species  is   2
58  v.small and Petal.Width  is  v.small THEN Species  is   1
59  v.small and Petal.Width  is vv.small THEN Species  is   1
60  v.large and Petal.Width  is   medium THEN Species  is   3
61   medium and Petal.Width  is    small THEN Species  is   2
62 vv.small and Petal.Width  is vv.small THEN Species  is   1
63   medium and Petal.Width  is   medium THEN Species  is   2
The certainty factor: 
               
 [1,] 0.5309169
 [2,] 0.5121273
 [3,] 0.5121273
 [4,] 0.5309169
 [5,] 0.4569558
 [6,] 0.5309169
 [7,] 0.5309169
 [8,] 0.5309169
 [9,] 0.5121273
[10,] 0.4569558
[11,] 0.4569558
[12,] 0.5309169
[13,] 0.5121273
[14,] 0.4569558
[15,] 0.5121273
[16,] 0.5121273
[17,] 0.5121273
[18,] 0.4569558
[19,] 0.4569558
[20,] 0.5309169
[21,] 0.4569558
[22,] 0.4569558
[23,] 0.5309169
[24,] 0.5121273
[25,] 0.5309169
[26,] 0.5309169
[27,] 0.5121273
[28,] 0.4569558
[29,] 0.5309169
[30,] 0.5309169
[31,] 0.5121273
[32,] 0.5309169
[33,] 0.5309169
[34,] 0.5121273
[35,] 0.4569558
[36,] 0.5121273
[37,] 0.5309169
[38,] 0.5309169
[39,] 0.4569558
[40,] 0.5121273
[41,] 0.4569558
[42,] 0.5121273
[43,] 0.5309169
[44,] 0.5121273
[45,] 0.5309169
[46,] 0.4569558
[47,] 0.4569558
[48,] 0.5309169
[49,] 0.4569558
[50,] 0.4569558
[51,] 0.5121273
[52,] 0.5121273
[53,] 0.5121273
[54,] 0.4569558
[55,] 0.5309169
[56,] 0.5309169
[57,] 0.5121273
[58,] 0.4569558
[59,] 0.4569558
[60,] 0.5309169
[61,] 0.5121273
[62,] 0.4569558
[63,] 0.5121273
> 
> ## Plot the membership functions
> plotMF(object.cls)
> 
> #################################################
> ## III. Constructing an FRBS model from human expert.
> ## In this example, we only consider the Mamdani model for regression. However,
> ## other models can be done in the same way.
> ## Note:
> ## In the examples, let us consider four input and one output variables.
> #################################################
> 
> ## Define a matrix representing shape and parameters of membership functions of input variables.
> ## The matrix has 5 rows where the first row represent the type of the membership function whereas
> ## others are values of its parameters.
> ## Detailed explanation can be seen in the fuzzifier function to construct the matrix.
> varinp.mf <- matrix(c(2, 0, 20, 40, NA, 4, 20, 40, 60, 80, 3, 60, 80, 100, NA,
+                       2, 0, 35, 75, NA, 3, 35, 75, 100, NA,
+                       2, 0, 20, 40, NA, 1, 20, 50, 80, NA, 3, 60, 80, 100, NA,
+                       2, 0, 20, 40, NA, 4, 20, 40, 60, 80, 3, 60, 80, 100, NA),
+                       nrow = 5, byrow = FALSE)
> 
> ## Define number of linguistic terms of input variables.
> ## Suppose, we have 3, 2, 3, and 3 numbers of linguistic terms
> ## for the first, second, third and fourth variables, respectively.
> num.fvalinput <- matrix(c(3, 2, 3, 3), nrow=1)
> 
> ## Give the names of the linguistic terms of each input variables.
> varinput.1 <- c("low", "medium", "high")
> varinput.2 <- c("yes", "no")
> varinput.3 <- c("bad", "neutral", "good")
> varinput.4 <- c("low", "medium", "high")
> names.varinput <- c(varinput.1, varinput.2, varinput.3, varinput.4)
> 
> ## Set interval of data.
> range.data <- matrix(c(0, 100, 0, 100, 0, 100, 0, 100, 0, 100), nrow = 2)
> 
> ## Define inference parameters.
> ## Detailed information about values can be seen in the inference function.
> type.defuz <- "WAM"
> type.tnorm <- "MIN"
> type.snorm <- "MAX"
> type.implication.func <- "ZADEH"
> 
> ## Give the name of simulation.
> name <- "Sim-0"
> 
> ## Provide new data for testing.
> newdata<- matrix(c(25, 40, 35, 15, 45, 75, 78, 70), nrow = 2, byrow = TRUE)
> ## the names of variables
> colnames.var <- c("input1", "input2", "input3", "input4", "output1")
> 
> ## Define number of linguistic terms of output variable.
> ## In this case, we set the number of linguistic terms to 3.
> num.fvaloutput <- matrix(c(3), nrow = 1)
> 
> ## Give the names of the linguistic terms of the output variable.
> varoutput.1 <- c("bad", "neutral", "good")
> names.varoutput <- c(varoutput.1)
> 
> ## Define the shapes and parameters of the membership functions of the output variables.
> varout.mf <- matrix(c(2, 0, 20, 40, NA, 4, 20, 40, 60, 80, 3, 60, 80, 100, NA),
+                       nrow = 5, byrow = FALSE)
> 
> ## Set type of model which is "MAMDANI".
> type.model <- "MAMDANI"
> 
> ## Define the fuzzy IF-THEN rules;
> ## In this example we are using the Mamdani model
> ## Note: e.g.,
> ## "a1", "and", "b1, "->", "e1" means that
> ## "IF inputvar.1 is a1 and inputvar.2 is b1 THEN outputvar.1 is e1"
> ## Make sure that each rule has a "->" sign.
> rule <- matrix(
+   c("low", "and", "yes", "and", "bad", "and", "low", "->", "bad",
+     "medium", "and", "no", "and", "neutral", "and", "medium", "->", "neutral",
+     "high", "and", "no", "and", "neutral", "and", "low", "->", "good"),
+     nrow = 3, byrow = TRUE)
> 
> ## Generate a fuzzy model with frbs.gen.
> object <- frbs.gen(range.data, num.fvalinput, names.varinput,
+                  num.fvaloutput, varout.mf, names.varoutput, rule,
+                  varinp.mf, type.model, type.defuz, type.tnorm,
+                  type.snorm, func.tsk = NULL, colnames.var, type.implication.func, name)
> 
> ## Plot the membership function.
> plotMF(object)
> 
> ## Predicting using new data.
> res <- predict(object, newdata)$predicted.val
> 
> #################################################
> ## IV. Specifying an FRBS model in the frbsPMML format.
> ## other examples can be seen in the frbsPMML function.
> #################################################
> ## Input data
> data(frbsData)
> data.train <- frbsData$GasFurnance.dt[1 : 204, ]
> data.fit <- data.train[, 1 : 2]
> data.tst <- frbsData$GasFurnance.dt[205 : 292, 1 : 2]
> real.val <- matrix(frbsData$GasFurnance.dt[205 : 292, 3], ncol = 1)
> range.data<-matrix(c(-2.716, 2.834, 45.6, 60.5, 45.6, 60.5), nrow = 2)
> 
> ## Set the method and its parameters
> method.type <- "WM"
> control <- list(num.labels = 3, type.mf = "GAUSSIAN", type.defuz = "WAM",
+                 type.tnorm = "MIN", type.snorm = "MAX",
+                 type.implication.func = "ZADEH", name="sim-0")
> 
> ## Generate fuzzy model
> object <- frbs.learn(data.train, range.data, method.type, control)
> 
> ## 2. Constructing the frbsPMML format
> frbsPMML(object)
Error: .onLoad failed in loadNamespace() for 'XML', details:
  call: dyn.load(file, DLLpath = DLLpath, ...)
  error: unable to load shared object '/home/hornik/tmp/R.check/r-patched-gcc/Work/build/Packages/XML/libs/XML.so':
  /home/hornik/tmp/R.check/r-patched-gcc/Work/build/Packages/XML/libs/XML.so: failed to map segment from shared object
Execution halted