def multiGraph(u_feature, i_feature, u_neighs, i_neighs, u_adj, i_adj, embed_dim, droprate=0.5, weight_decay=0.0005, device="cpu"): u_embed = multi_graph(u_feature.to(device), u_neighs, embed_dim, device=device, weight_decay=weight_decay) i_embed = multi_graph(i_feature.to(device), i_neighs, embed_dim, device=device, weight_decay=weight_decay) # user part u_agg_embed_cmp1 = aggregator(u_feature.to(device), i_feature.to(device), u_adj, embed_dim, droprate=droprate, device=device, weight_decay=weight_decay) u_embed_cmp1 = encoder(embed_dim, u_agg_embed_cmp1, u_embed, device=device) u_embed = cmp_combiner(u_embed_cmp1, embed_dim, droprate, device=device) # item part i_agg_embed_cmp1 = aggregator(u_feature.to(device), i_feature.to(device), i_adj, embed_dim, droprate=droprate, is_user_part=False, device=device, weight_decay=weight_decay) i_embed_cmp1 = encoder(embed_dim, i_agg_embed_cmp1, i_embed, is_user_part=False, device=device) i_embed = cmp_combiner(i_embed_cmp1, embed_dim, droprate, device=device) return u_embed, i_embed
def run_traceroute_wrapper(src_probe, dst_probe, ip_version, dst_asn): dst_probe_ip = dst_probe["address_%s" % ip_version] traceroute_object = run_traceroute(str(src_probe['id']), dst_probe_ip, ip_version) traceroute_parsed = process(traceroute_object) return aggregator(traceroute_parsed, dst_asn)
def new_aggregator(self, term): return aggregator(self.agg_name, term)
help='Path to dataset') parser.add_argument('-device', type=str, default="CPU", help='Device') parser.add_argument('-config', type=str, default=None, help='config') args = parser.parse_args() if args.config is None: exit("No config.ini found.") con = Configer(args.config) os.environ["DATASET"] = con.trainer.get_dataset() # newsender = sender(log, url_="http://node0:26657") newsender = sender(log, url_=con.bcfl.get_sender()) # newdb = moddb("ipfs") newdb = moddb(con.bcfl.get_db()) newagg = aggregator(log, con, newdb, newsender) # newtrain = trainer(log, args.dataset, newdb, newsender, devices=args.device) newtrain = trainer(log, con, newdb, newsender) newcontroller = State_controller(log, newtrain, newagg, con.agg.get_threshold()) # Create the app # app = ABCIServer(app=SimpleBCFL(newcontroller), port=args.p) app = ABCIServer(app=SimpleBCFL(newcontroller), port=con.bcfl.get_app_port()) # Run it app.run()
def iter_files(line_iterable): for file_diff in aggregator(line_parser.parse_lines(line_iterable)): yield file_diff