CRAN Package Check Results for Package anfis

Last updated on 2020-02-19 10:48:46 CET.

Flavor Version Tinstall Tcheck Ttotal Status Flags
r-devel-linux-x86_64-debian-clang 0.99.1 6.67 35.14 41.81 ERROR
r-devel-linux-x86_64-debian-gcc 0.99.1 6.28 28.14 34.42 ERROR
r-devel-linux-x86_64-fedora-clang 0.99.1 51.21 ERROR
r-devel-linux-x86_64-fedora-gcc 0.99.1 51.19 ERROR
r-devel-windows-ix86+x86_64 0.99.1 13.00 51.00 64.00 NOTE
r-devel-windows-ix86+x86_64-gcc8 0.99.1 17.00 68.00 85.00 NOTE
r-patched-linux-x86_64 0.99.1 5.70 30.88 36.58 NOTE
r-patched-solaris-x86 0.99.1 69.40 NOTE
r-release-linux-x86_64 0.99.1 5.69 30.51 36.20 NOTE
r-release-windows-ix86+x86_64 0.99.1 11.00 70.00 81.00 NOTE
r-release-osx-x86_64 0.99.1 NOTE
r-oldrel-windows-ix86+x86_64 0.99.1 9.00 45.00 54.00 NOTE
r-oldrel-osx-x86_64 0.99.1 NOTE

Check Details

Version: 0.99.1
Check: R code for possible problems
Result: NOTE
    plot,ANFIS: no visible binding for global variable 'X'
    plotMF,ANFIS : <anonymous>: no visible global function definition for
     'lines'
    plotMFs,ANFIS: no visible global function definition for 'par'
    Undefined global functions or variables:
     X lines par
    Consider adding
     importFrom("graphics", "lines", "par")
    to your NAMESPACE file.
Flavors: r-devel-linux-x86_64-debian-clang, r-devel-linux-x86_64-debian-gcc, r-devel-linux-x86_64-fedora-clang, r-devel-linux-x86_64-fedora-gcc, r-devel-windows-ix86+x86_64, r-devel-windows-ix86+x86_64-gcc8, r-patched-linux-x86_64, r-patched-solaris-x86, r-release-linux-x86_64, r-release-windows-ix86+x86_64, r-release-osx-x86_64, r-oldrel-windows-ix86+x86_64, r-oldrel-osx-x86_64

