* using log directory ‘/data/gannet/ripley/R/packages/tests-LENGTH1/nnetpredint.Rcheck’ * using R Under development (unstable) (2022-04-26 r82260) * using platform: x86_64-pc-linux-gnu (64-bit) * using session charset: UTF-8 * using option ‘--no-stop-on-test-error’ * checking for file ‘nnetpredint/DESCRIPTION’ ... OK * checking extension type ... Package * this is package ‘nnetpredint’ version ‘1.2’ * checking package namespace information ... OK * checking package dependencies ... OK * checking if this is a source package ... OK * checking if there is a namespace ... OK * checking for executable files ... OK * checking for hidden files and directories ... OK * checking for portable file names ... OK * checking for sufficient/correct file permissions ... OK * checking whether package ‘nnetpredint’ can be installed ... OK * checking package directory ... OK * checking DESCRIPTION meta-information ... OK * checking top-level files ... OK * checking for left-over files ... OK * checking index information ... OK * checking package subdirectories ... OK * checking R files for non-ASCII characters ... OK * checking R files for syntax errors ... OK * checking whether the package can be loaded ... OK * checking whether the package can be loaded with stated dependencies ... OK * checking whether the package can be unloaded cleanly ... OK * checking whether the namespace can be loaded with stated dependencies ... OK * checking whether the namespace can be unloaded cleanly ... OK * checking loading without being on the library search path ... OK * checking use of S3 registration ... OK * checking dependencies in R code ... OK * checking S3 generic/method consistency ... OK * checking replacement functions ... OK * checking foreign function calls ... OK * checking R code for possible problems ... [7s/18s] OK * checking Rd files ... NOTE checkRd: (7) activate.Rd:25-28: \item in \arguments must have non-empty label checkRd: (7) activate.Rd:29-32: \item in \arguments must have non-empty label checkRd: (7) nnetPredInt.Rd:51-53: \item in \arguments must have non-empty label checkRd: (7) nnetPredInt.Rd:54-56: \item in \arguments must have non-empty label checkRd: (7) nnetPredInt.Rd:57-59: \item in \arguments must have non-empty label * checking Rd metadata ... OK * checking Rd line widths ... OK * checking Rd cross-references ... OK * checking for missing documentation entries ... OK * checking for code/documentation mismatches ... OK * checking Rd \usage sections ... OK * checking Rd contents ... OK * checking for unstated dependencies in examples ... OK * checking examples ... [4s/10s] ERROR Running examples in ‘nnetpredint-Ex.R’ failed The error most likely occurred in: > ### Name: nnetPredInt > ### Title: Prediction Intervals of Neural Networks > ### Aliases: nnetPredInt nnetPredInt.default nnetPredInt.nnet > ### nnetPredInt.nn nnetPredInt.rsnns > > ### ** Examples > > # Example 1: Using the nn object trained by neuralnet package > set.seed(500) > library(MASS) > data <- Boston > maxs <- apply(data, 2, max) > mins <- apply(data, 2, min) > scaled <- as.data.frame(scale(data, center = mins, scale = maxs - mins)) # normalization > index <- sample(1:nrow(data),round(0.75*nrow(data))) > train_ <- scaled[index,] > test_ <- scaled[-index,] > > library(neuralnet) # Training > n <- names(train_) > f <- as.formula(paste("medv ~", paste(n[!n %in% "medv"], collapse = " + "))) > nn <- neuralnet(f,data = train_,hidden = c(5,3),linear.output = FALSE) > plot(nn) > > library(nnetpredint) # Getting prediction confidence interval > x <- train_[,-14] > y <- train_[,14] > newData <- test_[,-14] > > # S3 generic method: Object of nn > yPredInt <- nnetPredInt(nn, x, y, newData) ----------- FAILURE REPORT -------------- --- failure: length > 1 in coercion to logical --- --- srcref --- : --- package (from environment) --- nnetpredint --- call from context --- checkInput(xTrain, yTrain, yFit, node, wts, newData) --- call from argument --- (class(xTrain) %in% c("matrix", "data.frame")) && (class(yTrain) %in% c("matrix", "data.frame", "numeric")) && (class(yFit) %in% c("matrix", "data.frame", "numeric")) --- R stacktrace --- where 1: checkInput(xTrain, yTrain, yFit, node, wts, newData) where 2: getPredInt(xTrain, yTrain, yFit, nodeNum, wts, newData, alpha = alpha, lambda = lambda, funName = funName) where 3: nnetPredInt.nn(nn, x, y, newData) where 4: nnetPredInt(nn, x, y, newData) --- value of length: 2 type: logical --- [1] TRUE FALSE --- function from context --- function (xTrain, yTrain, yFit, node, wts, newData) { checkResult = 1 argsCheck = ((is.null(xTrain) == FALSE)) && ((is.null(yTrain) == FALSE)) && ((is.null(yFit) == FALSE)) && ((is.null(node) == FALSE)) && ((is.null(wts) == FALSE)) && ((is.null(newData) == FALSE)) if (argsCheck == FALSE) { checkResult = checkResult * 0 message("Error: Input Arguments are missing nor be NULL") return(0) } nodeCheck = (class(node) == "numeric" && (is.null(node) == FALSE) && (length(node) >= 3)) if (nodeCheck == FALSE) { checkResult = checkResult * 0 message("Error: Node argument is not numeric vector with enough length at least 3") return(0) } wtsCheck = (class(wts) == "numeric" && (is.null(wts) == FALSE)) if (wtsCheck == FALSE) { checkResult = checkResult * 0 message("Error: wts argument is not numeric vector") return(0) } m = length(node) - 1 nPara = 0 for (i in 1:m) { nPara = nPara + (node[i] + 1) * node[i + 1] } nParaCheck = (nPara == length(wts)) if (nParaCheck == FALSE) { checkResult = checkResult * 0 message("Error: wts parameter total number is not correct based on the network structure defined by 'node'") return(0) } classCheck = (class(xTrain) %in% c("matrix", "data.frame")) && (class(yTrain) %in% c("matrix", "data.frame", "numeric")) && (class(yFit) %in% c("matrix", "data.frame", "numeric")) && (class(newData) %in% c("matrix", "data.frame", "numeric")) if (classCheck == FALSE) { checkResult = checkResult * 0 message("Error: xTrain,yTrain,yFit,newData should be class of either matrix,data.frame or numeric vector") return(0) } nObs = dim(xTrain)[1] nObsCheck = (nObs == dim(matrix(yTrain, ncol = 1))[1]) && (nObs == dim(matrix(yFit, ncol = 1))[1]) if (nObsCheck == FALSE) { checkResult = checkResult * 0 message("Error: Number of observations for xTrain, yTrain, yFit are not the same") return(0) } nDim = node[1] dimCheck = (nDim == dim(xTrain)[2]) && (nDim == dim(newData)[2]) if (dimCheck == FALSE) { checkResult = checkResult * 0 message("Error: xTrain,newData input dimension are not the same as node structure") return(0) } return(checkResult) } --- function search by body --- Function checkInput in namespace nnetpredint has this body. ----------- END OF FAILURE REPORT -------------- Fatal error: length > 1 in coercion to logical * checking for unstated dependencies in ‘tests’ ... OK * checking tests ... Running ‘test1.R’ Running ‘test2.R’ Running ‘test3.R’ [7s/20s] ERROR Running the tests in ‘tests/test1.R’ failed. Complete output: > # Example 1: Using the nn object trained by neuralnet package > set.seed(500) > library(MASS) > data <- Boston > maxs <- apply(data, 2, max) > mins <- apply(data, 2, min) > scaled <- as.data.frame(scale(data, center = mins, scale = maxs - mins)) # normalization > index <- sample(1:nrow(data),round(0.75*nrow(data))) > train_ <- scaled[index,] > test_ <- scaled[-index,] > > library(neuralnet) # Training > n <- names(train_) > f <- as.formula(paste("medv ~", paste(n[!n %in% "medv"], collapse = " + "))) > nn <- neuralnet(f,data = train_,hidden = c(5,3),linear.output = FALSE) > plot(nn) > > library(nnetpredint) # Getting Prediction confidence interval > x <- train_[,-14] > y <- train_[,14] > newData <- test_[,-14] > > # S3 generic method: Object of nn > yPredInt <- nnetPredInt(nn, x, y, newData) ----------- FAILURE REPORT -------------- --- failure: length > 1 in coercion to logical --- --- srcref --- : --- package (from environment) --- nnetpredint --- call from context --- checkInput(xTrain, yTrain, yFit, node, wts, newData) --- call from argument --- (class(xTrain) %in% c("matrix", "data.frame")) && (class(yTrain) %in% c("matrix", "data.frame", "numeric")) && (class(yFit) %in% c("matrix", "data.frame", "numeric")) --- R stacktrace --- where 1: checkInput(xTrain, yTrain, yFit, node, wts, newData) where 2: getPredInt(xTrain, yTrain, yFit, nodeNum, wts, newData, alpha = alpha, lambda = lambda, funName = funName) where 3: nnetPredInt.nn(nn, x, y, newData) where 4: nnetPredInt(nn, x, y, newData) --- value of length: 2 type: logical --- [1] TRUE FALSE --- function from context --- function (xTrain, yTrain, yFit, node, wts, newData) { checkResult = 1 argsCheck = ((is.null(xTrain) == FALSE)) && ((is.null(yTrain) == FALSE)) && ((is.null(yFit) == FALSE)) && ((is.null(node) == FALSE)) && ((is.null(wts) == FALSE)) && ((is.null(newData) == FALSE)) if (argsCheck == FALSE) { checkResult = checkResult * 0 message("Error: Input Arguments are missing nor be NULL") return(0) } nodeCheck = (class(node) == "numeric" && (is.null(node) == FALSE) && (length(node) >= 3)) if (nodeCheck == FALSE) { checkResult = checkResult * 0 message("Error: Node argument is not numeric vector with enough length at least 3") return(0) } wtsCheck = (class(wts) == "numeric" && (is.null(wts) == FALSE)) if (wtsCheck == FALSE) { checkResult = checkResult * 0 message("Error: wts argument is not numeric vector") return(0) } m = length(node) - 1 nPara = 0 for (i in 1:m) { nPara = nPara + (node[i] + 1) * node[i + 1] } nParaCheck = (nPara == length(wts)) if (nParaCheck == FALSE) { checkResult = checkResult * 0 message("Error: wts parameter total number is not correct based on the network structure defined by 'node'") return(0) } classCheck = (class(xTrain) %in% c("matrix", "data.frame")) && (class(yTrain) %in% c("matrix", "data.frame", "numeric")) && (class(yFit) %in% c("matrix", "data.frame", "numeric")) && (class(newData) %in% c("matrix", "data.frame", "numeric")) if (classCheck == FALSE) { checkResult = checkResult * 0 message("Error: xTrain,yTrain,yFit,newData should be class of either matrix,data.frame or numeric vector") return(0) } nObs = dim(xTrain)[1] nObsCheck = (nObs == dim(matrix(yTrain, ncol = 1))[1]) && (nObs == dim(matrix(yFit, ncol = 1))[1]) if (nObsCheck == FALSE) { checkResult = checkResult * 0 message("Error: Number of observations for xTrain, yTrain, yFit are not the same") return(0) } nDim = node[1] dimCheck = (nDim == dim(xTrain)[2]) && (nDim == dim(newData)[2]) if (dimCheck == FALSE) { checkResult = checkResult * 0 message("Error: xTrain,newData input dimension are not the same as node structure") return(0) } return(checkResult) } --- function search by body --- Function checkInput in namespace nnetpredint has this body. ----------- END OF FAILURE REPORT -------------- Fatal error: length > 1 in coercion to logical Running the tests in ‘tests/test2.R’ failed. Complete output: > # Example 2: Using the nnet object trained by nnet package > library(nnet) > xTrain <- rbind(cbind(runif(150,min = 0, max = 0.5),runif(150,min = 0, max = 0.5)) , + cbind(runif(150,min = 0.5, max = 1),runif(150,min = 0.5, max = 1)) + ) > nObs <- dim(xTrain)[1] > yTrain <- 0.5 + 0.4 * sin(2* pi * xTrain %*% c(0.4,0.6)) +rnorm(nObs,mean = 0, sd = 0.05) > plot(xTrain %*% c(0.4,0.6),yTrain) > > # Training nnet models > net <- nnet(yTrain ~ xTrain,size = 3, rang = 0.1,decay = 5e-4, maxit = 500) # weights: 13 initial value 33.262808 iter 10 value 14.279423 iter 20 value 9.032988 iter 30 value 6.353614 iter 40 value 3.717825 iter 50 value 2.749094 iter 60 value 2.397000 iter 70 value 2.065820 iter 80 value 1.915181 iter 90 value 1.806376 iter 100 value 1.728587 iter 110 value 1.713637 iter 120 value 1.711891 iter 130 value 1.711273 iter 140 value 1.709737 iter 150 value 1.698773 iter 160 value 1.672452 iter 170 value 1.306528 iter 180 value 0.987920 iter 190 value 0.953645 iter 200 value 0.946768 iter 210 value 0.943639 iter 220 value 0.942424 iter 230 value 0.941723 iter 240 value 0.941593 iter 250 value 0.941553 iter 260 value 0.941536 iter 270 value 0.941534 iter 280 value 0.941531 final value 0.941531 converged > yFit <- c(net$fitted.values) > nodeNum <- c(2,3,1) > wts <- net$wts > > # New data for prediction intervals > library(nnetpredint) > newData <- cbind(seq(0,1,0.05),seq(0,1,0.05)) > yTest <- 0.5 + 0.4 * sin(2* pi * newData %*% c(0.4,0.6))+rnorm(dim(newData)[1],mean = 0, sd = 0.05) > > # S3 generic method: Object of nnet > yPredInt <- nnetPredInt(net, xTrain, yTrain, newData) ----------- FAILURE REPORT -------------- --- failure: length > 1 in coercion to logical --- --- srcref --- : --- package (from environment) --- nnetpredint --- call from context --- checkInput(xTrain, yTrain, yFit, node, wts, newData) --- call from argument --- (class(xTrain) %in% c("matrix", "data.frame")) && (class(yTrain) %in% c("matrix", "data.frame", "numeric")) --- R stacktrace --- where 1: checkInput(xTrain, yTrain, yFit, node, wts, newData) where 2: getPredInt(xTrain, yTrain, yFit, nodeNum, wts, newData, alpha = alpha, lambda = lambda, funName = funName) where 3: nnetPredInt.nnet(net, xTrain, yTrain, newData) where 4: nnetPredInt(net, xTrain, yTrain, newData) --- value of length: 2 type: logical --- [1] TRUE FALSE --- function from context --- function (xTrain, yTrain, yFit, node, wts, newData) { checkResult = 1 argsCheck = ((is.null(xTrain) == FALSE)) && ((is.null(yTrain) == FALSE)) && ((is.null(yFit) == FALSE)) && ((is.null(node) == FALSE)) && ((is.null(wts) == FALSE)) && ((is.null(newData) == FALSE)) if (argsCheck == FALSE) { checkResult = checkResult * 0 message("Error: Input Arguments are missing nor be NULL") return(0) } nodeCheck = (class(node) == "numeric" && (is.null(node) == FALSE) && (length(node) >= 3)) if (nodeCheck == FALSE) { checkResult = checkResult * 0 message("Error: Node argument is not numeric vector with enough length at least 3") return(0) } wtsCheck = (class(wts) == "numeric" && (is.null(wts) == FALSE)) if (wtsCheck == FALSE) { checkResult = checkResult * 0 message("Error: wts argument is not numeric vector") return(0) } m = length(node) - 1 nPara = 0 for (i in 1:m) { nPara = nPara + (node[i] + 1) * node[i + 1] } nParaCheck = (nPara == length(wts)) if (nParaCheck == FALSE) { checkResult = checkResult * 0 message("Error: wts parameter total number is not correct based on the network structure defined by 'node'") return(0) } classCheck = (class(xTrain) %in% c("matrix", "data.frame")) && (class(yTrain) %in% c("matrix", "data.frame", "numeric")) && (class(yFit) %in% c("matrix", "data.frame", "numeric")) && (class(newData) %in% c("matrix", "data.frame", "numeric")) if (classCheck == FALSE) { checkResult = checkResult * 0 message("Error: xTrain,yTrain,yFit,newData should be class of either matrix,data.frame or numeric vector") return(0) } nObs = dim(xTrain)[1] nObsCheck = (nObs == dim(matrix(yTrain, ncol = 1))[1]) && (nObs == dim(matrix(yFit, ncol = 1))[1]) if (nObsCheck == FALSE) { checkResult = checkResult * 0 message("Error: Number of observations for xTrain, yTrain, yFit are not the same") return(0) } nDim = node[1] dimCheck = (nDim == dim(xTrain)[2]) && (nDim == dim(newData)[2]) if (dimCheck == FALSE) { checkResult = checkResult * 0 message("Error: xTrain,newData input dimension are not the same as node structure") return(0) } return(checkResult) } --- function search by body --- Function checkInput in namespace nnetpredint has this body. ----------- END OF FAILURE REPORT -------------- Fatal error: length > 1 in coercion to logical Running the tests in ‘tests/test3.R’ failed. Complete output: > # Example 3: Using the rsnns object trained by RSNNS package > library(RSNNS) Loading required package: Rcpp > data(iris) > #shuffle the vector > iris <- iris[sample(1:nrow(iris),length(1:nrow(iris))),1:ncol(iris)] > irisValues <- iris[,1:4] > irisTargets <- decodeClassLabels(iris[,5])[,'setosa'] > > iris <- splitForTrainingAndTest(irisValues, irisTargets, ratio=0.15) > iris <- normTrainingAndTestSet(iris) > model <- mlp(iris$inputsTrain, iris$targetsTrain, size=5, learnFuncParams=c(0.1), + maxit=50, inputsTest=iris$inputsTest, targetsTest=iris$targetsTest) > predictions <- predict(model,iris$inputsTest) > > > # Generating prediction intervals > library(nnetpredint) > > # S3 Method for rsnns class prediction intervals > xTrain <- iris$inputsTrain > yTrain <- iris$targetsTrain > newData <- iris$inputsTest > yPredInt <- nnetPredInt(model, xTrain, yTrain, newData) ----------- FAILURE REPORT -------------- --- failure: length > 1 in coercion to logical --- --- srcref --- : --- package (from environment) --- nnetpredint --- call from context --- checkInput(xTrain, yTrain, yFit, node, wts, newData) --- call from argument --- (class(xTrain) %in% c("matrix", "data.frame")) && (class(yTrain) %in% c("matrix", "data.frame", "numeric")) --- R stacktrace --- where 1: checkInput(xTrain, yTrain, yFit, node, wts, newData) where 2: getPredInt(xTrain, yTrain, yFit, nodeNum, wts, newData, alpha = alpha, lambda = lambda, funName = funName) where 3: nnetPredInt.rsnns(model, xTrain, yTrain, newData) where 4: nnetPredInt(model, xTrain, yTrain, newData) --- value of length: 2 type: logical --- [1] TRUE FALSE --- function from context --- function (xTrain, yTrain, yFit, node, wts, newData) { checkResult = 1 argsCheck = ((is.null(xTrain) == FALSE)) && ((is.null(yTrain) == FALSE)) && ((is.null(yFit) == FALSE)) && ((is.null(node) == FALSE)) && ((is.null(wts) == FALSE)) && ((is.null(newData) == FALSE)) if (argsCheck == FALSE) { checkResult = checkResult * 0 message("Error: Input Arguments are missing nor be NULL") return(0) } nodeCheck = (class(node) == "numeric" && (is.null(node) == FALSE) && (length(node) >= 3)) if (nodeCheck == FALSE) { checkResult = checkResult * 0 message("Error: Node argument is not numeric vector with enough length at least 3") return(0) } wtsCheck = (class(wts) == "numeric" && (is.null(wts) == FALSE)) if (wtsCheck == FALSE) { checkResult = checkResult * 0 message("Error: wts argument is not numeric vector") return(0) } m = length(node) - 1 nPara = 0 for (i in 1:m) { nPara = nPara + (node[i] + 1) * node[i + 1] } nParaCheck = (nPara == length(wts)) if (nParaCheck == FALSE) { checkResult = checkResult * 0 message("Error: wts parameter total number is not correct based on the network structure defined by 'node'") return(0) } classCheck = (class(xTrain) %in% c("matrix", "data.frame")) && (class(yTrain) %in% c("matrix", "data.frame", "numeric")) && (class(yFit) %in% c("matrix", "data.frame", "numeric")) && (class(newData) %in% c("matrix", "data.frame", "numeric")) if (classCheck == FALSE) { checkResult = checkResult * 0 message("Error: xTrain,yTrain,yFit,newData should be class of either matrix,data.frame or numeric vector") return(0) } nObs = dim(xTrain)[1] nObsCheck = (nObs == dim(matrix(yTrain, ncol = 1))[1]) && (nObs == dim(matrix(yFit, ncol = 1))[1]) if (nObsCheck == FALSE) { checkResult = checkResult * 0 message("Error: Number of observations for xTrain, yTrain, yFit are not the same") return(0) } nDim = node[1] dimCheck = (nDim == dim(xTrain)[2]) && (nDim == dim(newData)[2]) if (dimCheck == FALSE) { checkResult = checkResult * 0 message("Error: xTrain,newData input dimension are not the same as node structure") return(0) } return(checkResult) } --- function search by body --- Function checkInput in namespace nnetpredint has this body. ----------- END OF FAILURE REPORT -------------- Fatal error: length > 1 in coercion to logical * checking PDF version of manual ... OK * checking for non-standard things in the check directory ... OK * checking for detritus in the temp directory ... OK * DONE Status: 2 ERRORs, 1 NOTE See ‘/data/gannet/ripley/R/packages/tests-LENGTH1/nnetpredint.Rcheck/00check.log’ for details. Command exited with non-zero status 1 Time 2:19.40, 45.09 + 7.48