federated-learning-server

Federated learning experiment using TensorFlow.js

Showing:

Popularity

Downloads/wk

3

GitHub Stars

148

Maintenance

Last Commit

2yrs ago

Contributors

2

Package

Dependencies

7

Size (min+gzip)

206.4KB

License

Apache-2.0

Type Definitions

Built-In

Tree-Shakeable

No?

Categories

Readme

Federated Learning in TensorFlow.js

*This is not an official federated learning framework for TensorFlow. This is an experimental library for TensorFlow.js that is currently unmaintained. If you would like to use an official federated learning library, check out tensorflow/federated.*

This is the parent repository for an (experimental and demonstration-only) implementation of Federated Learning in Tensorflow.js. Federated Learning is a method for training machine learning models in a distributed fashion. Although it involves a central server, that server never needs to see any data or even compute a gradient. Instead, clients perform all of the inference and training locally (which they already do in Tensorflow.js), and just periodically send the server updated weights (rather than data). The server's only job is to aggregate and redistribute them, which means it can be extremely lightweight!

Basic Usage

On the server (NodeJS) side:

import * as http from 'http';
import * as federated from 'federated-learning-server';

const INIT_MODEL = 'file:///initial/model.json';
const webServer = http.createServer(); // can also use https
const fedServer = new federated.Server(webServer, INIT_MODEL);

fedServer.setup().then(() => {
  webServer.listen(80);
});

On the client (browser) side:

import * as federated from 'federated-learning-client';

const INIT_MODEL = 'http://my.initial/model.json';
const SERVER_URL = 'http://federated.learning.server'; // URL of server above
const client = new federated.Client(SERVER_URL, INIT_MODEL);

client.setup().then(() => {
  const yhat = client.predict(x); // make predictions!
  client.federatedUpdate(x, y);   // train and update the server!
});

Documentation and Examples

See the server and client READMEs for documentation, and the emoji or Hogwarts demos for more fully fleshed out examples.

Rate & Review

Great Documentation0
Easy to Use0
Performant0
Highly Customizable0
Bleeding Edge0
Responsive Maintainers0
Poor Documentation0
Hard to Use0
Slow0
Buggy0
Abandoned0
Unwelcoming Community0
100