8184b9fdf51e3f75835fe1f2d56c294d16686241,examples/federated_learning_with_encryption.py,,,#,162
Before Change
clients = []
clients.append(Client("Alice", server.pubkey))
clients.append(Client("Bob", server.pubkey))
clients.append(Client("Carol", server.pubkey) )
// Each client trains a linear regressor on its own data
for (i, c) in enumerate(clients):
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: 3
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: GoogleCloudPlatform/cloudml-samples
Commit Name: 50837ed17dbd9e74af2f01a3255cf3148ead1f4a
Time: 2019-04-03
Author: luoshixin@google.com
File Name: sklearn/sklearn-template/template/trainer/utils.py
Class Name:
Method Name: read_df_from_gcs
Project Name: GoogleCloudPlatform/python-docs-samples
Commit Name: 34577913e8d62f0db23231f4882263b6825fa271
Time: 2017-08-28
Author: jonwayne@google.com
File Name: pubsub/cloud-client/iam.py
Class Name:
Method Name: get_subscription_policy