Giter Club home page Giter Club logo

rocker-ml's Introduction

R docker images for statistical modelling

The rocker project provides a fantastic stack of docker images built from debian. This repository extends the rocker images to provide machine learning / statistical modelling capabilities.

FROM rocker/verse

All these docker images are based on rocker/verse which already contains:

  • r-base
  • rstudio
  • tidyverse
  • shiny
  • publishing tools (pandoc, tex)

Version-specific branches are based on the relevant rocker/verse version (e.g. asachet/rocker-ml:3.6.1 is based on rocker/verse:3.6.1 which uses R 3.6.1).

rocker-ml

The rocker-ml image adds to rocker/verse:

  • ggplot2 utilities such as scales, ggridges, GGally, RColorBrewer, Viridis
  • Misc tools such as foreach, Hmisc, doParallel, openxlsx
  • Modelling tools:
    • caret and related (ensembleR, MLmetrics)
    • statistical utilities like MASS, car, fitdistrplus
    • A large number of modelling packages including gam, lme4, e1071, kernlab, survival, elasticnet, randomForest, ranger, ...
    • Open the dockerfile to see the complete list.

rocker-stan

The rocker-stan image adds Stan to rocker-ml:

  • rstan, rstantools, rstanarm, shinystan, bayesplot, brms, tidybayes

rocker-tidymodels

The rocker-tidymodels image adds tidymodels to rocker-stan. Note that rstanarm is a requirement for tidyposterior hence the stack.

rocker-keras

The rocker-keras image adds to rocker/tidymodels:

  • TensorFlow (latest CPU version) and Keras (latest version)
  • R packages tensorflow, keras and tfestimators

See https://tensorflow.rstudio.com/keras/ for more info.

rocker-ml's People

Contributors

antoine-sachet avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

rocker-ml's Issues

Compile error on Mac

While running the rocker-stan Docker on a Mac, my students get the error message below. All Windows users have been able to run the Docker and R script fine. All of the troubleshooting directly for brms and rstan send us round in circles trying to edit the Makevars file, which seems to be in a different location on the Docker. Any suggestions as to why this error only occurs on Macs would be much appreciated.

For reference, we are attempting to run fit8.1 from Doing Bayesian Data Analysis https://bookdown.org/content/3686/jags-brms.html#a-complete-example

Error in compileCode(f, code, language = language, verbose = verbose) : 

  /usr/local/lib/R/site-library/RcppEigen/include/Eigen/src/Core/DenseCoeffsBase.h:55:30: warning: ignoring attributes on template argument ‘Eigen::internal::packet_traits<double>::type’ {aka ‘__vector(2) double’} [-Wignored-attributes]   55 |                      >::type PacketReturnType;      |                              ^~~~~~~~~~~~~~~~g++: fatal error: Killed signal terminated program cc1pluscompilation terminated.make: *** [/usr/local/lib/R/etc/Makeconf:181: file2c26b238c17.o] Error 1

Error in sink(type = "output") : invalid connection

brms package does not load properly

Hi everyone,

when trying to load the brms package with rthe ocker-stan image in Docker, I get the following output (this results in the package not being loaded, i.e. the functions I use from this package cannot be used):

library(brms) # for bayesian modelling
Loading required package: Rcpp
Registered S3 method overwritten by 'htmlwidgets':
method from
print.htmlwidget tools:rstudio
Error: package or namespace load failed for ‘brms’ in loadNamespace(i, c(lib.loc, .libPaths()), versionCheck = vI[[i]]):
there is no package called ‘xts’

Does anybody have an idea, how I might solve this? Thank you!

Best wishes,
Juliane

Makevars location is incorrect for RStudio

I recently ran into some difficulty compiling a model in RStudio that I think believe is due to HOME being different between R command line and RStudio.

/home/rstudio/.R/Makevars is not generated during container instantiation, however /root/.R/Makevars exists. HOME in R is /root. HOME in RStudio is /home/rstudio.

I believe that running install_stan.R using command line R, is why ~/.R/Makevars file is created in /root instead of /home/rstudio.

It can be confirmed that /.R/Makevars has not been properly generated by running in Rstudio: > readLines("/.R/Makevars") Error in file(con, "r") : cannot open the connection In addition: Warning message: In file(con, "r") :
cannot open file '/home/rstudio/.R/Makevars': No such file or directory

Symptoms: Stan model compile problems that depend upon the model being compiled (some simple models compile without error but schools.stan example here does not).
Correction: generating Makevars file in /home/rstudio allows schools.stan to compile.

Specific error message for schools.stan:
Error in compileCode(f, code, language = language, verbose = verbose) :
/usr/local/lib/R/site-library/RcppEigen/include/Eigen/src/Core/DenseCoeffsBase.h:55:30: warning: ignoring attributes on template argument ‘Eigen::internal::packet_traits::type’ {aka ‘__vector(2) double’} [-Wignored-attributes] 55 | >::type PacketReturnType; | ^~~~~~~~~~~~~~~~g++: fatal error: Killed signal terminated program cc1pluscompilation terminated.make: *** [/usr/local/lib/R/etc/Makeconf:181: file16f20d9e181.o] Error 1

