<jupyter_start><jupyter_text>Backdoor Attacks-Resilient Aggregation based on Robust Filtering of Outliers in Federated Learning for image classificationIn this notebook we show an example of the behaviour of RFOut, presented in [this paper](), in Flower. Flower is designed in such a way that you have to initialise a server and add clients to the configuration.For this reason, the file to initialise the server [server](./server.py) and the file to add clients [client](./client.py) must be launched simultaneously. In order to demonstrate this operation on a notebook, we use the [multiprocess](https://docs.python.org/3/library/multiprocessing.html) library.<jupyter_code>#!pip install multiprocess
from multiprocess import Pool
import time
import os

import subprocess

batcmd="dir"
result = subprocess.check_output(batcmd, shell=True)
def run_server(cases):
    if cases == 0:
        !python server.py
        time.sleep(3)
    else:
        !python client.py<jupyter_output><empty_output><jupyter_text>Since server and client outputs overlap, we use only two clients (the minimum required by the framework) to show how it works. We see server initialisation messages, epoch after epoch of client training metrics (overlapping), aggregation, and this repeated for 10 times.<jupyter_code>p = Pool(3)
p.map(run_server,[0,1,2])<jupyter_output>INFO flower 2022-02-02 09:34:55,505 | app.py:77 | Flower server running (insecure, 10 rounds)
INFO flower 2022-02-02 09:34:55,505 | server.py:118 | Initializing global parameters
INFO flower 2022-02-02 09:34:55,505 | server.py:304 | Requesting initial parameters from one random client
2022-02-02 09:34:55.584263: W tensorflow/stream_executor/platform/default/dso_loader.cc:64] Could not load dynamic library 'libcudart.so.11.0'; dlerror: libcudart.so.11.0: cannot open shared object file: No such file or directory
2022-02-02 09:34:55.584281: I tensorflow/stream_executor/cuda/cudart_stub.cc:29] Ignore above cudart dlerror if you do not have a GPU set up on your machine.
2022-02-02 09:34:55.584262: W tensorflow/stream_executor/platform/default/dso_loader.cc:64] Could not load dynamic library 'libcudart.so.11.0'; dlerror: libcudart.so.11.0: cannot open shared object file: No such file or directory
2022-02-02 09:34:55.584281: I tensorflow/stream_executor/cuda/cudart_stub.cc:29] Ignore above cu[...]
{'fraction_non_alphanumeric': 0.09013605442176871, 'fraction_numerical': 0.07227891156462585, 'mean_word_length': 5.175853018372703, 'pattern_counts': {'":': 0, '<': 8, '<?xml version=': 0, '>': 8, 'https://': 1, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '2', 'dir': 'jupyter-structured-clean-dedup', 'id': '277569', 'license': 'Apache-2.0', 'n_tokens_mistral': 832, 'n_tokens_neox': 728, 'n_words': 259, 'path': 'flower/rfout.ipynb', 'repo_name': 'ari-dasci/S-RFOut', 'size': '2352'}