Skip to main content

A privacy-aware federated computing scheme to let non-trusted clients perform statistical analysis.

Project description

FedMed

A privacy-aware federated computing scheme to let non-trusted clients perform statistical analysis. Process data scattered across multiple servers, each with its own privacy policy.

Quickstart client

Set up communication channels with remote data fragments (i.e., parts of the same dataset) and organize them into one dataset. Datasets are allowed to only partially match in terms of structure and operations.

import fedmed as fm
sources = [
    fm.Remote(ip="http://127.0.0.1:8000", fragment="test array part 1"),
    fm.Remote(ip="http://127.0.0.1:8000", fragment="test array part 2")
]
data = fm.FedData(sources, config="config.yaml")

Call simple operations among those described in the configuration file config.yaml (find a first default in the example/ folder). The same file could be shared between the client and servers, but this is not mandatory; some servers may not support some of these capabilities, in which case you will fail dependent computations you will try to run.

Operations are performed under a map-reduce scheme. The map is performed in the servers, and the reduce on the client. Each server is left in control of both how it performs its namesake map methods, and how it distorts outcomes to comply with some privacy policy.

mean = data.sum() / data.len()
print('Mean', mean)

:lock: Control of map operations allows server owners to set their own privacy policies. For example, they may share new internal data compared to old ones only when enough new samples are gathered (in the interim, outcomes on older versions of the dataset will be exposed).

For the above code to run, you need to set up some devices to run at the respective ip addresses.

Set up a server

Data servers host your data for clients to use. Custom map operations of the map-reduce scheme are specified in the configuration file. Sometimes, you will have the same configuration for your servers and the client that uses them. Otherwise, find a first default in the example/ folder, and replace the paths to implementations with your own. Also remove any operations you do not want to support for privacy reasons.

import fedmed as fm
server = fm.Server(config="config.yaml")

:construction: Privacy policies may make fedmed.ops.private operations inexact.

Each server can contain fragments of several datasets. Load data as pandas dataframes or combinations of lists and dicts, and set them as fragments like below.

data = [1, 2, 3]  # or dict of lists, pandas dataframe, etc
server["test array part 1"] = data

Finally, run your server with a flask-supporing WSGI library, like waitress. This will let clients include it in data operations.

from waitress import serve

if __name__ == "__main__":
    serve(server.app, host="127.0.0.1", port=8000)

:globe_with_meridians: Set up a reverse proxy server to restrict who can perform operations on your system.

Project details


Download files

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

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distribution

FedMed-0.1.0-py3-none-any.whl (15.8 kB view details)

Uploaded Python 3

File details

Details for the file FedMed-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: FedMed-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 15.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.10.4

File hashes

Hashes for FedMed-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 8c2651ec6ad4c3da89b61b872fd917e46377edfe0ecf6b62860e382f23c2ad07
MD5 89549783d1db450ee9ac3d65244d8959
BLAKE2b-256 23a44b14d28d72cfbb4ea262e6d596491b74f526901c40ccc8ee189698fd511e

See more details on using hashes here.

Supported by

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