8184b9fdf51e3f75835fe1f2d56c294d16686241,examples/federated_learning_with_encryption.py,,,#,162

Before Change



    // Each client trains a linear regressor on its own data
    for (i, c) in enumerate(clients):
        c = c.fit(X[i], y[i], n_iter=50, eta=0.05)
        print(c.weights)

    // Predict
    for (i, c) in enumerate(clients):

After Change


    // Instantiate Alice, Bob and Carol.
    // Each client gets the public key at creation
    clients = []
    for i in range(n_clients):
        clients.append(Client(names[i], X[i], y[i], server.pubkey))

    // Each client trains a linear regressor on its own data
    // for (i, c) in enumerate(clients):
    //     c = c.fit(n_iter=50, eta=0.05)
    //     print(c.weights)
    //
    // // 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
    // All those exchanges happen the encrypted domain, so neither any client
    // sees in the clear the model of anybody else, nor the server reads any
    // client"s individual model.
    // encrypted_aggr = clients[0].encrypt_and_aggregate(input_model=None)
    // encrypted_aggr = clients[1].encrypt_and_aggregate(input_model=encrypted_aggr)
    // encrypted_aggr = clients[2].encrypt_and_aggregate(input_model=encrypted_aggr)
    // aggr = server.decrypt_aggregate(encrypted_aggr, n_clients)
    // print(aggr)
    // for (i, c) in enumerate(clients):
    //     c.weights = aggr
    //     y_pred = c.predict(X_test)
    //     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
Italian Trulli
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: scikit-learn-contrib/lightning
Commit Name: ef0afebc5aacf2f27a57e87c60c3d23e56b37958
Time: 2015-09-08
Author: f@bianp.net
File Name: lightning/impl/tests/test_sag.py
Class Name:
Method Name: test_sag_sparse


Project Name: thoughtworksarts/EmoPy
Commit Name: da66e64f1eff8b52ae90cccc6f75a75d1af94c50
Time: 2018-02-05
Author: aperez@thoughtworks.com
File Name: examples/convolutional_model.py
Class Name:
Method Name: