Skip to content

Commit

Permalink
Merge pull request #81 from IBM/version1.0.6
Browse files Browse the repository at this point in the history
adding new release version 1.0.6
  • Loading branch information
chalianwar authored Sep 17, 2021
2 parents 38c5de1 + 06b9d54 commit 757342d
Show file tree
Hide file tree
Showing 137 changed files with 5,414 additions and 2,636 deletions.
6 changes: 3 additions & 3 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@ FROM centos/python-36-centos7:latest
USER root
RUN ls

WORKDIR /app
COPY . /app
WORKDIR /FL
COPY . /FL

RUN pip3 install --upgrade pip
RUN pip3 install --upgrade setuptools
Expand All @@ -13,4 +13,4 @@ RUN source venv/bin/activate
RUN pip3 install -q -r requirements.txt
RUN pip3 install federated-learning-lib/federated_learning_lib-*-py3-none-any.whl

CMD ["/bin/bash"]
CMD ["/bin/bash"]
Binary file modified Notebooks/images/FL_Network.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified Notebooks/images/MnistExamples.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified Notebooks/images/adult8P.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified Notebooks/images/arch_aggregator.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified Notebooks/images/arch_party.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
Expand Up @@ -74,17 +74,17 @@
"source": [
"## Fairness Techniques <a name=\"fairness\"></a>\n",
"\n",
"We adapt a centralized pre-processing bias mitigation method [Reweighing](https://link.springer.com/article/10.1007/s10115-011-0463-8) into two federated learning techniques, Local Reweighing and Global Reweighing with Differential Privacy.\n",
"[Reweighing](https://link.springer.com/article/10.1007/s10115-011-0463-8) is a centralized pre-processing bias mitigation method, which works primarily by attaching weights to samples in the training dataset. This method accesses the entire training dataset and computes weights as the ratio of the expected probability to the observed probability of the sample, calculated based on the sensitive attribute/label pairing in question. We adapt this centralized method into two federated learning techniques, Local Reweighing and Global Reweighing with Differential Privacy.\n",
"\n",
"**Local reweighing**: To fully protect parties' data privacy, each party computes reweighing weights locally based on its own training dataset during pre-processing and then uses the reweighing dataset for its local training. Therefore, parties do not need to communicate with the aggregator or reveal their sensitive attributes and data sample information.\n",
"\n",
"**Global Reweighing with Differential Privacy**: If parties agree to share sensitive attributes and noisy data statistics, parties can employ this fairness method. During the pre-processing phase, the aggregator will collect statistics such as the noisy number of samples with privileged attribute values, compute global reweighing weights based on the collected statistics, and share them with parties. By adjusting the amount of noise injected via epsilon, parties can control their data leakage while still mitigating bias. \n",
"\n",
"We also adapt an in-processing bias mitigation method into Federated Prejudice Remover.\n",
"[Prejudice Remover](https://github.com/algofairness/fairness-comparison/tree/master/fairness/algorithms/kamishima) is an in-processing bias mitigation method 440 proposed for centralized ML, which works by adding a fairness-aware regularizer to the regular logistic loss function. We adapt this centralized method into Federated Prejudice Remover.\n",
"\n",
"**Federated Prejudice Removal**: Each party applies the [Prejudice Remover algorithm](https://github.com/algofairness/fairness-comparison/tree/master/fairness/algorithms/kamishima) to train a less biased local model, and shares only the model parameters with the aggregator. The aggregator can then employ existing FL algorithms, like simple average and FedAvg, etc., to update the global model.\n",
"**Federated Prejudice Removal**: Each party applies the Prejudice Remover algorithm to train a less biased local model, and shares only the model parameters with the aggregator. The aggregator can then employ existing FL algorithms, like simple average and FedAvg, etc., to update the global model.\n",
"\n",
"Further details about the algorithms and datasets utilized, as well as experimental setup, are included in the paper titled [Mitigating Bias in Federated Learning](https://arxiv.org/abs/2012.02447)."
"Further details about the algorithms and datasets utilized, as well as experimental setup, are included in our [paper](https://arxiv.org/abs/2012.02447)."
]
},
{
Expand Down Expand Up @@ -958,7 +958,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.6.10"
"version": "3.6.12"
}
},
"nbformat": 4,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,17 +62,17 @@
"source": [
"## Fairness Techniques <a name=\"fairness\"></a>\n",
"\n",
"We adapt a centralized pre-processing bias mitigation method [Reweighing](https://link.springer.com/article/10.1007/s10115-011-0463-8) into two federated learning techniques, Local Reweighing and Global Reweighing with Differential Privacy.\n",
"[Reweighing](https://link.springer.com/article/10.1007/s10115-011-0463-8) is a centralized pre-processing bias mitigation method, which works primarily by attaching weights to samples in the training dataset. This method accesses the entire training dataset and computes weights as the ratio of the expected probability to the observed probability of the sample, calculated based on the sensitive attribute/label pairing in question. We adapt this centralized method into two federated learning techniques, Local Reweighing and Global Reweighing with Differential Privacy.\n",
"\n",
"**Local reweighing**: To fully protect parties' data privacy, each party computes reweighing weights locally based on its own training dataset during pre-processing and then uses the reweighing dataset for its local training. Therefore, parties do not need to communicate with the aggregator or reveal their sensitive attributes and data sample information.\n",
"\n",
"**Global Reweighing with Differential Privacy**: If parties agree to share sensitive attributes and noisy data statistics, parties can employ this fairness method. During the pre-processing phase, the aggregator will collect statistics such as the noisy number of samples with privileged attribute values, compute global reweighing weights based on the collected statistics, and share them with parties. By adjusting the amount of noise injected via epsilon, parties can control their data leakage while still mitigating bias. \n",
"\n",
"We also adapt an in-processing bias mitigation method into Federated Prejudice Remover.\n",
"[Prejudice Remover](https://github.com/algofairness/fairness-comparison/tree/master/fairness/algorithms/kamishima) is an in-processing bias mitigation method 440 proposed for centralized ML, which works by adding a fairness-aware regularizer to the regular logistic loss function. We adapt this centralized method into Federated Prejudice Remover.\n",
"\n",
"**Federated Prejudice Removal**: Each party applies the [Prejudice Remover algorithm](https://github.com/algofairness/fairness-comparison/tree/master/fairness/algorithms/kamishima) to train a less biased local model, and shares only the model parameters with the aggregator. The aggregator can then employ existing FL algorithms, like simple average and FedAvg, etc., to update the global model.\n",
"**Federated Prejudice Removal**: Each party applies the Prejudice Remover algorithm to train a less biased local model, and shares only the model parameters with the aggregator. The aggregator can then employ existing FL algorithms, like simple average and FedAvg, etc., to update the global model.\n",
"\n",
"Further details about the algorithms and datasets utilized, as well as experimental setup, are included in the paper titled [Mitigating Bias in Federated Learning](https://arxiv.org/abs/2012.02447)."
"Further details about the algorithms and datasets utilized, as well as experimental setup, are included in our [paper](https://arxiv.org/abs/2012.02447)."
]
},
{
Expand Down Expand Up @@ -440,7 +440,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.6.10"
"version": "3.6.12"
}
},
"nbformat": 4,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,17 +62,17 @@
"source": [
"## Fairness Techniques <a name=\"fairness\"></a>\n",
"\n",
"We adapt a centralized pre-processing bias mitigation method [Reweighing](https://link.springer.com/article/10.1007/s10115-011-0463-8) into two federated learning techniques, Local Reweighing and Global Reweighing with Differential Privacy.\n",
"[Reweighing](https://link.springer.com/article/10.1007/s10115-011-0463-8) is a centralized pre-processing bias mitigation method, which works primarily by attaching weights to samples in the training dataset. This method accesses the entire training dataset and computes weights as the ratio of the expected probability to the observed probability of the sample, calculated based on the sensitive attribute/label pairing in question. We adapt this centralized method into two federated learning techniques, Local Reweighing and Global Reweighing with Differential Privacy.\n",
"\n",
"**Local reweighing**: To fully protect parties' data privacy, each party computes reweighing weights locally based on its own training dataset during pre-processing and then uses the reweighing dataset for its local training. Therefore, parties do not need to communicate with the aggregator or reveal their sensitive attributes and data sample information.\n",
"\n",
"**Global Reweighing with Differential Privacy**: If parties agree to share sensitive attributes and noisy data statistics, parties can employ this fairness method. During the pre-processing phase, the aggregator will collect statistics such as the noisy number of samples with privileged attribute values, compute global reweighing weights based on the collected statistics, and share them with parties. By adjusting the amount of noise injected via epsilon, parties can control their data leakage while still mitigating bias. \n",
"\n",
"We also adapt an in-processing bias mitigation method into Federated Prejudice Remover.\n",
"[Prejudice Remover](https://github.com/algofairness/fairness-comparison/tree/master/fairness/algorithms/kamishima) is an in-processing bias mitigation method 440 proposed for centralized ML, which works by adding a fairness-aware regularizer to the regular logistic loss function. We adapt this centralized method into Federated Prejudice Remover.\n",
"\n",
"**Federated Prejudice Removal**: Each party applies the [Prejudice Remover algorithm](https://github.com/algofairness/fairness-comparison/tree/master/fairness/algorithms/kamishima) to train a less biased local model, and shares only the model parameters with the aggregator. The aggregator can then employ existing FL algorithms, like simple average and FedAvg, etc., to update the global model.\n",
"**Federated Prejudice Removal**: Each party applies the Prejudice Remover algorithm to train a less biased local model, and shares only the model parameters with the aggregator. The aggregator can then employ existing FL algorithms, like simple average and FedAvg, etc., to update the global model.\n",
"\n",
"Further details about the algorithms and datasets utilized, as well as experimental setup, are included in the paper titled [Mitigating Bias in Federated Learning](https://arxiv.org/abs/2012.02447)."
"Further details about the algorithms and datasets utilized, as well as experimental setup, are included in our [paper](https://arxiv.org/abs/2012.02447)."
]
},
{
Expand Down Expand Up @@ -435,7 +435,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.6.10"
"version": "3.6.12"
}
},
"nbformat": 4,
Expand Down
16 changes: 11 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,9 @@ For a particular ML model, you can select multiple types of fusion algorithms:
| | Coordinate-wise median [Yin et al.](https://arxiv.org/pdf/1803.01498.pdf) |
| | Zeno [Xie et al.](https://arxiv.org/abs/1805.10032) |
| | SPAHM [Yurochkin et al.](https://arxiv.org/abs/1911.00218) |
| | Fed+ [Yu et al.](https://arxiv.org/abs/2009.06303) |
| | FedProx: [Tian Li et al.](https://arxiv.org/pdf/1812.06127.pdf). |
| | Fed+ [Yu et al.](https://arxiv.org/abs/2009.06303) |
| | FedProx: [Tian Li et al.](https://arxiv.org/pdf/1812.06127.pdf) |
| | Shuffle Iterative Average [Cheng et al.](https://arxiv.org/pdf/2105.09400.pdf)|
| ID3 Decision Tree | ID3 fusion [Quinlan](https://link.springer.com/article/10.1007/BF00116251) |
| Reinforcement Learning RLLib models | Iterative Average |
| | FedAvg [McMahan et al.](https://arxiv.org/pdf/1602.05629.pdf) |
Expand All @@ -53,8 +54,9 @@ We also support the following fairness techniques that help to mitigate bias in
| Global Reweighing with Differetial Privacy [Abay et al.](https://arxiv.org/abs/2012.02447)| Pre-processing | All ML models |
| Federated Prejudice Removal [Abay et al.](https://arxiv.org/abs/2012.02447) | In-processing | Logistic Regression |

In order to aid orchestration of Federated Learning experiments using the IBMFL library, we also provide a Jupyter Notebook based UI interface, [Experiment Manager Dashboard](runner/exp_manager/Experiment_Manager_dashboard.ipynb) where users can choose the model, fusion algorithm, number of parties and other (hyper) parameters for a run. This orchestration can be done on the machine where the notebook is hosted, i.e., locally or even across remote machines. As of now, only limited models and datasets are supported, but more will be added in the near future.
The dashboard uses a [runner](runner/) module, and there's a [usage guide](runner/exp_manager/usage_guide.md) on how to go about using the dashboard.
In order to aid orchestration of Federated Learning experiments using the IBMFL library, we also provide a Jupyter Notebook based UI interface, [Experiment Manager Dashboard](experiment_manager/Experiment_Manager_dashboard.ipynb) where users can choose the model, fusion algorithm, number of parties and other (hyper) parameters for a run. This orchestration can be done on the machine where the notebook is hosted, i.e., locally or even across remote machines. The usage guide on how to go about using the dashboard can be found [here](experiment_manager/usage_guide.md).

IBMFL Multi-Cloud and Hybrid Cloud Orchestrator automates the deployment and monitoring of aggregator and party process using federated learning library docker image on OpenShift clusters which are setup on different cloud data center regions. For more information on how to use OpenShift Orchestrator please refer to [README](openshift_fl/README.md).

## How to get started?

Expand All @@ -64,6 +66,10 @@ Try the [set-up guide](setup.md) for a single-node federated learning setup.

There are a number of [examples](examples/README.md) with explanation for different federated learning tasks with different model types to get started with.

Try our experiment manager [here](experiment_manager).

Try IBM FL with OpenShift [here](openshift_fl).

## How does it work?

There is a [docs folder](./docs) with tutorials and API documentation to learn how to use and extend IBM federated learning.
Expand All @@ -78,7 +84,7 @@ There is a [docs folder](./docs) with tutorials and API documentation to learn h

We appreciate feedback and questions. Please post issues when you encounter them.

We have set up a Slack channel for ongoing discussion. Join the IBM federated learning workspace: https://ibm-fl.slack.com/
We have set up a Slack channel for ongoing discussion. Join the IBM federated learning workspace: https://ibm-fl.slack.com/. If the previous link does not work for you, you can also use [this invitation link](https://join.slack.com/t/ibm-fl/shared_invite/zt-ff0k1xgh-IL9Aq6sW6rNny9gDdnEttQ).


## Citing IBM Federated Learning
Expand Down
7 changes: 5 additions & 2 deletions examples/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,13 @@
### Training Keras, TensorFlow 2.1 and PyTorch models with different fusion algorithms:
* [Running federated averaging (FedAvg)](fedavg)
* [Simple average](iter_avg)
* [FedPlus with Keras](fedplus)
* [Shuffle iterative average](shuffle_iter_avg)
* [FedAvgPlus with Tensorflow and PyTorch](fedavgplus)
* [Gradient aggregation](gradient_aggregation)
* [PFNM with Keras](pfnm)
* [Coordinate median with Keras](coordinate_median)
* [Coordinate median](coordinate_median)
* [Coordinate median plus](coordinate_median_plus)
* [Geometric median plus](geometric_median_plus)
* [Krum with Keras](krum)
* [Zeno with Keras](zeno)

Expand Down
24 changes: 14 additions & 10 deletions examples/constants.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
DEFAULT_SERVER = 'default'

# Examples helper descriptions
GENERATE_DATA_DESC = "generates data for running IBM FL examples"
GENERATE_DATA_DESC = "generates data for running FL examples"
NUM_PARTIES_DESC = "the number of parties to split the data into"
DATASET_DESC = "which data set to use"
PATH_DESC = "directory to save the data"
Expand All @@ -19,18 +19,22 @@
MODEL_CONFIG_DESC = "which model to use for fusion example"
TASK_NAME_DESC = "task name, specified when using RabbitMQ connection"

EXAMPLES_WARNING = "WARNING:: Usage of -m keras_classifier option is deprecated and replaced with -m keras -f iter_avg. Ref https://github.com/IBM/federated-learning-lib/blob/main/setup.md for more information"
CONNECTION_TYPE_DESC = "type of connection to use; supported types are flask, rabbitmq and websockets"
CONNECTION_TYPE_DESC = "type of connection to use; supported types are flask and rabbitmq"

CONTEXT_PATH = "context directory to import the generate script from different folders other that examples"

# Integration
FL_DATASETS = ["default", "mnist", "nursery", "adult", "federated-clustering", "compas", "german",
"higgs", "airline", "diabetes", "binovf", "multovf", "linovf", "femnist", "cifar10"]

"higgs", "airline", "diabetes", "binovf", "multovf", "linovf", "femnist", "cifar10", "custom_dataset"]
FL_EXAMPLES = ["iter_avg", "fedavg", "coordinate_median", "gradient_aggregation", "krum", "pfnm",
"zeno", "fedprox", "fedplus", "differential_privacy_sgd", "rl_cartpole",
"rl_pendulum", "sklearn_logclassification_rw", "spahm", "id3_dt", "prej_remover",
"sklearn_logclassification_globalrw", "naive_bayes_dp"]

FL_MODELS = ["keras", "pytorch", "tf", "sklearn", "None", "keras_classifier"]
"zeno", "fedprox", "fedavgplus",
"differential_privacy_sgd",
"rl_cartpole", "rl_pendulum", "sklearn_logclassification_rw", "spahm",
"sklearn_logclassification_globalrw", "naive_bayes_dp", "id3_dt", "prej_remover", "iter_avg_openshift", "shuffle_iter_avg",
"coordinate_median_plus", "geometric_median_plus"]
FL_MODELS = ["keras", "pytorch", "tf", "sklearn", "None"]

FL_CONN_TYPES = ["flask", "rabbitmq"]

FL_CONTEXT = {'openshift':'openshift_fl.examples'}
4 changes: 2 additions & 2 deletions examples/coordinate_median/generate_configs.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ def get_fusion_config():
return fusion


def get_local_training_config():
def get_local_training_config(configs_folder=None):
local_training_handler = {
'name': 'LocalTrainingHandler',
'path': 'ibmfl.party.training.local_training_handler'
Expand Down Expand Up @@ -42,7 +42,7 @@ def get_hyperparams(model):

def get_data_handler_config(party_id, dataset, folder_data, is_agg=False, model='keras'):

SUPPORTED_DATASETS = ['mnist', 'adult']
SUPPORTED_DATASETS = ['mnist', 'custom_dataset']
if dataset in SUPPORTED_DATASETS:
if model not in 'keras':
dataset = dataset + "_" + model
Expand Down
3 changes: 0 additions & 3 deletions examples/coordinate_median/model_keras.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,6 @@ def get_hyperparams():
local_params = {
'training': {
'epochs': 3
},
'optimizer': {
'lr': 0.01
}
}

Expand Down
Loading

0 comments on commit 757342d

Please sign in to comment.