8184b9fdf51e3f75835fe1f2d56c294d16686241,examples/federated_learning_with_encryption.py,,,#,162
Before Change
// Predict
for (i, c) in enumerate(clients):
print("Train", mean_square_error(c.predict(X[i]), y[i]))
print("Test", mean_square_error(c.predict(X_test) , y_test))
// Each client sends its own model to the next one, in a RING protocol,
// aggregating them all. The last client sends the aggregate model to the server
After Change
// print(mean_square_error(y_pred, y_test))
// The federated learning with gradient from the google paper
n_iter = 5
for i in range(n_iter):
// Compute gradients, encrypt and aggregate
encrypt_aggr = clients[0].encrypted_gradient(sum_to=None)
encrypt_aggr = clients[1].encrypted_gradient(sum_to=encrypt_aggr)
encrypt_aggr = clients[2].encrypted_gradient(sum_to=encrypt_aggr)
// Send aggregate to server, which decrypts
aggr = server.decrypt_aggregate(encrypt_aggr, n_clients)
// Take gradient steps
clients[0].gradient_step(aggr)
clients[1].gradient_step(aggr)
clients[2].gradient_step(aggr)
for (i, c) in enumerate(clients):
y_pred = c.predict(c.X)
print(mean_square_error(y_pred, c.y))
In pattern: SUPERPATTERN
Frequency: 3
Non-data size: 4
Instances Project Name: data61/python-paillier
Commit Name: 8184b9fdf51e3f75835fe1f2d56c294d16686241
Time: 2017-06-20
Author: giorgio.patrini@anu.edu.au
File Name: examples/federated_learning_with_encryption.py
Class Name:
Method Name:
Project Name: oddt/oddt
Commit Name: f8175e0221bbf31ffc8c10ee809b7ee2e118362d
Time: 2018-02-08
Author: maciek@wojcikowski.pl
File Name: oddt/scoring/functions/NNScore.py
Class Name: nnscore
Method Name: train
Project Name: zo7/deconvfaces
Commit Name: 41ef0bf4ece3daf13a02b14c79eb7ddebb42bc0c
Time: 2016-09-04
Author: zo7.flynn@gmail.com
File Name: facegen/generate.py
Class Name:
Method Name: generate_from_yaml