Giter Site home page Giter Site logo

j-hossain / federated-learning-blockchain-reference Goto Github PK

View Code? Open in Web Editor NEW

This project forked from repeatedd/federated-learning-blockchain

0.0 0.0 0.0 46 KB

Implementation of Federated Learning and Blockchain for training machine learning models using a decentralized approach thereby attempting to protect users' sensitive data .

Python 100.00%

federated-learning-blockchain-reference's Introduction

Federated Learning with Blockchain

A simple application that uses Blockchain to demonstrate federated learning.

What is Federated Learning?

Machine learning models trained on sensitive real-world data promise improvements to everything from medical screening to disease outbreak discovery. And the widespread use of mobile devices means even richer and more sensitive data is becoming available. However, traditional machine learning involves a data pipeline that uses a central server(on-premise or cloud) that hosts the trained model to make predictions. Distributed Machine Learning (FL) in contrast, is an approach that downloads the current model and computes an updated model at the device itself (also known as edge computing) using local data. Federated learning (FL) is a machine learning setting where many clients (e.g. mobile devices or whole organizations) collaboratively train a model under the orchestration of a central server (e.g. service provider) while keeping the training data decentralized. Most of the previous research-work in federated learning focuses on the transfer and aggregation of the gradients for learning on linear models and very less work is available on non-linear models. In this project, we explore a secure decentralized learning model using neural networks. The motivation for the same came from blockchain, preserving the user identities without a trusted central server and the hidden layers in a neural network, able to add non-linearity to the model. Analogous to the transfer of gradients in the federated learning system which requires a lot of network communication, we explore the possibility of broadcasting weights to the blockchain system. The goals of this work are to highlight research problems that are of significant theoretical and practical interest and to encourage research on problems that could have significant real-world impact.

blog

Setup

Make sure you have python3, pip setup on your machine.

Distributed Linear Regression Model

Working Code Dir: Federated(linear Regression)

Install librabries

  • pygad
  • numpy
  • pandas
  • pickle

Running of the Code

  • Open 3 terminals
  • In first terminal, run python server.py
  • In second terminal, run python client1.py
  • In third terminal, run python client2.py

Distributed Blockchain Model

Working Code Dir: Federated(linear regression + blockchain)

Structure of the block

Block -

  • index
  • client_model
  • server_model
  • cli - [“cli1”, “cli2”]
  • timestamp
  • previous_hash
  • nonce

Hashing of the Block

Hash -

  • index
  • client_weights
  • client_biases
  • cli
  • timestamp
  • previous_hash
  • nonce

Running of the Code

  • Open 3 terminals
  • In first terminal, run python server.py
  • In second terminal, run python client1.py
  • In third terminal, run python client2.py

federated-learning-blockchain-reference's People

Contributors

repeatedd avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.