Version: 0.99.1
Check: examples
Result: ERROR
    Running examples in 'anfis-Ex.R' failed
    The error most likely occurred in:
    
    > base::assign(".ptime", proc.time(), pos = "CheckExEnv")
    > ### Name: ANFIS-class
    > ### Title: ANFIS S4 class implementation in R
    > ### Aliases: ANFIS-class
    >
    > ### ** Examples
    >
    > ##Set 2 cores using global options for parallel library
    > require("parallel")
    > if(.Platform$OS.type == "windows"){
    + options(mc.cores=1)
    + }else{
    + options(mc.cores=2) ##You could use all calling detectCores()
    + }
    >
    > ##Example domain for bidimentional sinc(x,y) function
    > x <- seq(-10, 10, length= 11)
    > trainingSet <- trainSet(x,x)
    > Z <- matrix(trainingSet[,"z"],ncol=length(x),nrow=length(x))
    > persp(x,x,Z,theta = 45, phi = 15, expand = 0.8, col = "lightblue",
    + ticktype="detailed",main="sinc(x)*sinc(y)")
    >
    > ##Training domain patterns
    > X <- trainingSet[,1:2]
    > Y <- trainingSet[,3,drop=FALSE]
    >
    > ##Defining the required MembershipFunctions for the ANFIS
    > membershipFunction<-list(
    + x=c(new(Class="NormalizedGaussianMF",parameters=c(mu=-10,sigma=2)),
    + new(Class="NormalizedGaussianMF",parameters=c(mu=-5,sigma=2)),
    + new(Class="NormalizedGaussianMF",parameters=c(mu=0,sigma=2)),
    + new(Class="NormalizedGaussianMF",parameters=c(mu=5,sigma=2)),
    + new(Class="NormalizedGaussianMF",parameters=c(mu=10,sigma=2))),
    + y=c(new(Class="NormalizedGaussianMF",parameters=c(mu=-10,sigma=2)),
    + new(Class="NormalizedGaussianMF",parameters=c(mu=-5,sigma=2)),
    + new(Class="NormalizedGaussianMF",parameters=c(mu=0,sigma=2)),
    + new(Class="NormalizedGaussianMF",parameters=c(mu=5,sigma=2)),
    + new(Class="NormalizedGaussianMF",parameters=c(mu=10,sigma=2))))
    >
    > ##Creating the ANFIS network with 2 inputs and 4 MembershipFunctions in
    > ##each input
    > anfis3 <- new(Class="ANFIS",X,Y,membershipFunction)
    > anfis3
    ANFIS network
    Trainning Set:
     dim(x)= 121x2
     dim(y)= 121x1
    Arquitecture: 2 ( 5x5 ) - 25 - 75 ( 75x1 ) - 1
    Network not trained yet
    >
    > ##Check for epsilon-completeness in each input
    > plotMFs(anfis3)
    >
    > ##Training the ANFIS network.
    > ##We will use instead an already trained object to reduce example time.
    > data(anfis3)
    >
    > ##How the training went. You can keep on training as the training error
    > ##is still descending.
    > plot(anfis3)
    >
    > ##Test the fit, i. e., how the MembershipFunctions partition the input space
    > plotMFs(anfis3)
    >
    > ##Just to see if premises, consequents and errors were updated
    > getPremises(anfis3)[[input=1]][[mf=1]]
    MembershipFunction: Normalized Gaussian Membership Function
    Number of parameters: 2
     mu sigma
    -9.984987 2.038630
    Expression: expression(exp(-1/2 * ((x - mu)/sigma)^2))
    > getConsequents(anfis3)[1:2,]
    [1] 0.005011691 0.005011691
    > getErrors(anfis3) #Training errors
     [1] 0.03741022 0.03238312 0.02992609 0.02866609 0.02759035 0.02661405
     [7] 0.02569998 0.02482807 0.02398628 0.02316705 0.02271256 0.02224352
    [13] 0.02176043 0.02126397 0.02075495 0.02023433 0.01970327 0.01916307
    > getTrainingType(anfis3)
    [1] "trainHybridJangOffLine"
    > names(coef(anfis3))
    [1] "premises" "consequents"
    > ##An alternative to get premises and/or consequents ...
    > coef(anfis3)$premises[[input=1]][[mf=1]]
    MembershipFunction: Normalized Gaussian Membership Function
    Number of parameters: 2
     mu sigma
    -9.984987 2.038630
    Expression: expression(exp(-1/2 * ((x - mu)/sigma)^2))
    > coef(anfis3)$consequents[1:2,]
    [1] 0.005011691 0.005011691
    >
    > ##First five train pattern associated values for the training process
    > fitted(anfis3)[1:5,]
    [1] -0.008394804 0.007514315 0.012824644 -0.003044622 -0.030125619
    > resid(anfis3)[1:5,]
    [1] 0.011354394 -0.014242212 -0.010291178 0.013337535 0.005391769
    > summary(anfis3)
    ANFIS network
    Trainning Set:
     dim(x)= 121x2
     dim(y)= 121x1
    Arquitecture: 2 ( 5x5 ) - 25 - 75 ( 75x1 ) - 1
    Last training error: 0.01916307
    
    Call: trainHybridJangOffLine(object = anfis3, epochs = 10)
    
    Statistics for Off-line training
     Min. 1st Qu. Median Mean 3rd Qu. Max.
    0.01916 0.02139 0.02358 0.02489 0.02735 0.03741
    >
    > ##Surface comparison between the original training set and the predicted
    > ##ANFIS network
    > y <- predict(anfis3,X)
     ----------- FAILURE REPORT --------------
     --- failure: the condition has length > 1 ---
     --- srcref ---
    :
     --- package (from environment) ---
    anfis
     --- call from context ---
    FUN(X[[i]], ...)
     --- call from argument ---
    if (class(tita_1) == "list") {
     aux <- matrix(NA, nrow = max(sapply(tita_1, length)), ncol = ncol(x))
     invisible(sapply(seq(along = tita_1), function(input) {
     aux[1:length(tita_1[[input]]), input] <<- tita_1[[input]]
     return(NULL)
     }))
     tita_1 <- aux
    }
     --- R stacktrace ---
    where 1: FUN(X[[i]], ...)
    where 2: lapply(1:nrow(x), function(pattern) {
     tita_1 <- sapply(seq(along = object@premises), function(input,
     pattern) {
     unlist(lapply(object@premises[[input]], function(MF) {
     evaluateMF(MF, x[pattern, input])
     }))
     }, pattern)
     if (class(tita_1) == "list") {
     aux <- matrix(NA, nrow = max(sapply(tita_1, length)),
     ncol = ncol(x))
     invisible(sapply(seq(along = tita_1), function(input) {
     aux[1:length(tita_1[[input]]), input] <<- tita_1[[input]]
     return(NULL)
     }))
     tita_1 <- aux
     }
     if (!is.matrix(tita_1)) {
     tita_1 <- t(tita_1)
     }
     w <<- cbind(w, apply(object@rules, 1, function(rule, tita_1) {
     prod(sapply(seq(along = rule), function(input, tita_1) {
     tita_1[rule[input], input]
     }, tita_1))
     }, tita_1))
     wSum <<- c(wSum, sum(w[, pattern]))
     wNormalized <<- cbind(wNormalized, w[, pattern]/wSum[pattern])
     A <<- rbind(A, matrix(matrix(c(x[pattern, ], 1), ncol = 1) %*%
     wNormalized[, pattern], nrow = 1, byrow = FALSE))
     return(NULL)
    })
    where 3: .local(object, ...)
    where 4: predict(anfis3, X)
    where 5: predict(anfis3, X)
    
     --- value of length: 2 type: logical ---
    [1] FALSE FALSE
     --- function from context ---
    function (pattern)
    {
     tita_1 <- sapply(seq(along = object@premises), function(input,
     pattern) {
     unlist(lapply(object@premises[[input]], function(MF) {
     evaluateMF(MF, x[pattern, input])
     }))
     }, pattern)
     if (class(tita_1) == "list") {
     aux <- matrix(NA, nrow = max(sapply(tita_1, length)),
     ncol = ncol(x))
     invisible(sapply(seq(along = tita_1), function(input) {
     aux[1:length(tita_1[[input]]), input] <<- tita_1[[input]]
     return(NULL)
     }))
     tita_1 <- aux
     }
     if (!is.matrix(tita_1)) {
     tita_1 <- t(tita_1)
     }
     w <<- cbind(w, apply(object@rules, 1, function(rule, tita_1) {
     prod(sapply(seq(along = rule), function(input, tita_1) {
     tita_1[rule[input], input]
     }, tita_1))
     }, tita_1))
     wSum <<- c(wSum, sum(w[, pattern]))
     wNormalized <<- cbind(wNormalized, w[, pattern]/wSum[pattern])
     A <<- rbind(A, matrix(matrix(c(x[pattern, ], 1), ncol = 1) %*%
     wNormalized[, pattern], nrow = 1, byrow = FALSE))
     return(NULL)
    }
    <environment: 0x33a1de0>
     --- function search by body ---
     ----------- END OF FAILURE REPORT --------------
    Error in if (class(tita_1) == "list") { : the condition has length > 1
    Calls: predict -> predict -> .local -> lapply -> FUN
    Execution halted
Flavor: r-devel-linux-x86_64-debian-clang

Version: 0.99.1
Check: examples
Result: ERROR
    Running examples in ‘anfis-Ex.R’ failed
    The error most likely occurred in:
    
    > base::assign(".ptime", proc.time(), pos = "CheckExEnv")
    > ### Name: ANFIS-class
    > ### Title: ANFIS S4 class implementation in R
    > ### Aliases: ANFIS-class
    >
    > ### ** Examples
    >
    > ##Set 2 cores using global options for parallel library
    > require("parallel")
    > if(.Platform$OS.type == "windows"){
    + options(mc.cores=1)
    + }else{
    + options(mc.cores=2) ##You could use all calling detectCores()
    + }
    >
    > ##Example domain for bidimentional sinc(x,y) function
    > x <- seq(-10, 10, length= 11)
    > trainingSet <- trainSet(x,x)
    > Z <- matrix(trainingSet[,"z"],ncol=length(x),nrow=length(x))
    > persp(x,x,Z,theta = 45, phi = 15, expand = 0.8, col = "lightblue",
    + ticktype="detailed",main="sinc(x)*sinc(y)")
    >
    > ##Training domain patterns
    > X <- trainingSet[,1:2]
    > Y <- trainingSet[,3,drop=FALSE]
    >
    > ##Defining the required MembershipFunctions for the ANFIS
    > membershipFunction<-list(
    + x=c(new(Class="NormalizedGaussianMF",parameters=c(mu=-10,sigma=2)),
    + new(Class="NormalizedGaussianMF",parameters=c(mu=-5,sigma=2)),
    + new(Class="NormalizedGaussianMF",parameters=c(mu=0,sigma=2)),
    + new(Class="NormalizedGaussianMF",parameters=c(mu=5,sigma=2)),
    + new(Class="NormalizedGaussianMF",parameters=c(mu=10,sigma=2))),
    + y=c(new(Class="NormalizedGaussianMF",parameters=c(mu=-10,sigma=2)),
    + new(Class="NormalizedGaussianMF",parameters=c(mu=-5,sigma=2)),
    + new(Class="NormalizedGaussianMF",parameters=c(mu=0,sigma=2)),
    + new(Class="NormalizedGaussianMF",parameters=c(mu=5,sigma=2)),
    + new(Class="NormalizedGaussianMF",parameters=c(mu=10,sigma=2))))
    >
    > ##Creating the ANFIS network with 2 inputs and 4 MembershipFunctions in
    > ##each input
    > anfis3 <- new(Class="ANFIS",X,Y,membershipFunction)
    > anfis3
    ANFIS network
    Trainning Set:
     dim(x)= 121x2
     dim(y)= 121x1
    Arquitecture: 2 ( 5x5 ) - 25 - 75 ( 75x1 ) - 1
    Network not trained yet
    >
    > ##Check for epsilon-completeness in each input
    > plotMFs(anfis3)
    >
    > ##Training the ANFIS network.
    > ##We will use instead an already trained object to reduce example time.
    > data(anfis3)
    >
    > ##How the training went. You can keep on training as the training error
    > ##is still descending.
    > plot(anfis3)
    >
    > ##Test the fit, i. e., how the MembershipFunctions partition the input space
    > plotMFs(anfis3)
    >
    > ##Just to see if premises, consequents and errors were updated
    > getPremises(anfis3)[[input=1]][[mf=1]]
    MembershipFunction: Normalized Gaussian Membership Function
    Number of parameters: 2
     mu sigma
    -9.984987 2.038630
    Expression: expression(exp(-1/2 * ((x - mu)/sigma)^2))
    > getConsequents(anfis3)[1:2,]
    [1] 0.005011691 0.005011691
    > getErrors(anfis3) #Training errors
     [1] 0.03741022 0.03238312 0.02992609 0.02866609 0.02759035 0.02661405
     [7] 0.02569998 0.02482807 0.02398628 0.02316705 0.02271256 0.02224352
    [13] 0.02176043 0.02126397 0.02075495 0.02023433 0.01970327 0.01916307
    > getTrainingType(anfis3)
    [1] "trainHybridJangOffLine"
    > names(coef(anfis3))
    [1] "premises" "consequents"
    > ##An alternative to get premises and/or consequents ...
    > coef(anfis3)$premises[[input=1]][[mf=1]]
    MembershipFunction: Normalized Gaussian Membership Function
    Number of parameters: 2
     mu sigma
    -9.984987 2.038630
    Expression: expression(exp(-1/2 * ((x - mu)/sigma)^2))
    > coef(anfis3)$consequents[1:2,]
    [1] 0.005011691 0.005011691
    >
    > ##First five train pattern associated values for the training process
    > fitted(anfis3)[1:5,]
    [1] -0.008394804 0.007514315 0.012824644 -0.003044622 -0.030125619
    > resid(anfis3)[1:5,]
    [1] 0.011354394 -0.014242212 -0.010291178 0.013337535 0.005391769
    > summary(anfis3)
    ANFIS network
    Trainning Set:
     dim(x)= 121x2
     dim(y)= 121x1
    Arquitecture: 2 ( 5x5 ) - 25 - 75 ( 75x1 ) - 1
    Last training error: 0.01916307
    
    Call: trainHybridJangOffLine(object = anfis3, epochs = 10)
    
    Statistics for Off-line training
     Min. 1st Qu. Median Mean 3rd Qu. Max.
    0.01916 0.02139 0.02358 0.02489 0.02735 0.03741
    >
    > ##Surface comparison between the original training set and the predicted
    > ##ANFIS network
    > y <- predict(anfis3,X)
     ----------- FAILURE REPORT --------------
     --- failure: the condition has length > 1 ---
     --- srcref ---
    :
     --- package (from environment) ---
    anfis
     --- call from context ---
    FUN(X[[i]], ...)
     --- call from argument ---
    if (class(tita_1) == "list") {
     aux <- matrix(NA, nrow = max(sapply(tita_1, length)), ncol = ncol(x))
     invisible(sapply(seq(along = tita_1), function(input) {
     aux[1:length(tita_1[[input]]), input] <<- tita_1[[input]]
     return(NULL)
     }))
     tita_1 <- aux
    }
     --- R stacktrace ---
    where 1: FUN(X[[i]], ...)
    where 2: lapply(1:nrow(x), function(pattern) {
     tita_1 <- sapply(seq(along = object@premises), function(input,
     pattern) {
     unlist(lapply(object@premises[[input]], function(MF) {
     evaluateMF(MF, x[pattern, input])
     }))
     }, pattern)
     if (class(tita_1) == "list") {
     aux <- matrix(NA, nrow = max(sapply(tita_1, length)),
     ncol = ncol(x))
     invisible(sapply(seq(along = tita_1), function(input) {
     aux[1:length(tita_1[[input]]), input] <<- tita_1[[input]]
     return(NULL)
     }))
     tita_1 <- aux
     }
     if (!is.matrix(tita_1)) {
     tita_1 <- t(tita_1)
     }
     w <<- cbind(w, apply(object@rules, 1, function(rule, tita_1) {
     prod(sapply(seq(along = rule), function(input, tita_1) {
     tita_1[rule[input], input]
     }, tita_1))
     }, tita_1))
     wSum <<- c(wSum, sum(w[, pattern]))
     wNormalized <<- cbind(wNormalized, w[, pattern]/wSum[pattern])
     A <<- rbind(A, matrix(matrix(c(x[pattern, ], 1), ncol = 1) %*%
     wNormalized[, pattern], nrow = 1, byrow = FALSE))
     return(NULL)
    })
    where 3: .local(object, ...)
    where 4: predict(anfis3, X)
    where 5: predict(anfis3, X)
    
     --- value of length: 2 type: logical ---
    [1] FALSE FALSE
     --- function from context ---
    function (pattern)
    {
     tita_1 <- sapply(seq(along = object@premises), function(input,
     pattern) {
     unlist(lapply(object@premises[[input]], function(MF) {
     evaluateMF(MF, x[pattern, input])
     }))
     }, pattern)
     if (class(tita_1) == "list") {
     aux <- matrix(NA, nrow = max(sapply(tita_1, length)),
     ncol = ncol(x))
     invisible(sapply(seq(along = tita_1), function(input) {
     aux[1:length(tita_1[[input]]), input] <<- tita_1[[input]]
     return(NULL)
     }))
     tita_1 <- aux
     }
     if (!is.matrix(tita_1)) {
     tita_1 <- t(tita_1)
     }
     w <<- cbind(w, apply(object@rules, 1, function(rule, tita_1) {
     prod(sapply(seq(along = rule), function(input, tita_1) {
     tita_1[rule[input], input]
     }, tita_1))
     }, tita_1))
     wSum <<- c(wSum, sum(w[, pattern]))
     wNormalized <<- cbind(wNormalized, w[, pattern]/wSum[pattern])
     A <<- rbind(A, matrix(matrix(c(x[pattern, ], 1), ncol = 1) %*%
     wNormalized[, pattern], nrow = 1, byrow = FALSE))
     return(NULL)
    }
    <environment: 0x558a73431470>
     --- function search by body ---
     ----------- END OF FAILURE REPORT --------------
    Error in if (class(tita_1) == "list") { : the condition has length > 1
    Calls: predict -> predict -> .local -> lapply -> FUN
    Execution halted
Flavor: r-devel-linux-x86_64-debian-gcc

Version: 0.99.1
Check: examples
Result: ERROR
    Running examples in ‘anfis-Ex.R’ failed
    The error most likely occurred in:
    
    > ### Name: ANFIS-class
    > ### Title: ANFIS S4 class implementation in R
    > ### Aliases: ANFIS-class
    >
    > ### ** Examples
    >
    > ##Set 2 cores using global options for parallel library
    > require("parallel")
    > if(.Platform$OS.type == "windows"){
    + options(mc.cores=1)
    + }else{
    + options(mc.cores=2) ##You could use all calling detectCores()
    + }
    >
    > ##Example domain for bidimentional sinc(x,y) function
    > x <- seq(-10, 10, length= 11)
    > trainingSet <- trainSet(x,x)
    > Z <- matrix(trainingSet[,"z"],ncol=length(x),nrow=length(x))
    > persp(x,x,Z,theta = 45, phi = 15, expand = 0.8, col = "lightblue",
    + ticktype="detailed",main="sinc(x)*sinc(y)")
    >
    > ##Training domain patterns
    > X <- trainingSet[,1:2]
    > Y <- trainingSet[,3,drop=FALSE]
    >
    > ##Defining the required MembershipFunctions for the ANFIS
    > membershipFunction<-list(
    + x=c(new(Class="NormalizedGaussianMF",parameters=c(mu=-10,sigma=2)),
    + new(Class="NormalizedGaussianMF",parameters=c(mu=-5,sigma=2)),
    + new(Class="NormalizedGaussianMF",parameters=c(mu=0,sigma=2)),
    + new(Class="NormalizedGaussianMF",parameters=c(mu=5,sigma=2)),
    + new(Class="NormalizedGaussianMF",parameters=c(mu=10,sigma=2))),
    + y=c(new(Class="NormalizedGaussianMF",parameters=c(mu=-10,sigma=2)),
    + new(Class="NormalizedGaussianMF",parameters=c(mu=-5,sigma=2)),
    + new(Class="NormalizedGaussianMF",parameters=c(mu=0,sigma=2)),
    + new(Class="NormalizedGaussianMF",parameters=c(mu=5,sigma=2)),
    + new(Class="NormalizedGaussianMF",parameters=c(mu=10,sigma=2))))
    >
    > ##Creating the ANFIS network with 2 inputs and 4 MembershipFunctions in
    > ##each input
    > anfis3 <- new(Class="ANFIS",X,Y,membershipFunction)
    > anfis3
    ANFIS network
    Trainning Set:
     dim(x)= 121x2
     dim(y)= 121x1
    Arquitecture: 2 ( 5x5 ) - 25 - 75 ( 75x1 ) - 1
    Network not trained yet
    >
    > ##Check for epsilon-completeness in each input
    > plotMFs(anfis3)
    >
    > ##Training the ANFIS network.
    > ##We will use instead an already trained object to reduce example time.
    > data(anfis3)
    >
    > ##How the training went. You can keep on training as the training error
    > ##is still descending.
    > plot(anfis3)
    >
    > ##Test the fit, i. e., how the MembershipFunctions partition the input space
    > plotMFs(anfis3)
    >
    > ##Just to see if premises, consequents and errors were updated
    > getPremises(anfis3)[[input=1]][[mf=1]]
    MembershipFunction: Normalized Gaussian Membership Function
    Number of parameters: 2
     mu sigma
    -9.984987 2.038630
    Expression: expression(exp(-1/2 * ((x - mu)/sigma)^2))
    > getConsequents(anfis3)[1:2,]
    [1] 0.005011691 0.005011691
    > getErrors(anfis3) #Training errors
     [1] 0.03741022 0.03238312 0.02992609 0.02866609 0.02759035 0.02661405
     [7] 0.02569998 0.02482807 0.02398628 0.02316705 0.02271256 0.02224352
    [13] 0.02176043 0.02126397 0.02075495 0.02023433 0.01970327 0.01916307
    > getTrainingType(anfis3)
    [1] "trainHybridJangOffLine"
    > names(coef(anfis3))
    [1] "premises" "consequents"
    > ##An alternative to get premises and/or consequents ...
    > coef(anfis3)$premises[[input=1]][[mf=1]]
    MembershipFunction: Normalized Gaussian Membership Function
    Number of parameters: 2
     mu sigma
    -9.984987 2.038630
    Expression: expression(exp(-1/2 * ((x - mu)/sigma)^2))
    > coef(anfis3)$consequents[1:2,]
    [1] 0.005011691 0.005011691
    >
    > ##First five train pattern associated values for the training process
    > fitted(anfis3)[1:5,]
    [1] -0.008394804 0.007514315 0.012824644 -0.003044622 -0.030125619
    > resid(anfis3)[1:5,]
    [1] 0.011354394 -0.014242212 -0.010291178 0.013337535 0.005391769
    > summary(anfis3)
    ANFIS network
    Trainning Set:
     dim(x)= 121x2
     dim(y)= 121x1
    Arquitecture: 2 ( 5x5 ) - 25 - 75 ( 75x1 ) - 1
    Last training error: 0.01916307
    
    Call: trainHybridJangOffLine(object = anfis3, epochs = 10)
    
    Statistics for Off-line training
     Min. 1st Qu. Median Mean 3rd Qu. Max.
    0.01916 0.02139 0.02358 0.02489 0.02735 0.03741
    >
    > ##Surface comparison between the original training set and the predicted
    > ##ANFIS network
    > y <- predict(anfis3,X)
     ----------- FAILURE REPORT --------------
     --- failure: the condition has length > 1 ---
     --- srcref ---
    :
     --- package (from environment) ---
    anfis
     --- call from context ---
    FUN(X[[i]], ...)
     --- call from argument ---
    if (class(tita_1) == "list") {
     aux <- matrix(NA, nrow = max(sapply(tita_1, length)), ncol = ncol(x))
     invisible(sapply(seq(along = tita_1), function(input) {
     aux[1:length(tita_1[[input]]), input] <<- tita_1[[input]]
     return(NULL)
     }))
     tita_1 <- aux
    }
     --- R stacktrace ---
    where 1: FUN(X[[i]], ...)
    where 2: lapply(1:nrow(x), function(pattern) {
     tita_1 <- sapply(seq(along = object@premises), function(input,
     pattern) {
     unlist(lapply(object@premises[[input]], function(MF) {
     evaluateMF(MF, x[pattern, input])
     }))
     }, pattern)
     if (class(tita_1) == "list") {
     aux <- matrix(NA, nrow = max(sapply(tita_1, length)),
     ncol = ncol(x))
     invisible(sapply(seq(along = tita_1), function(input) {
     aux[1:length(tita_1[[input]]), input] <<- tita_1[[input]]
     return(NULL)
     }))
     tita_1 <- aux
     }
     if (!is.matrix(tita_1)) {
     tita_1 <- t(tita_1)
     }
     w <<- cbind(w, apply(object@rules, 1, function(rule, tita_1) {
     prod(sapply(seq(along = rule), function(input, tita_1) {
     tita_1[rule[input], input]
     }, tita_1))
     }, tita_1))
     wSum <<- c(wSum, sum(w[, pattern]))
     wNormalized <<- cbind(wNormalized, w[, pattern]/wSum[pattern])
     A <<- rbind(A, matrix(matrix(c(x[pattern, ], 1), ncol = 1) %*%
     wNormalized[, pattern], nrow = 1, byrow = FALSE))
     return(NULL)
    })
    where 3: .local(object, ...)
    where 4: predict(anfis3, X)
    where 5: predict(anfis3, X)
    
     --- value of length: 2 type: logical ---
    [1] FALSE FALSE
     --- function from context ---
    function (pattern)
    {
     tita_1 <- sapply(seq(along = object@premises), function(input,
     pattern) {
     unlist(lapply(object@premises[[input]], function(MF) {
     evaluateMF(MF, x[pattern, input])
     }))
     }, pattern)
     if (class(tita_1) == "list") {
     aux <- matrix(NA, nrow = max(sapply(tita_1, length)),
     ncol = ncol(x))
     invisible(sapply(seq(along = tita_1), function(input) {
     aux[1:length(tita_1[[input]]), input] <<- tita_1[[input]]
     return(NULL)
     }))
     tita_1 <- aux
     }
     if (!is.matrix(tita_1)) {
     tita_1 <- t(tita_1)
     }
     w <<- cbind(w, apply(object@rules, 1, function(rule, tita_1) {
     prod(sapply(seq(along = rule), function(input, tita_1) {
     tita_1[rule[input], input]
     }, tita_1))
     }, tita_1))
     wSum <<- c(wSum, sum(w[, pattern]))
     wNormalized <<- cbind(wNormalized, w[, pattern]/wSum[pattern])
     A <<- rbind(A, matrix(matrix(c(x[pattern, ], 1), ncol = 1) %*%
     wNormalized[, pattern], nrow = 1, byrow = FALSE))
     return(NULL)
    }
    <environment: 0x3be5720>
     --- function search by body ---
     ----------- END OF FAILURE REPORT --------------
    Error in if (class(tita_1) == "list") { : the condition has length > 1
    Calls: predict -> predict -> .local -> lapply -> FUN
    Execution halted
Flavor: r-devel-linux-x86_64-fedora-clang

Version: 0.99.1
Check: examples
Result: ERROR
    Running examples in ‘anfis-Ex.R’ failed
    The error most likely occurred in:
    
    > ### Name: ANFIS-class
    > ### Title: ANFIS S4 class implementation in R
    > ### Aliases: ANFIS-class
    >
    > ### ** Examples
    >
    > ##Set 2 cores using global options for parallel library
    > require("parallel")
    > if(.Platform$OS.type == "windows"){
    + options(mc.cores=1)
    + }else{
    + options(mc.cores=2) ##You could use all calling detectCores()
    + }
    >
    > ##Example domain for bidimentional sinc(x,y) function
    > x <- seq(-10, 10, length= 11)
    > trainingSet <- trainSet(x,x)
    > Z <- matrix(trainingSet[,"z"],ncol=length(x),nrow=length(x))
    > persp(x,x,Z,theta = 45, phi = 15, expand = 0.8, col = "lightblue",
    + ticktype="detailed",main="sinc(x)*sinc(y)")
    >
    > ##Training domain patterns
    > X <- trainingSet[,1:2]
    > Y <- trainingSet[,3,drop=FALSE]
    >
    > ##Defining the required MembershipFunctions for the ANFIS
    > membershipFunction<-list(
    + x=c(new(Class="NormalizedGaussianMF",parameters=c(mu=-10,sigma=2)),
    + new(Class="NormalizedGaussianMF",parameters=c(mu=-5,sigma=2)),
    + new(Class="NormalizedGaussianMF",parameters=c(mu=0,sigma=2)),
    + new(Class="NormalizedGaussianMF",parameters=c(mu=5,sigma=2)),
    + new(Class="NormalizedGaussianMF",parameters=c(mu=10,sigma=2))),
    + y=c(new(Class="NormalizedGaussianMF",parameters=c(mu=-10,sigma=2)),
    + new(Class="NormalizedGaussianMF",parameters=c(mu=-5,sigma=2)),
    + new(Class="NormalizedGaussianMF",parameters=c(mu=0,sigma=2)),
    + new(Class="NormalizedGaussianMF",parameters=c(mu=5,sigma=2)),
    + new(Class="NormalizedGaussianMF",parameters=c(mu=10,sigma=2))))
    >
    > ##Creating the ANFIS network with 2 inputs and 4 MembershipFunctions in
    > ##each input
    > anfis3 <- new(Class="ANFIS",X,Y,membershipFunction)
    > anfis3
    ANFIS network
    Trainning Set:
     dim(x)= 121x2
     dim(y)= 121x1
    Arquitecture: 2 ( 5x5 ) - 25 - 75 ( 75x1 ) - 1
    Network not trained yet
    >
    > ##Check for epsilon-completeness in each input
    > plotMFs(anfis3)
    >
    > ##Training the ANFIS network.
    > ##We will use instead an already trained object to reduce example time.
    > data(anfis3)
    >
    > ##How the training went. You can keep on training as the training error
    > ##is still descending.
    > plot(anfis3)
    >
    > ##Test the fit, i. e., how the MembershipFunctions partition the input space
    > plotMFs(anfis3)
    >
    > ##Just to see if premises, consequents and errors were updated
    > getPremises(anfis3)[[input=1]][[mf=1]]
    MembershipFunction: Normalized Gaussian Membership Function
    Number of parameters: 2
     mu sigma
    -9.984987 2.038630
    Expression: expression(exp(-1/2 * ((x - mu)/sigma)^2))
    > getConsequents(anfis3)[1:2,]
    [1] 0.005011691 0.005011691
    > getErrors(anfis3) #Training errors
     [1] 0.03741022 0.03238312 0.02992609 0.02866609 0.02759035 0.02661405
     [7] 0.02569998 0.02482807 0.02398628 0.02316705 0.02271256 0.02224352
    [13] 0.02176043 0.02126397 0.02075495 0.02023433 0.01970327 0.01916307
    > getTrainingType(anfis3)
    [1] "trainHybridJangOffLine"
    > names(coef(anfis3))
    [1] "premises" "consequents"
    > ##An alternative to get premises and/or consequents ...
    > coef(anfis3)$premises[[input=1]][[mf=1]]
    MembershipFunction: Normalized Gaussian Membership Function
    Number of parameters: 2
     mu sigma
    -9.984987 2.038630
    Expression: expression(exp(-1/2 * ((x - mu)/sigma)^2))
    > coef(anfis3)$consequents[1:2,]
    [1] 0.005011691 0.005011691
    >
    > ##First five train pattern associated values for the training process
    > fitted(anfis3)[1:5,]
    [1] -0.008394804 0.007514315 0.012824644 -0.003044622 -0.030125619
    > resid(anfis3)[1:5,]
    [1] 0.011354394 -0.014242212 -0.010291178 0.013337535 0.005391769
    > summary(anfis3)
    ANFIS network
    Trainning Set:
     dim(x)= 121x2
     dim(y)= 121x1
    Arquitecture: 2 ( 5x5 ) - 25 - 75 ( 75x1 ) - 1
    Last training error: 0.01916307
    
    Call: trainHybridJangOffLine(object = anfis3, epochs = 10)
    
    Statistics for Off-line training
     Min. 1st Qu. Median Mean 3rd Qu. Max.
    0.01916 0.02139 0.02358 0.02489 0.02735 0.03741
    >
    > ##Surface comparison between the original training set and the predicted
    > ##ANFIS network
    > y <- predict(anfis3,X)
     ----------- FAILURE REPORT --------------
     --- failure: the condition has length > 1 ---
     --- srcref ---
    :
     --- package (from environment) ---
    anfis
     --- call from context ---
    FUN(X[[i]], ...)
     --- call from argument ---
    if (class(tita_1) == "list") {
     aux <- matrix(NA, nrow = max(sapply(tita_1, length)), ncol = ncol(x))
     invisible(sapply(seq(along = tita_1), function(input) {
     aux[1:length(tita_1[[input]]), input] <<- tita_1[[input]]
     return(NULL)
     }))
     tita_1 <- aux
    }
     --- R stacktrace ---
    where 1: FUN(X[[i]], ...)
    where 2: lapply(1:nrow(x), function(pattern) {
     tita_1 <- sapply(seq(along = object@premises), function(input,
     pattern) {
     unlist(lapply(object@premises[[input]], function(MF) {
     evaluateMF(MF, x[pattern, input])
     }))
     }, pattern)
     if (class(tita_1) == "list") {
     aux <- matrix(NA, nrow = max(sapply(tita_1, length)),
     ncol = ncol(x))
     invisible(sapply(seq(along = tita_1), function(input) {
     aux[1:length(tita_1[[input]]), input] <<- tita_1[[input]]
     return(NULL)
     }))
     tita_1 <- aux
     }
     if (!is.matrix(tita_1)) {
     tita_1 <- t(tita_1)
     }
     w <<- cbind(w, apply(object@rules, 1, function(rule, tita_1) {
     prod(sapply(seq(along = rule), function(input, tita_1) {
     tita_1[rule[input], input]
     }, tita_1))
     }, tita_1))
     wSum <<- c(wSum, sum(w[, pattern]))
     wNormalized <<- cbind(wNormalized, w[, pattern]/wSum[pattern])
     A <<- rbind(A, matrix(matrix(c(x[pattern, ], 1), ncol = 1) %*%
     wNormalized[, pattern], nrow = 1, byrow = FALSE))
     return(NULL)
    })
    where 3: .local(object, ...)
    where 4: predict(anfis3, X)
    where 5: predict(anfis3, X)
    
     --- value of length: 2 type: logical ---
    [1] FALSE FALSE
     --- function from context ---
    function (pattern)
    {
     tita_1 <- sapply(seq(along = object@premises), function(input,
     pattern) {
     unlist(lapply(object@premises[[input]], function(MF) {
     evaluateMF(MF, x[pattern, input])
     }))
     }, pattern)
     if (class(tita_1) == "list") {
     aux <- matrix(NA, nrow = max(sapply(tita_1, length)),
     ncol = ncol(x))
     invisible(sapply(seq(along = tita_1), function(input) {
     aux[1:length(tita_1[[input]]), input] <<- tita_1[[input]]
     return(NULL)
     }))
     tita_1 <- aux
     }
     if (!is.matrix(tita_1)) {
     tita_1 <- t(tita_1)
     }
     w <<- cbind(w, apply(object@rules, 1, function(rule, tita_1) {
     prod(sapply(seq(along = rule), function(input, tita_1) {
     tita_1[rule[input], input]
     }, tita_1))
     }, tita_1))
     wSum <<- c(wSum, sum(w[, pattern]))
     wNormalized <<- cbind(wNormalized, w[, pattern]/wSum[pattern])
     A <<- rbind(A, matrix(matrix(c(x[pattern, ], 1), ncol = 1) %*%
     wNormalized[, pattern], nrow = 1, byrow = FALSE))
     return(NULL)
    }
    <environment: 0x4622f80>
     --- function search by body ---
     ----------- END OF FAILURE REPORT --------------
    Error in if (class(tita_1) == "list") { : the condition has length > 1
    Calls: predict -> predict -> .local -> lapply -> FUN
    Execution halted
Flavor: r-devel-linux-x86_64-fedora-gcc