before running Makevars script within RStudio, we are given this information about compiler setttings:

> mod <- stan_model("schools.stan", verbose=TRUE)

TRANSLATING MODEL 'schools' FROM Stan CODE TO C++ CODE NOW.
successful in parsing the Stan model 'schools'.
COMPILING THE C++ CODE FOR MODEL 'schools' NOW.
OS: x86_64, linux-gnu; rstan: 2.21.2; Rcpp: 1.0.6; inline: 0.3.17 
 >> setting environment variables: 
PKG_LIBS =  '/usr/local/lib/R/site-library/rstan/lib//libStanServices.a' -L'/usr/local/lib/R/site-library/StanHeaders/lib/' -lStanHeaders -L'/usr/local/lib/R/site-library/RcppParallel/lib/' -ltbb
PKG_CPPFLAGS =   -I"/usr/local/lib/R/site-library/Rcpp/include/"  -I"/usr/local/lib/R/site-library/RcppEigen/include/"  -I"/usr/local/lib/R/site-library/RcppEigen/include/unsupported"  -I"/usr/local/lib/R/site-library/BH/include" -I"/usr/local/lib/R/site-library/StanHeaders/include/src/"  -I"/usr/local/lib/R/site-library/StanHeaders/include/"  -I"/usr/local/lib/R/site-library/RcppParallel/include/"  -I"/usr/local/lib/R/site-library/rstan/include" -DEIGEN_NO_DEBUG  -DBOOST_DISABLE_ASSERTS  -DBOOST_PENDING_INTEGER_LOG2_HPP  -DSTAN_THREADS  -DBOOST_NO_AUTO_PTR  -include '/usr/local/lib/R/site-library/StanHeaders/include/stan/math/prim/mat/fun/Eigen.hpp'  -D_REENTRANT -DRCPP_PARALLEL_USE_TBB=1 
 >> Program source :
...
make cmd is
  make -f '/usr/local/lib/R/etc/Makeconf' -f '/usr/local/lib/R/share/make/shlib.mk' CXX='$(CXX14) $(CXX14STD)' CXXFLAGS='$(CXX14FLAGS)' CXXPICFLAGS='$(CXX14PICFLAGS)' SHLIB_LDFLAGS='$(SHLIB_CXX14LDFLAGS)' SHLIB_LD='$(SHLIB_CXX14LD)' SHLIB='file16f20d9e181.so' OBJECTS='file16f20d9e181.o'

make would use
**g++** -std=gnu++14 -I"/usr/local/lib/R/include" -DNDEBUG   -I"/usr/local/lib/R/site-library/Rcpp/include/"  -I"/usr/local/lib/R/site-library/RcppEigen/include/"  -I"/usr/local/lib/R/site-library/RcppEigen/include/unsupported"  -I"/usr/local/lib/R/site-library/BH/include" -I"/usr/local/lib/R/site-library/StanHeaders/include/src/"  -I"/usr/local/lib/R/site-library/StanHeaders/include/"  -I"/usr/local/lib/R/site-library/RcppParallel/include/"  -I"/usr/local/lib/R/site-library/rstan/include" -DEIGEN_NO_DEBUG  -DBOOST_DISABLE_ASSERTS  -DBOOST_PENDING_INTEGER_LOG2_HPP  -DSTAN_THREADS  -DBOOST_NO_AUTO_PTR  -include '/usr/local/lib/R/site-library/StanHeaders/include/stan/math/prim/mat/fun/Eigen.hpp'  -D_REENTRANT -DRCPP_PARALLEL_USE_TBB=1   -I/usr/local/include   -fpic  -g -O2 -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -g  -c file16f20d9e181.cpp -o file16f20d9e181.o
if test  "zfile16f20d9e181.o" != "z"; then \
  echo g++ -std=gnu++14 -shared -L"/usr/local/lib/R/lib" -L/usr/local/lib -o file16f20d9e181.so file16f20d9e181.o  '/usr/local/lib/R/site-library/rstan/lib//libStanServices.a' -L'/usr/local/lib/R/site-library/StanHeaders/lib/' -lStanHeaders -L'/usr/local/lib/R/site-library/RcppParallel/lib/' -ltbb  -L"/usr/local/lib/R/lib" -lR; \
  g++ -std=gnu++14 -shared -L"/usr/local/lib/R/lib" -L/usr/local/lib -o file16f20d9e181.so file16f20d9e181.o  '/usr/local/lib/R/site-library/rstan/lib//libStanServices.a' -L'/usr/local/lib/R/site-library/StanHeaders/lib/' -lStanHeaders -L'/usr/local/lib/R/site-library/RcppParallel/lib/' -ltbb  -L"/usr/local/lib/R/lib" -lR; \
