Skip to main content

Secure Federated Learning Platform

Project description

FeatureCloud

For registering and testing your apps or using other apps, please visit FeatureCloud.ai. And for more information about FeatureCloud architecture, please refer to The FeatureCloud AI Store for Federated Learning in Biomedicine and Beyond [1].

Developing Apps using FeatureCloud library

FeatureCloud library facilitates app development inside the FeatureCloud platform. To develop apps, developers should define their states and register them to the default app.

defining new states

For defining new states, in general, developers can use AppState which supports different communications, transitions, logging, and operations.

AppState

AppState is the building block of FeatureCloud apps that covers all the scenarios with the verifying mechanism. Each state of the app should extend AppState, which is an abstract class with two specific abstract methods:

  • register: should be implemented by apps to register possible transitions between the current state to other states. This method is part of verifying mechanism in FeatureCloud apps that ensures logically eligible roles can participate in the current state and transition to other ones.
  • run: executes all operations and calls for communication between FeatureCloud clients. run is another part of the verification mechanism in FeatureCloud library, that ensures the transitions to other states are logically correct by returning the name of the next state.

Registering apps

For each state, developers should extend one of the abstract states and call the helper function to automatically register the state in the default FeatureCloud app:

@app_state(name='initial', role=Role.BOTH, app_name='example')
class ExampleState(AppState):
    def register(self):
        self.register_transition('terminal', Role.BOTH)

    def run(self):
        self.read_config()
        self.app.log(self.config)
        return 'terminal'

building the app docker image

Once app implementation is done, for building the docker image for testing, or adding it to FeatureCloud AI store, developers should provide following files.

Dockerization files

For dockerizing apps, regardless of their applications, there should be some specific files:

  1. Dockerfile
  2. build.sh
  3. server-config

Developers should ensure that these files with same structure and content are exist in the same directory as their app implementation.

App-specific files

All app-specific files should be included data or codes that are strictly dependent to app's functionality.

main.py

Each app should be implemented in a directory that includes the main.py file which in turn includes either direct implementation of states or importing them. Moreover, main should import bottle and api package:

from bottle import Bottle

from api.http_ctrl import api_server
from api.http_web import web_server

import apps.examples.dice

from engine.app import app

server = Bottle()

Here we imported dice app from our apps package which because of putting app_state on top of state classes, merely importing the states register them into the app instance.

For running the app, inside a docker container, app.register() should be called to register and verify all transitions; next, api and servers should mount at corresponding paths; and finally server is ready to run the app.

    app.register()
    server.mount('/api', api_server)
    server.mount('/web', web_server)
    server.run(host='localhost', port=5000)

All of aforementioned codes, except for importing the app, or alternatively, implementing states, can be exactly same for all apps.

requirements.txt

for installing required python libraries inside the docker image, developers should provide a list of libraries in requirements.txt. Some requirements are necessary for FeatureCloud library, which should always be listed, are:

bottle
jsonpickle
joblib
numpy
bios
pydot
pyyaml

And the rest should be all other app required libraries.

config.yml

Each app may need some hyper-parameters or arguments that should be provided by the end-users. Such data should be included in config.yml which should be read and interpreted by the app.

References

[1] Matschinske, J., Späth, J., Nasirigerdeh, R., Torkzadehmahani, R., Hartebrodt, A., Orbán, B., Fejér, S., Zolotareva, O., Bakhtiari, M., Bihari, B. and Bloice, M., 2021. The FeatureCloud AI Store for Federated Learning in Biomedicine and Beyond. arXiv preprint arXiv:2105.05734.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

FeatureCloud-0.0.2.tar.gz (16.5 kB view details)

Uploaded Source

File details

Details for the file FeatureCloud-0.0.2.tar.gz.

File metadata

  • Download URL: FeatureCloud-0.0.2.tar.gz
  • Upload date:
  • Size: 16.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.7.1 importlib_metadata/4.8.2 pkginfo/1.8.2 requests/2.22.0 requests-toolbelt/0.9.1 tqdm/4.56.1 CPython/3.8.10

File hashes

Hashes for FeatureCloud-0.0.2.tar.gz
Algorithm Hash digest
SHA256 4c13bc6071fd379d35a328b359d740192e535ebcf4e4374310ef621ffe5632fb
MD5 6b25f544f45cbf27dfeae02774ee79f9
BLAKE2b-256 8201f6a3863d6b8fb0d73cd302d57f902eb03a6f1d6d57f932778b48d9d44d87

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page