-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
4dbc75e
commit 40fe093
Showing
26 changed files
with
1,250 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
# DO NOT MODIFY THIS FILE MANUALLY. | ||
# This file contains the answers to the questions asked by the | ||
# v6-algorithm-template-creator (using the Copier package). The answers will | ||
# be updated if you re-run the template creator. Also, the answers in this file | ||
# may be used to submit your algorithm to a vantage6 algorithm store. | ||
_commit: 4.3.4 | ||
_src_path: gh:vantage6/v6-algorithm-template.git | ||
advanced: true | ||
algorithm_description: Federated algorithm for baseline hazard curve in Vantage6 v4 | ||
algorithm_name: coxph | ||
author: VG | ||
central_args: | ||
- time_col | ||
- outcome_col | ||
- expl_vars | ||
- organization_ids | ||
central_function_client: true | ||
central_function_data: false | ||
central_function_name: central | ||
copyright: '' | ||
docker_image: v6-coxph | ||
has_central_function: true | ||
has_docs: true | ||
has_gh_pipeline: true | ||
has_partial_function: true | ||
open_source_license: apache | ||
partial_args: | ||
- time_col | ||
- outcome_col | ||
- expl_vars | ||
- organization_ids | ||
partial_function_client: true | ||
partial_function_data: true | ||
partial_function_name: get_unique_event_times | ||
partial_function_number_databases: 2 | ||
private_registry: false | ||
project_name: coxph | ||
use_vpn: false |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
name: Create Release | ||
|
||
on: | ||
push: | ||
branches: | ||
- main | ||
|
||
jobs: | ||
create-docker-image: | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- name: Checkout Repository | ||
uses: actions/checkout@v4 | ||
|
||
- name: Login to Docker registry | ||
uses: docker/login-action@v3 | ||
with: | ||
username: ${{ secrets.DOCKER_USER }} | ||
password: ${{ secrets.DOCKER_PASSWORD }} | ||
|
||
- name: Run Makefile Rule | ||
run: docker build -t v6-coxph . | ||
|
||
- name: Push Docker image | ||
run: | | ||
docker push v6-coxph |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,106 @@ | ||
# Byte-compiled / optimized / DLL files | ||
__pycache__/ | ||
*.py[cod] | ||
*$py.class | ||
|
||
# C extensions | ||
*.so | ||
|
||
# Distribution / packaging | ||
.Python | ||
build/ | ||
develop-eggs/ | ||
dist/ | ||
downloads/ | ||
eggs/ | ||
.eggs/ | ||
lib/ | ||
lib64/ | ||
parts/ | ||
sdist/ | ||
var/ | ||
wheels/ | ||
*.egg-info/ | ||
.installed.cfg | ||
*.egg | ||
MANIFEST | ||
|
||
# PyInstaller | ||
# Usually these files are written by a python script from a template | ||
# before PyInstaller builds the exe, so as to inject date/other infos into it. | ||
*.manifest | ||
*.spec | ||
|
||
# Installer logs | ||
pip-log.txt | ||
pip-delete-this-directory.txt | ||
|
||
# Unit test / coverage reports | ||
htmlcov/ | ||
.tox/ | ||
.coverage | ||
.coverage.* | ||
.cache | ||
nosetests.xml | ||
coverage.xml | ||
*.cover | ||
.hypothesis/ | ||
.pytest_cache/ | ||
|
||
# Translations | ||
*.mo | ||
*.pot | ||
|
||
# Django stuff: | ||
*.log | ||
local_settings.py | ||
db.sqlite3 | ||
|
||
# Flask stuff: | ||
instance/ | ||
.webassets-cache | ||
|
||
# Scrapy stuff: | ||
.scrapy | ||
|
||
# Sphinx documentation | ||
docs/_build/ | ||
|
||
# PyBuilder | ||
target/ | ||
|
||
# Jupyter Notebook | ||
.ipynb_checkpoints | ||
|
||
# pyenv | ||
.python-version | ||
|
||
# celery beat schedule file | ||
celerybeat-schedule | ||
|
||
# SageMath parsed files | ||
*.sage.py | ||
|
||
# Environments | ||
.env | ||
.venv | ||
env/ | ||
venv/ | ||
ENV/ | ||
env.bak/ | ||
venv.bak/ | ||
|
||
# Spyder project settings | ||
.spyderproject | ||
.spyproject | ||
|
||
# Rope project settings | ||
.ropeproject | ||
|
||
# mkdocs documentation | ||
/site | ||
|
||
# mypy | ||
.mypy_cache/ | ||
|
||
.vscode/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
# basic python3 image as base | ||
FROM harbor2.vantage6.ai/infrastructure/algorithm-base | ||
|
||
# This is a placeholder that should be overloaded by invoking | ||
# docker build with '--build-arg PKG_NAME=...' | ||
ARG PKG_NAME="coxph" | ||
|
||
# install federated algorithm | ||
COPY coxph /app | ||
RUN pip install /app | ||
|
||
|
||
# Set environment variable to make name of the package available within the | ||
# docker image. | ||
ENV PKG_NAME=${PKG_NAME} | ||
|
||
# Tell docker to execute `wrap_algorithm()` when the image is run. This function | ||
# will ensure that the algorithm method is called properly. | ||
CMD python -c "from vantage6.algorithm.tools.wrap import wrap_algorithm; wrap_algorithm()" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,58 @@ | ||
# v6-baseline-hazard | ||
Federated algorithm for baseline hazard curve in Vantage6 v4 | ||
|
||
# coxph | ||
|
||
Federated algorithm for a coxph model in Vantage6 v4 | ||
|
||
This algorithm is designed to be run with the [vantage6](https://vantage6.ai) | ||
infrastructure for distributed analysis and learning. | ||
|
||
The base code for this algorithm has been created via the | ||
[v6-algorithm-template](https://github.com/vantage6/v6-algorithm-template) | ||
template generator. | ||
|
||
### Dockerizing your algorithm | ||
|
||
To finally run your algorithm on the vantage6 infrastructure, you need to | ||
create a Docker image of your algorithm. | ||
|
||
#### Automatically | ||
|
||
The easiest way to create a Docker image is to use the GitHub Actions pipeline to | ||
automatically build and push the Docker image. All that you need to do is push a | ||
commit to the ``main`` branch. | ||
|
||
#### Manually | ||
|
||
A Docker image can be created by executing the following command in the root of your | ||
algorithm directory: | ||
|
||
```bash | ||
docker build -t [my_docker_image_name] . | ||
``` | ||
|
||
where you should provide a sensible value for the Docker image name. The | ||
`docker build` command will create a Docker image that contains your algorithm. | ||
You can create an additional tag for it by running | ||
|
||
```bash | ||
docker tag [my_docker_image_name] [another_image_name] | ||
``` | ||
|
||
This way, you can e.g. do | ||
`docker tag local_average_algorithm harbor2.vantage6.ai/algorithms/average` to | ||
make the algorithm available on a remote Docker registry (in this case | ||
`harbor2.vantage6.ai`). | ||
|
||
Finally, you need to push the image to the Docker registry. This can be done | ||
by running | ||
|
||
```bash | ||
docker push [my_docker_image_name] | ||
``` | ||
|
||
Note that you need to be logged in to the Docker registry before you can push | ||
the image. You can do this by running `docker login` and providing your | ||
credentials. Check [this page](https://docs.docker.com/get-started/04_sharing_app/) | ||
For more details on sharing images on Docker Hub. If you are using a different | ||
Docker registry, check the documentation of that registry and be sure that you | ||
have sufficient permissions. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,71 @@ | ||
{ | ||
"name": "coxph", | ||
"image": "v6-coxph", | ||
"vantage6_version": "4.3", | ||
"partitioning": "horizontal", | ||
"functions": [ | ||
{ | ||
"name": "central", | ||
"description": "Federated algorithm for baseline hazard curve in Vantage6 v4", | ||
"type": "central", | ||
"databases": [], | ||
"arguments": [ | ||
{ | ||
"name": "time_col", | ||
"type": "", | ||
"description": "" | ||
}, | ||
{ | ||
"name": "outcome_col", | ||
"type": "", | ||
"description": "" | ||
}, | ||
{ | ||
"name": "expl_var", | ||
"type": "", | ||
"description": "" | ||
}, | ||
{ | ||
"name": "organization_ids", | ||
"type": "", | ||
"description": "" | ||
} | ||
] | ||
}, | ||
{ | ||
"name": "get_unique_event_times", | ||
"description": "", | ||
"type": "federated", | ||
"databases": [ | ||
{ | ||
"name": "Database 1" | ||
}, | ||
{ | ||
"name": "Database 2" | ||
} | ||
], | ||
"arguments": [ | ||
{ | ||
"name": "time_col", | ||
"type": "", | ||
"description": "" | ||
}, | ||
{ | ||
"name": "outcome_col", | ||
"type": "", | ||
"description": "" | ||
}, | ||
{ | ||
"name": "expl_var", | ||
"type": "", | ||
"description": "" | ||
}, | ||
{ | ||
"name": "organization_ids", | ||
"type": "", | ||
"description": "" | ||
} | ||
] | ||
} | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
from .central import * | ||
from .partial import * |
Oops, something went wrong.