The file vfl_without_blockchain.py tests the functionality of the VFL algorithm without interaction with blockchain.
The file demo.py provides a demonstration of the entire project. The execution can be configured based on the arguments listed under Usage. It can be run with or without the blockchain component.
Running the algorithm requires the following dependencies, which can be installed via pip:
- pytorch
- numpy
All the code in src requires the following dependencies:
- web3
- eth-account
- eth-tester
- py-solc-x
- py-evm
- numpy
- torch
- torchvision
- Pillow
- tdqm
- scikit-learn
- matplotlib
- argparse
Run the 'installDependencies' script to automatically installl all the necessary dependencies.
- For UNIX systems, run
installDependencies.sh - For Windows systems, run
installDependencies.cmd
We use an image dataset with binary classification that predicts if a medical image has Covid or not. The dataset is vertically splitted among 4 parties so that each party holds a quadrant of each image. The split dataset can be retrieved using the Google Drive link.
The following command is used to run VFL code with/without blockchain.
python demo.py --datapath <path-to-dataset> --datasize <dataset-size> --theta <theta> --withblockchain- datapath - path to the dataset
- Default = "./"
- datasize - portion of dataset to use. Must be 0.0125, 0.25, 0.5, 1.0
- Default = 1.0
- theta - Noise value (in range [0, 0.25])
- Default = 0.1
- withblockchain - whether to use blockchain or not, specify if use
- Default = False