Example #1
0
    sites = np.arange(args.num_sites)
    hyperparams = {
        "lr": 1e-4,
        "d_x": 28,  # input dimension
        "d_y": 2,  # output dimension
        "batch_size": 16,
        "max_iters": 25,
        "iters_per_epoch": 10,
        "train_ids": train_ids,
        "val_ids": val_ids,
        "num_sites": len(sites)
    }
    leap_fed_learn.hyperparams = hyperparams
    fd = open("../certs/myCA.crt", "rb")
    root_cert = fd.read()
    fd = open("../certs/cloudalgo.key", "rb")
    priv_key = fd.read()
    fd = open("../certs/cloudalgo.crt", "rb")
    cert_chain = fd.read()

    #user_reg.register_user("TestUser", "123456", "10.0.0.6:50000", True, priv_key, cert_chain, root_cert, "Coord")
    auth_res = user_reg.authenticate_user("TestUser", "123456",
                                          "10.0.0.6:50000", True, priv_key,
                                          cert_chain, root_cert, "Coord")
    leap = leap.DistributedLeap(leap_fed_learn, "10.0.0.6:50000",
                                auth_res.token, True, root_cert, priv_key,
                                cert_chain)

    result = leap.get_result(sites)
    print(result)
Example #2
0
import sys

sys.path.append("../")
import api.leap as leap
import api.leap_fn as leap_fn

from proto import computation_msgs_pb2

if __name__ == "__main__":
    leap_predef = leap_fn.PrivatePredefinedFunction(
        computation_msgs_pb2.AlgoCodes.PRIVATE_SITE_COUNT_ALGO,
        epsilon=1,
        delta=0)
    selector = "[age] > 50 and [bmi] < 25"
    leap_predef.selector = selector
    leap = leap.DistributedLeap(leap_predef)
    result = leap.get_result()
    print(result)