Skip to content
This repository has been archived by the owner on Oct 24, 2023. It is now read-only.

IKNL/v6-boilerplate-py

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

42 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation


vantage6

A privacy preserving federated learning solution


This repository is no longer maintained. Vantage6 now provides a flexible algorithm boilerplate generator. You can use that via the vantage6 command line interface command v6 algorithm create. For more details, see https://docs.vantage6.ai/en/main/algorithms/develop.html.

v6-boilerplate-py

This algorithm is part of the vantage6 solution. Vantage6 allowes to execute computations on federated datasets. This repository provides a boilerplate for new algorithms.

Usage

First clone the repository.

# Clone this repository
git clone https://github.com/IKNL/v6-boilerplate-py

Rename the directories to something that fits your algorithm, we use the convention v6-{name}-{language}. Then you can edit the following files:

Dockerfile

Update the ARG PKG_NAME=... to the name of your algorithm (preferable the same as the directory name).

LICENSE

Determine which license suits your project.

{algorithm_name}/__init__.py

This file contains all the methods that can be called at the nodes. In the example below, one example function is shown.

import pandas as pd
from vantage6.client.algorithm_client import AlgorithmClient

@algorithm_client
@data(1)
def my_function(client: AlgorithmClient, df1: pd.DataFrame, column_name: str):
    pass

This function uses an @algorithm_client decorator to insert an algorithm client, which can be used to e.g. create subtasks or find the VPN addresses of algorithm containers within the same task running on other nodes. Also, the @data decorator is used to insert a single pandas dataframe. This requires the user creating a task to specify one database when calling this function. Note that you can specify any number x in data(x). The number that you specify will determine how many databases will be added to your function profile.

setup.py

In order for the Docker image to find the methods the algorithm needs to be installable. Make sure the name matches the ARG PKG_NAME in the Dockerfile.

Also, make sure to add any dependencies that your algorithm needs to setup.py and requirements.txt!

Read more

See the documentation for detailed instructions on how to install and use the server and nodes.


vantage6

About

Boilerplate for new vantage6 algorithms

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published