fi

after adding the Makevars, it changes:

> mod <- stan_model("schools.stan", verbose=TRUE)

TRANSLATING MODEL 'schools' FROM Stan CODE TO C++ CODE NOW.
successful in parsing the Stan model 'schools'.
COMPILING THE C++ CODE FOR MODEL 'schools' NOW.
OS: x86_64, linux-gnu; rstan: 2.21.2; Rcpp: 1.0.6; inline: 0.3.17 
 >> setting environment variables: 
PKG_LIBS =  '/usr/local/lib/R/site-library/rstan/lib//libStanServices.a' -L'/usr/local/lib/R/site-library/StanHeaders/lib/' -lStanHeaders -L'/usr/local/lib/R/site-library/RcppParallel/lib/' -ltbb
PKG_CPPFLAGS =   -I"/usr/local/lib/R/site-library/Rcpp/include/"  -I"/usr/local/lib/R/site-library/RcppEigen/include/"  -I"/usr/local/lib/R/site-library/RcppEigen/include/unsupported"  -I"/usr/local/lib/R/site-library/BH/include" -I"/usr/local/lib/R/site-library/StanHeaders/include/src/"  -I"/usr/local/lib/R/site-library/StanHeaders/include/"  -I"/usr/local/lib/R/site-library/RcppParallel/include/"  -I"/usr/local/lib/R/site-library/rstan/include" -DEIGEN_NO_DEBUG  -DBOOST_DISABLE_ASSERTS  -DBOOST_PENDING_INTEGER_LOG2_HPP  -DSTAN_THREADS  -DBOOST_NO_AUTO_PTR  -include '/usr/local/lib/R/site-library/StanHeaders/include/stan/math/prim/mat/fun/Eigen.hpp'  -D_REENTRANT -DRCPP_PARALLEL_USE_TBB=1 
 >> Program source :
...
make cmd is
  make -f '/usr/local/lib/R/etc/Makeconf' -f '/usr/local/lib/R/share/make/shlib.mk' -f '/home/rstudio/.R/Makevars' CXX='$(CXX14) $(CXX14STD)' CXXFLAGS='$(CXX14FLAGS)' CXXPICFLAGS='$(CXX14PICFLAGS)' SHLIB_LDFLAGS='$(SHLIB_CXX14LDFLAGS)' SHLIB_LD='$(SHLIB_CXX14LD)' SHLIB='file16f67e794ea.so' OBJECTS='file16f67e794ea.o'

make would use
**clang++** -std=gnu++14 -I"/usr/local/lib/R/include" -DNDEBUG   -I"/usr/local/lib/R/site-library/Rcpp/include/"  -I"/usr/local/lib/R/site-library/RcppEigen/include/"  -I"/usr/local/lib/R/site-library/RcppEigen/include/unsupported"  -I"/usr/local/lib/R/site-library/BH/include" -I"/usr/local/lib/R/site-library/StanHeaders/include/src/"  -I"/usr/local/lib/R/site-library/StanHeaders/include/"  -I"/usr/local/lib/R/site-library/RcppParallel/include/"  -I"/usr/local/lib/R/site-library/rstan/include" -DEIGEN_NO_DEBUG  -DBOOST_DISABLE_ASSERTS  -DBOOST_PENDING_INTEGER_LOG2_HPP  -DSTAN_THREADS  -DBOOST_NO_AUTO_PTR  -include '/usr/local/lib/R/site-library/StanHeaders/include/stan/math/prim/mat/fun/Eigen.hpp'  -D_REENTRANT -DRCPP_PARALLEL_USE_TBB=1   -I/usr/local/include   -fpic  -O3 -march=native -mtune=native -fPIC -c file16f67e794ea.cpp -o file16f67e794ea.o
if test  "zfile16f67e794ea.o" != "z"; then \
  echo clang++ -std=gnu++14 -shared -L"/usr/local/lib/R/lib" -L/usr/local/lib -o file16f67e794ea.so file16f67e794ea.o  '/usr/local/lib/R/site-library/rstan/lib//libStanServices.a' -L'/usr/local/lib/R/site-library/StanHeaders/lib/' -lStanHeaders -L'/usr/local/lib/R/site-library/RcppParallel/lib/' -ltbb  -L"/usr/local/lib/R/lib" -lR; \
  clang++ -std=gnu++14 -shared -L"/usr/local/lib/R/lib" -L/usr/local/lib -o file16f67e794ea.so file16f67e794ea.o  '/usr/local/lib/R/site-library/rstan/lib//libStanServices.a' -L'/usr/local/lib/R/site-library/StanHeaders/lib/' -lStanHeaders -L'/usr/local/lib/R/site-library/RcppParallel/lib/' -ltbb  -L"/usr/local/lib/R/lib" -lR; \
fi 

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.