Skip to content
This repository has been archived by the owner on Nov 17, 2023. It is now read-only.

verbose option #1608

Closed
topepo opened this issue Mar 9, 2016 · 5 comments
Closed

verbose option #1608

topepo opened this issue Mar 9, 2016 · 5 comments

Comments

@topepo
Copy link

topepo commented Mar 9, 2016

Is there any way in the R package to suppress the training and prediction logs?

Thanks,

Max

@terrytangyuan
Copy link
Member

I don't think so. At least in model.R, those cat calls are not conditioned on verbosity.

Best,
Yuan

@thirdwing
Copy link
Contributor

@topepo Hi, I think you can use sink.

tc <- textConnection(NULL, "w") 
sink(tc) 
model <- mx.model.FeedForward.create(softmax, X=train.x, y=train.y,
                                     ctx=devices, num.round=3, array.batch.size=100,
                                     learning.rate=0.07, momentum=0.9,  eval.metric=mx.metric.accuracy,
                                     initializer=mx.init.uniform(0.07),
                                     batch.end.callback=mx.callback.log.train.metric(100))
sink() 
close(tc)

@topepo
Copy link
Author

topepo commented Mar 15, 2016

Yes, that is one solution. The problem is that, if you want to drop this into existing cross-validation code that might be running in parallel, it gets more complicated (than a verbose option). I submitted a PR with an option yesterday.

@thirdwing
Copy link
Contributor

Sorry that I missed the PR. On travel right now.

It seems it breaks something, can you fix it?

@topepo
Copy link
Author

topepo commented Mar 15, 2016

It seems it breaks something, can you fix it?

I'm not sure; before I made the modifications there were namespace errors when I tried to build the package via make rpkg:

$ make rpkg
Rscript -e "require(roxygen2); roxygen2::roxygenise(\"R-package\")"
Loading required package: roxygen2
Loading required package: methods
Loading required package: Rcpp
Loading required package: DiagrammeR
Loading required package: data.table
Loading required package: jsonlite
Loading required package: magrittr
Loading required package: stringr
Writing mx.callback.save.checkpoint.Rd
Writing mx.model.FeedForward.create.Rd
mkdir -p R-package/inst
mkdir -p R-package/inst/libs
cp -rf lib/libmxnet.so R-package/inst/libs
mkdir -p R-package/inst/include
cp -rf include/* R-package/inst/include
cp -rf dmlc-core/include/* R-package/inst/include/
R CMD build --no-build-vignettes R-package
* checking for file 'R-package/DESCRIPTION' ... OK
* preparing 'mxnet':
* checking DESCRIPTION meta-information ... OK
* cleaning src
* checking for LF line-endings in source and make files
* checking for empty or unneeded directories
* building 'mxnet_0.5.tar.gz'

$ R CMD INSTALL mxnet_0.5.tar.gz
* installing to library '/Users/kuhna03/Library/R/3.2/library'
* installing *source* package 'mxnet' ...
** libs
clang++ -I/Library/Frameworks/R.framework/Resources/include -DNDEBUG -I../inst/include -I/usr/local/include -I/usr/local/include/freetype2 -I/opt/X11/include -I"/Users/kuhna03/Library/R/3.2/library/Rcpp/include"   -fPIC  -Wall -mtune=core2 -g -O2  -c executor.cc -o executor.o
clang++ -I/Library/Frameworks/R.framework/Resources/include -DNDEBUG -I../inst/include -I/usr/local/include -I/usr/local/include/freetype2 -I/opt/X11/include -I"/Users/kuhna03/Library/R/3.2/library/Rcpp/include"   -fPIC  -Wall -mtune=core2 -g -O2  -c export.cc -o export.o
clang++ -I/Library/Frameworks/R.framework/Resources/include -DNDEBUG -I../inst/include -I/usr/local/include -I/usr/local/include/freetype2 -I/opt/X11/include -I"/Users/kuhna03/Library/R/3.2/library/Rcpp/include"   -fPIC  -Wall -mtune=core2 -g -O2  -c io.cc -o io.o
clang++ -I/Library/Frameworks/R.framework/Resources/include -DNDEBUG -I../inst/include -I/usr/local/include -I/usr/local/include/freetype2 -I/opt/X11/include -I"/Users/kuhna03/Library/R/3.2/library/Rcpp/include"   -fPIC  -Wall -mtune=core2 -g -O2  -c kvstore.cc -o kvstore.o
clang++ -I/Library/Frameworks/R.framework/Resources/include -DNDEBUG -I../inst/include -I/usr/local/include -I/usr/local/include/freetype2 -I/opt/X11/include -I"/Users/kuhna03/Library/R/3.2/library/Rcpp/include"   -fPIC  -Wall -mtune=core2 -g -O2  -c mxnet.cc -o mxnet.o
clang++ -I/Library/Frameworks/R.framework/Resources/include -DNDEBUG -I../inst/include -I/usr/local/include -I/usr/local/include/freetype2 -I/opt/X11/include -I"/Users/kuhna03/Library/R/3.2/library/Rcpp/include"   -fPIC  -Wall -mtune=core2 -g -O2  -c ndarray.cc -o ndarray.o
clang++ -I/Library/Frameworks/R.framework/Resources/include -DNDEBUG -I../inst/include -I/usr/local/include -I/usr/local/include/freetype2 -I/opt/X11/include -I"/Users/kuhna03/Library/R/3.2/library/Rcpp/include"   -fPIC  -Wall -mtune=core2 -g -O2  -c symbol.cc -o symbol.o
clang++ -dynamiclib -Wl,-headerpad_max_install_names -undefined dynamic_lookup -single_module -multiply_defined suppress -L/Library/Frameworks/R.framework/Resources/lib -L/usr/local/lib -o mxnet.so executor.o export.o io.o kvstore.o mxnet.o ndarray.o symbol.o -L/Library/Frameworks/R.framework/Resources/lib -lRlapack -L/Library/Frameworks/R.framework/Resources/lib -lRblas -F/Library/Frameworks/R.framework/.. -framework R -Wl,-framework -Wl,CoreFoundation
installing to /Users/kuhna03/Library/R/3.2/library/mxnet/libs
** R
** demo
** inst
** preparing package for lazy loading
** help
*** installing help indices
** building package indices
** installing vignettes
** testing if installed package can be loaded
Error in namespaceExport(ns, exports) : 
  undefined exports: mx.nd.abs, mx.nd.argmax.channel, mx.nd.ceil, mx.nd.choose.element.0index, mx.nd.cos, mx.nd.fill.element.0index, mx.nd.floor, mx.nd.max, mx.nd.min, mx.nd.round, mx.nd.rsqrt, mx.nd.sign, mx.nd.sin, mx.nd.sum
Error: loading failed
Execution halted
ERROR: loading failed
* removing '/Users/kuhna03/Library/R/3.2/library/mxnet'
* restoring previous '/Users/kuhna03/Library/R/3.2/library/mxnet'

thirdwing pushed a commit to thirdwing/mxnet that referenced this issue Mar 20, 2016
thirdwing pushed a commit to thirdwing/mxnet that referenced this issue Mar 20, 2016
@tqchen tqchen closed this as completed in 569c486 Mar 20, 2016
tqchen added a commit that referenced this issue Mar 20, 2016
[R] added a verbose option to `mx.mlp` in R package. close #1608
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

4 participants