Implementation of a linear regression in R
The goal of this project is to create a Docker image containing the full R environment capable of:
- Read parameters from the environment and connect to a database
- Query the database and prepare the data
- Run the algorithm (here, a linear regression)
- Format the results into a format that can be easily shared. We are using the PFA format here in its YAML form. It will get translated to JSON automatically be the workflow application which provides web services which execute this Docker container.
- Save the results into the result database.
The Docker image should contain a R script at /src/main.R as well as all libraries and files that this script depends on.
The following scripts are provided to help you:
The main build script, it packages this project into a Docker image and performs the tests. It requires captain and Docker engine to run. If you cannot install captain on your platform, you may use the following commands to build the project:
docker build -t hbpmip/r-linear-regression .
./tests/test.sh
This script provides a R runtime executed inside a Docker container. It also starts an input database and a result database.
To develop the main.R script, you should type the following in the R shell:
library(devtools)
devtools::install_github("LREN-CHUV/hbplregress")
source(\"/src/main.R\")
This script performs the tests. It assumes that the image has been built before using ./build.sh
It executes the Docker image and starts an input database and a result database.
You can run the tests interactively using this environment with the command
./tests/test.sh --interactive
Install Titus from OpenDatagroup Hadrian
Titus provides a tool called pfainspector
Check the validity of the PFA output of this algorithm with the following procedure:
- Read the yaml document from the database ('data' column)
- Convert the document from YAML to JSON, for example using yamltojson.com
- Start pfainspector
- Load the json
load lreg_output.json as lreg_output
- Validate the json
pfa validate lreg_output