Skip to main content

A tool for benchmarking vertical federated learning algorithms, containing synthetic data split and data evaluation.

Project description

VertiBench: Vertical Federated Learning Benchmark

Introduction

VertiBench is a benchmark for federated learning, split learning, and assisted learning on vertical partitioned data. It provides tools to synthetic vertical partitioned data from a given global dataset. VertiBench supports partition under various imbalance and correlation level, effectively simulating a wide-range of real-world vertical federated learning scenarios.

data-dist-full.png

Installation

VertiBench has already been published on PyPI. The installation requires the installation of python>=3.9. To further install VertiBench, run the following command:

pip install vertibench

Getting Started

This examples includes the pipeline of split and evaluate. First, load your datasets or generate synthetic datasets.

from sklearn.datasets import make_classification

# Generate a large dataset
X, y = make_classification(n_samples=10000, n_features=10)

To split the dataset by importance,

from vertibench.Splitter import ImportanceSplitter

imp_splitter = ImportanceSplitter(num_parties=4, weights=[1, 1, 1, 3])
Xs = imp_splitter.split(X)

To split the dataset by correlation,

from vertibench.Splitter import CorrelationSplitter

corr_splitter = CorrelationSplitter(num_parties=4)
Xs = corr_splitter.fit_split(X)

To evaluate a feature split Xs in terms of party importance,

from vertibench.Evaluator import ImportanceEvaluator
from sklearn.linear_model import LogisticRegression
import numpy as np

model = LogisticRegression()
X = np.concatenate(Xs, axis=1)
model.fit(X, y)
imp_evaluator = ImportanceEvaluator()
imp_scores = imp_evaluator.evaluate(Xs, model.predict)
alpha = imp_evaluator.evaluate_alpha(scores=imp_scores)
print(f"Importance scores: {imp_scores}, alpha: {alpha}")

To evaluate a feature split in terms of correlation,

from vertibench.Evaluator import CorrelationEvaluator

corr_evaluator = CorrelationEvaluator()
corr_scores = corr_evaluator.fit_evaluate(Xs)
beta = corr_evaluator.evaluate_beta()
print(f"Correlation scores: {corr_scores}, beta: {beta}")

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

vertibench-0.1.2.tar.gz (28.5 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

vertibench-0.1.2-py3-none-any.whl (22.5 kB view details)

Uploaded Python 3

File details

Details for the file vertibench-0.1.2.tar.gz.

File metadata

  • Download URL: vertibench-0.1.2.tar.gz
  • Upload date:
  • Size: 28.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.9.25

File hashes

Hashes for vertibench-0.1.2.tar.gz
Algorithm Hash digest
SHA256 a5d36020ad9149a550ddce84cd7b388aa4c34a4065fe799287f526316780f133
MD5 9d01f54ead6b9b32f5168709376abab4
BLAKE2b-256 0f2f36b0ff0c10810534e2134b038b700c552440a8f49f775f34fc3095363f68

See more details on using hashes here.

File details

Details for the file vertibench-0.1.2-py3-none-any.whl.

File metadata

  • Download URL: vertibench-0.1.2-py3-none-any.whl
  • Upload date:
  • Size: 22.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.9.25

File hashes

Hashes for vertibench-0.1.2-py3-none-any.whl
Algorithm Hash digest
SHA256 b7b103df3ab738124eedbfa4b49442f46cd955521983101bd4907c953093d2cb
MD5 cf7c0498b0fd8f35162bf6b54fda0502
BLAKE2b-256 057173890b2db1e1d242bd71f92b4e3f522dfbf47879210fb298e792c5234c53

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