CARET NN Too Much Output Even with Trace=False

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

CARET NN Too Much Output Even with Trace=False

Sparks, John James
Hi R Helpers,


I am using the Neural Net build in the CARET package and it produces a large amount of output that I don't need to see and interferes with my ability to get to the output that I want to see.  I am using the nnet.trace=FALSE setting, but still getting a disproportionate amount of output from this one procedure.


Is there another option setting that will turn off this output?


Reproducible example is below.  It has a little extra complication in it because I hacked it from a post.  Let me know if I need to do anything to it to make it more use-able.


Many thanks.

--John Sparks


library('caret')
set.seed(1)

data<-read.csv(url('https://datahack-prod.s3.ap-south-1.amazonaws.com/train_file/train_u6lujuX_CVtuZ9i.csv'))

#Imputing missing values using median
preProcValues <- preProcess(data, method = c("medianImpute","center","scale"))
library('RANN')
data_processed <- predict(preProcValues, data)
index <- createDataPartition(data_processed$Loan_Status, p=0.75, list=FALSE)
trainSet <- data_processed[ index,]
testSet <- data_processed[-index,]
fitControl <- trainControl(method = "cv",number = 5,savePredictions = 'final',classProbs = T)

trainSet<-subset(trainSet,select=-c(Loan_ID))
outcomeName<-"Loan_Status"
predictors<-names(trainSet)[!names(trainSet) %in% outcomeName]

NN<-train(trainSet[,predictors],trainSet[,outcomeName],method='nnet',trControl=fitControl,tuneLength=5,nnet.trace=FALSE)



        [[alternative HTML version deleted]]

______________________________________________
[hidden email] mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.
Reply | Threaded
Open this post in threaded view
|

Re: CARET NN Too Much Output Even with Trace=False

R help mailing list-2
You can use capture.output to store all that tracing information in a
character vector instead of having it printed.  You can look at it to
diagnose problems or just throw it away.

NN.text  <-
capture.output(NN<-train(trainSet[,predictors],trainSet[,outcomeName],method='nnet',trControl=fitControl,tuneLength=5,nnet.trace=FALSE))

Bill Dunlap
TIBCO Software
wdunlap tibco.com

On Fri, Aug 17, 2018 at 10:34 AM, Sparks, John <[hidden email]> wrote:

> Hi R Helpers,
>
>
> I am using the Neural Net build in the CARET package and it produces a
> large amount of output that I don't need to see and interferes with my
> ability to get to the output that I want to see.  I am using the
> nnet.trace=FALSE setting, but still getting a disproportionate amount of
> output from this one procedure.
>
>
> Is there another option setting that will turn off this output?
>
>
> Reproducible example is below.  It has a little extra complication in it
> because I hacked it from a post.  Let me know if I need to do anything to
> it to make it more use-able.
>
>
> Many thanks.
>
> --John Sparks
>
>
> library('caret')
> set.seed(1)
>
> data<-read.csv(url('https://datahack-prod.s3.ap-south-1.
> amazonaws.com/train_file/train_u6lujuX_CVtuZ9i.csv'))
>
> #Imputing missing values using median
> preProcValues <- preProcess(data, method = c("medianImpute","center","
> scale"))
> library('RANN')
> data_processed <- predict(preProcValues, data)
> index <- createDataPartition(data_processed$Loan_Status, p=0.75,
> list=FALSE)
> trainSet <- data_processed[ index,]
> testSet <- data_processed[-index,]
> fitControl <- trainControl(method = "cv",number = 5,savePredictions =
> 'final',classProbs = T)
>
> trainSet<-subset(trainSet,select=-c(Loan_ID))
> outcomeName<-"Loan_Status"
> predictors<-names(trainSet)[!names(trainSet) %in% outcomeName]
>
> NN<-train(trainSet[,predictors],trainSet[,outcomeName],method='nnet',
> trControl=fitControl,tuneLength=5,nnet.trace=FALSE)
>
>
>
>         [[alternative HTML version deleted]]
>
> ______________________________________________
> [hidden email] mailing list -- To UNSUBSCRIBE and more, see
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/
> posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
>

        [[alternative HTML version deleted]]

______________________________________________
[hidden email] mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.
Reply | Threaded
Open this post in threaded view
|

Re: CARET NN Too Much Output Even with Trace=False

Sparks, John James
Terrific!  Thanks for the speedy and informative reply.


--JJS


________________________________
From: William Dunlap <[hidden email]>
Sent: Friday, August 17, 2018 12:45 PM
To: Sparks, John
Cc: [hidden email]
Subject: Re: [R] CARET NN Too Much Output Even with Trace=False

You can use capture.output to store all that tracing information in a character vector instead of having it printed.  You can look at it to diagnose problems or just throw it away.

NN.text  <- capture.output(NN<-train(trainSet[,predictors],trainSet[,outcomeName],method='nnet',trControl=fitControl,tuneLength=5,nnet.trace=FALSE))

Bill Dunlap
TIBCO Software
wdunlap tibco.com<http://tibco.com>

On Fri, Aug 17, 2018 at 10:34 AM, Sparks, John <[hidden email]<mailto:[hidden email]>> wrote:
Hi R Helpers,


I am using the Neural Net build in the CARET package and it produces a large amount of output that I don't need to see and interferes with my ability to get to the output that I want to see.  I am using the nnet.trace=FALSE setting, but still getting a disproportionate amount of output from this one procedure.


Is there another option setting that will turn off this output?


Reproducible example is below.  It has a little extra complication in it because I hacked it from a post.  Let me know if I need to do anything to it to make it more use-able.


Many thanks.

--John Sparks


library('caret')
set.seed(1)

data<-read.csv(url('https://datahack-prod.s3.ap-south-1.amazonaws.com/train_file/train_u6lujuX_CVtuZ9i.csv'))

#Imputing missing values using median
preProcValues <- preProcess(data, method = c("medianImpute","center","scale"))
library('RANN')
data_processed <- predict(preProcValues, data)
index <- createDataPartition(data_processed$Loan_Status, p=0.75, list=FALSE)
trainSet <- data_processed[ index,]
testSet <- data_processed[-index,]
fitControl <- trainControl(method = "cv",number = 5,savePredictions = 'final',classProbs = T)

trainSet<-subset(trainSet,select=-c(Loan_ID))
outcomeName<-"Loan_Status"
predictors<-names(trainSet)[!names(trainSet) %in% outcomeName]

NN<-train(trainSet[,predictors],trainSet[,outcomeName],method='nnet',trControl=fitControl,tuneLength=5,nnet.trace=FALSE)



        [[alternative HTML version deleted]]

______________________________________________
[hidden email]<mailto:[hidden email]> mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


        [[alternative HTML version deleted]]

______________________________________________
[hidden email] mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.