Skip to content

Commit

Permalink
Merge pull request #1 from HBPMedical/master
Browse files Browse the repository at this point in the history
Merge latest HBPmedical/algorithm-repository to bldrvnlw fork
  • Loading branch information
bldrvnlw authored Oct 5, 2017
2 parents 1268aae + 506f205 commit 8557e9a
Show file tree
Hide file tree
Showing 70 changed files with 2,784 additions and 1,931 deletions.
4 changes: 2 additions & 2 deletions Guidelines.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,8 @@ Step-by-Step Guidelines

1. **Go to** GitHub

2. **Clone** the *functions-repository* folder -
<https://github.com/LREN-CHUV/functions-repository>
2. **Clone** the *algorithm-repository* folder -
<https://github.com/LREN-CHUV/algorithm-repository>

3. **Go to** the root folder of your cloned project

Expand Down
13 changes: 8 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
[![CHUV](https://img.shields.io/badge/CHUV-LREN-AF4C64.svg)](https://www.unil.ch/lren/en/home.html) [![Codacy Badge](https://api.codacy.com/project/badge/Grade/26aff9cefde9484c8c75794195fcf448)](https://www.codacy.com/app/hbp-mip/functions-repository?utm_source=github.com&amp;utm_medium=referral&amp;utm_content=HBPMedical/functions-repository&amp;utm_campaign=Badge_Grade) [![CircleCI](https://circleci.com/gh/HBPMedical/functions-repository.svg?style=svg)](https://circleci.com/gh/HBPMedical/functions-repository)
[![CHUV](https://img.shields.io/badge/CHUV-LREN-AF4C64.svg)](https://www.unil.ch/lren/en/home.html) [![Codacy Badge](https://api.codacy.com/project/badge/Grade/a170b1b08f81441f85c004480ddaac0f)](https://www.codacy.com/app/hbp-mip/algorithm-repository?utm_source=github.com&amp;utm_medium=referral&amp;utm_content=HBPMedical/algorithm-repository&amp;utm_campaign=Badge_Grade) [![CircleCI](https://circleci.com/gh/HBPMedical/algorithm-repository.svg?style=svg)](https://circleci.com/gh/HBPMedical/algorithm-repository)

# Functions repository
# Algorithm repository

This is the repository of functions for the [MIP](https://mip.humanbrainproject.eu).
This is the repository of algorithms for the [MIP](https://mip.humanbrainproject.eu).

Functions, written in their native language (R, Matlab, Python, Java...) are encapsulated in a Docker container that provides them with the runtime environment necessary to execute this function.
Algorithms, written in their native language (R, Matlab, Python, Java...) are encapsulated in a Docker container that provides them with the runtime environment necessary to execute this function.

The environment variables provided to the Docker container are used as parameters to the function or algorithm to execute.

Expand All @@ -14,4 +14,7 @@ Currently, we expect the Docker containers to be autonomous:
* they should process the data, taking into account the parameters given as environment variables to the Docker container
* they should store the results into the results database.

The format of the results should be easily shared. We are using the [PFA format](http://dmg.org/pfa/) 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.
The format of the results should be easily shared.

* For algorithms providing statistical analysis or machine learning, we require the results to be in [PFA format](http://dmg.org/pfa/) in its YAML or JSON form.
* For algorithms providing visualisations, we support different formats, including Highcharts, Vis.js, PNG and SVG.
2 changes: 1 addition & 1 deletion java-rapidminer-knn/.bumpversion.cfg
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[bumpversion]
current_version = 0.1.0
current_version = 0.2.1
commit = True
tag = True
tag_name = java-rapidminer-knn-{new_version}
Expand Down
20 changes: 10 additions & 10 deletions java-rapidminer-knn/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM hbpmip/java-base-build:3.5.0-jdk-8-6 as build-java-env
FROM hbpmip/java-base-build:3.5.0-jdk-8-8 as build-java-env

COPY pom.xml /project/pom.xml
COPY src/ /project/src
Expand All @@ -7,17 +7,17 @@ COPY src/ /project/src
RUN cp /usr/share/maven/ref/settings-docker.xml /root/.m2/settings.xml \
&& mvn package site

FROM hbpmip/java-rapidminer:0.4.1
FROM hbpmip/java-rapidminer:0.9.0

MAINTAINER [email protected]

ENV DOCKER_IMAGE=hbpmip/java-rapidminer-knn:0.1.0
ENV JAVA_CLASSPATH=${JAVA_CLASSPATH}:/usr/share/jars/java-rapidminer-knn.jar
ENV JAVA_ARGS=eu.hbp.mip.container.rapidminer.models.Knn
ENV MODEL knn
ENV FUNCTION java-rapidminer-knn
ENV DOCKER_IMAGE=hbpmip/java-rapidminer-knn:0.2.1 \
JAVA_CLASSPATH=${JAVA_CLASSPATH}:/usr/share/jars/java-rapidminer-knn.jar \
JAVA_ARGS=/eu/humanbrainproject/mip/algorithms/rapidminer/knn/settings.properties \
MODEL="k-NN" \
FUNCTION=java-rapidminer-knn

COPY --from=build-java-env /project/target/java-rapidminer-knn.jar /usr/share/jars/java-rapidminer-knn.jar
COPY --from=build-java-env /project/target/knn.jar /usr/share/jars/java-rapidminer-knn.jar
COPY --from=build-java-env /project/target/site/ /var/www/html/
COPY src/ /src/

Expand All @@ -27,9 +27,9 @@ RUN chown -R compute:compute /src/ \
LABEL org.label-schema.build-date=$BUILD_DATE \
org.label-schema.name="hbpmip/java-rapidminer-knn" \
org.label-schema.description="KNN algorithm" \
org.label-schema.url="https://github.com/LREN-CHUV/functions-repository" \
org.label-schema.url="https://github.com/LREN-CHUV/algorithm-repository" \
org.label-schema.vcs-type="git" \
org.label-schema.vcs-url="https://github.com/LREN-CHUV/functions-repository.git" \
org.label-schema.vcs-url="https://github.com/LREN-CHUV/algorithm-repository.git" \
org.label-schema.vcs-ref=$VCS_REF \
org.label-schema.version="$VERSION" \
org.label-schema.vendor="LREN CHUV" \
Expand Down
17 changes: 9 additions & 8 deletions java-rapidminer-knn/README.md
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
[![DockerHub](https://img.shields.io/badge/docker-hbpmip%2Fjava--rapidminer--knn-008bb8.svg)](https://hub.docker.com/r/hbpmip/java-rapidminer-knn/) [![ImageVersion](https://images.microbadger.com/badges/version/hbpmip/java-rapidminer-knn.svg)](https://hub.docker.com/r/hbpmip/java-rapidminer-knn/tags "hbpmip/java-rapidminer-knn image tags") [![ImageLayers](https://images.microbadger.com/badges/image/hbpmip/java-rapidminer-knn.svg)](https://microbadger.com/#/images/hbpmip/java-rapidminer-knn "hbpmip/java-rapidminer-knn on microbadger")
[![CHUV](https://img.shields.io/badge/CHUV-LREN-AF4C64.svg)](https://www.unil.ch/lren/en/home.html) [![DockerHub](https://img.shields.io/badge/docker-hbpmip%2Fjava--rapidminer--knn-008bb8.svg)](https://hub.docker.com/r/hbpmip/java-rapidminer-knn/) [![ImageVersion](https://images.microbadger.com/badges/version/hbpmip/java-rapidminer-knn.svg)](https://hub.docker.com/r/hbpmip/java-rapidminer-knn/tags "hbpmip/java-rapidminer-knn image tags") [![](https://images.microbadger.com/badges/version/hbpmip/java-rapidminer-knn.svg)](https://microbadger.com/images/hbpmip/java-rapidminer-knn "Get your own version badge on microbadger.com") [![ImageLayers](https://images.microbadger.com/badges/image/hbpmip/java-rapidminer-knn.svg)](https://microbadger.com/#/images/hbpmip/java-rapidminer-knn "hbpmip/java-rapidminer-knn on microbadger")

# java-rapidminer-knn

Implementation of the KNN algorithm using RapidMiner
Implementation of the [KNN](https://en.wikipedia.org/wiki/K-nearest_neighbors_algorithm) algorithm using RapidMiner

## Usage

```
docker run --rm --env [list of environment variables] hbpmip/java-rapidminer-knn:0.0.1 compute
docker run --rm --env [list of environment variables] hbpmip/java-rapidminer-knn:0.2.1 compute
```

Expand All @@ -26,16 +26,16 @@ where the environment variables are:
* PARAM_variables: Name of the target variable (only one variable is supported for KNN)
* PARAM_covariables: List of covariables
* PARAM_query: Query selecting the variables and covariables to feed into the algorithm for training.
* PARAM_MODEL_k: Number of class labels to search for.
* MODEL_PARAM_k (or PARAM_MODEL_k for compatibility): Number of class labels to search for.

## Development process

The goal of this project is to create a Docker image containing the full R environment capable of:

1. Read parameters from the environment and connect to a database
2. Query the database and prepare the data
3. Run the algorithm (here, a linear regression)
4. Format the results into a format that can be easily shared. We are using the [PFA format](http://dmg.org/pfa/) 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.
3. Run the algorithm (here, KNN)
4. Format the results into a format that can be easily shared. We are using the [PFA format](http://dmg.org/pfa/) here in its JSON form.
5. Save the results into the result database.

The Docker image should contain the binaries and resources that this algorithm depends on.
Expand All @@ -48,8 +48,9 @@ The main build script, it packages this project into a Docker image and performs
It requires [captain](https://github.com/harbur/captain) and [Docker engine](https://www.docker.com/) 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
captain build
# or
docker build -t hbpmip/java-rapidminer-knn .
```

### `./tests/test.sh`
Expand Down
Loading

0 comments on commit 8557e9a

Please sign in to comment.