Skip to content

stefan-m-lenz/dsBoltzmannMachinesClient

Repository files navigation

dsBoltzmannMachinesClient

This is the client side R package for using Deep Boltzmann machines as generative models in DataSHIELD. It depends on the BoltzmannMachineRPlots package and on the basic DataSHIELD client package.

The corresponding server side R package is dsBoltzmannMachines.

More information can be found in the article

Lenz, S., Hess, M. & Binder, H. Deep generative models in DataSHIELD. BMC Med Res Methodol 21, 64 (2021). https://doi.org/10.1186/s12874-021-01237-6

Installation

Client side

Execute the following R commands to install the client side package via the devtools package:

devtools::install_github("stefan-m-lenz/BoltzmannMachinesRPlots", ref = "v0.1.1")
devtools::install_github("stefan-m-lenz/dsBoltzmannMachinesClient", ref = "v1.0.2")

Server side

On the Opal server, the dsBoltzmannMachines must be installed on the R server of Opal. This requires that Julia and the BoltzmannMachines Julia package is also installed.

The following bash script, run with root provileges, can be used to set this up:

R -e 'install.packages("JuliaConnectoR")'

wget https://github.com/stefan-m-lenz/dsBoltzmannMachines/releases/download/v1.0.2/dsBoltzmannMachines_1.0.2.tar.gz
R -e 'install.packages("dsBoltzmannMachines_1.0.2.tar.gz", repos = NULL, type = "source")'
rm dsBoltzmannMachines_1.0.2.tar.gz


JULIA_VERSION=julia-1.0.5
wget https://julialang-s3.julialang.org/bin/linux/x64/1.0/$JULIA_VERSION-linux-x86_64.tar.gz
tar -xzf $JULIA_VERSION-linux-x86_64.tar.gz
rm $JULIA_VERSION-linux-x86_64.tar.gz
mkdir /opt/julia
mv $JULIA_VERSION /opt/julia/$JULIA_VERSION/
ln -s /opt/julia/$JULIA_VERSION/bin/julia /usr/local/bin/julia

# Set JULIA_BINDIR environment variable for the rserver
# and install the BoltzmannMachines Julia package as user "rserver".
BOLTZMANN_UPDATE_CMD=$(cat << 'END'
julia -e 'using Pkg; Pkg.add(PackageSpec(name = "BoltzmannMachines", version = "1.2"))'
END
)
su -s "/bin/bash" rserver -c "$BOLTZMANN_UPDATE_CMD"
JULIA_BINDIR="/opt/julia/$JULIA_VERSION/bin/"
echo "JULIA_BINDIR=$JULIA_BINDIR" >> /etc/environment
printf "\nSys.setenv(JULIA_BINDIR=\"$JULIA_BINDIR\")\n\n" >> /var/lib/rserver/conf/Rprofile.R

For the environment variabes set in the R server to take effect, the R server needs to be restarted. If Opal has been installed via the RPM package, this can be done via service rserver restart.