1 Setup

1.1 Install the latest rtemis version from GitHub

You can run the install_github command as often as you like: it will only work if there is an update available on GitHub. It will install rtemis with a minimal set of dependencies. A dependency check is run each time a function is called and will tell you if a package is missing. Install the following packages to begin with a reasonable lightweight setup:

1.2 RStudio

You can run rtemis in the command line or using the IDE of your choice. RStudio is the preferred environment and can be downloaded here

1.3 macOS

1.3.1 Prerequisites

If you are installing on macOS, make sure you have installed:

Note on R + Java on macOS: In order to run some R packages that use rJava, like bartMachine, you may need to add a link to libjvm.dylib inside your R lib folder as explained here

1.3.2 Using Apple’s BLAS

You can speed up matrix operations by using Apple’s Basic Linear Algebra Subprograms (BLAS) instead of the default R BLAS. At the MacOS terminal:

Restart R and check the version of BLAS in use:

R version 3.6.1 (2019-07-05)
Platform: x86_64-apple-darwin15.6.0 (64-bit)
Running under: macOS Mojave 10.14.5

Matrix products: default
BLAS:   /Library/Frameworks/R.framework/Versions/3.6/Resources/lib/libRblas.0.dylib
LAPACK: /Library/Frameworks/R.framework/Versions/3.6/Resources/lib/libRlapack.dylib

locale:
[1] en_US.UTF-8/en_US.UTF-8/en_US.UTF-8/C/en_US.UTF-8/en_US.UTF-8

attached base packages:
[1] stats     graphics  grDevices utils     datasets  methods   base     

loaded via a namespace (and not attached):
 [1] compiler_3.6.1   magrittr_1.5     bookdown_0.12    tools_3.6.1     
 [5] htmltools_0.3.6  yaml_2.2.0       Rcpp_1.0.2       fansi_0.4.0     
 [9] codetools_0.2-16 stringi_1.4.3    rmarkdown_1.14   knitr_1.23      
[13] stringr_1.4.0    xfun_0.8         digest_0.6.20    evaluate_0.14   

Benchmarks suggest substantial speed gains for some operations.

1.4 External frameworks

The following are all optional - install as needed.

1.4.1 MXNet

To use MXNet (s.MXN), you need to install the MXNet system libraries first and then the R package. Follow instructions on the MXNet website.
This will first require installation of more system dependencies, which can be installed using Brew

1.4.2 H2O

To use H2O (d.H2OGLRM, s.H2ODL.R, s.H2OGBM.R, s.H2ORF, u.H2OKMEANS), you will need to install H2O first. Follow instructions on the H2O website.

1.4.3 Spark

To use Spark’s ML framework (s.MLGBM, s.MLMP, s.MLRF), installation can be performed within R:

1.4.4 Keras + TensorFlow

You can easily install Keras for R and the TensorFlow library:

Learn more on the RStudio website

1.5 Load rtemis

  .:rtemis 0.79: Welcome, egenn
  [x86_64-apple-darwin15.6.0 (64-bit): Defaulting to 4/4 available cores]
  Online documentation & vignettes: https://rtemis.netlify.com

1.6 Setup project directories

rtemis includes a function and RStudio addin to initialize a simple directory structure under the working directory for your data analysis projects with the following:

  • ./R/
    Directory to save your project .R code files
  • ./Data/
    Directory to save your project data files, e.g. .rds, .csv, etc
  • ./Results/
    Directory to save your output, e.g. rtemis supervised learning output directories (define using outdir, e.g. outdir = "./Results/Dataset_Algorithm")
  • ./rtInit.log
    Log file with R session info

Call the function directly or use RStudio’s Addins drop down menu:

[2019-08-20 09:52:19 rtInitProjectDir] Working in /Users/egenn/Library/Mobile Documents/com~apple~CloudDocs/Projects/rtemis/rtemisWeb_bookdown _v3... 
  Creating 'R' folder... Already present
  Creating 'Data' folder... Already present
  Creating 'Results' folder... Already present
  All done

rtemis RStudio addin

Figure 1.1: rtemis RStudio addin

1.7 Notes on this bookdown website format

Graphviz-based graphics, used to plot decision trees and MXNet graphs, appear a little off on this html output. The text is slightly oversized for the given box size - will hopefully be solved in the near future.

rtemis running in RStudio with the (recommended) dark theme

Figure 1.2: rtemis running in RStudio with the (recommended) dark theme