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)
'yrbirth': "< 1931" }, "field": "yrbirth" } } leap_predef.selector = selector return leap_predef def predef_mean_selector_sql(): leap_predef = leap_fn.PredefinedFunction( computation_msgs_pb2.AlgoCodes.MEAN_ALGO) selector = { "type": codes.DEFAULT, "filter": "[pain_past3backpain] = 1 and [yrbirth] < 1960" } leap_predef.selector = selector return leap_predef def distributed(sites, auth_token): leap_fn = predef_mean_selector_sql() dist_leap = leap.DistributedLeap(leap_fn, "127.0.0.1:50000", auth_token) print(dist_leap.get_result(sites)) if __name__ == "__main__": #user_reg.register_user("TestUser2", "1234561", "127.0.0.1:50000") auth_res = user_reg.authenticate_user("TestUser", "123456", "127.0.0.1:50000") distributed([1], auth_res.token)