def create_adset(data, group, platform, basic_data): json_data = { "name": common.get_name(group, platform), "status": "ACTIVE", "daily_budget": 1000, "bid_amount": int(os.environ['bid_amount']), "campaign_id": data['campaign_id'], "bid_strategy": "LOWEST_COST_WITH_BID_CAP", "billing_event": "IMPRESSIONS", "attribution_spec": [{ "event_type": "CLICK_THROUGH", "window_days": 7 }], "optimization_goal": "OFFSITE_CONVERSIONS", "promoted_object": { "application_id": "634204786734953", "object_store_url": basic_data['object_store_url'][platform.lower()], "custom_event_type": "PURCHASE" }, "targeting": data['targeting'], "access_token": os.environ['access_token'] } res = requests.post(common.get_adset_url(), json=json_data) out = json.loads(res.text) res.close() if 'id' in out: return out['id'] else: return None
def create_ad(adset_id, group, platform, videos): global tindex video = videos[tindex % len(videos)] link = "http://play.google.com/store/apps/details?id=com.tap4fun.brutalage_test" if platform.lower() == 'ios' or 'ios' in platform.lower(): link = "https://itunes.apple.com/app/id1156787368" json_data = { "name": common.get_name(group, platform), "adset_id": adset_id, "status": "ACTIVE", "creative": { "object_story_spec": { "page_id": "1643949305846284", "video_data": { "video_id": video['videoid'], "message": video['message'], "call_to_action": { "type": "INSTALL_MOBILE_APP", "value": { "application": "634204786734953", "link": link } }, "image_url": video['image_url'] } } }, "access_token": os.environ['access_token'] } res = requests.post(common.get_ad_url(), json=json_data) res.close() out = json.loads(res.text) tindex += 1 if 'id' in out: return out['id'] else: return None
is_iid = False model = "CNN" E = 1 project_name = f"{model}{NC}c{E}e{max_rounds}r{n_clients_per_round}f-{server_opt}-{client_opt_strategy[0]}-{client_opt}-scf" client_lr_lg = -0.5 server_lr_lg = 0 for client_lr_lg in np.arange(-1.5, 1.0, 0.5): client_lr = 10**client_lr_lg for server_lr_lg in np.arange(-1, 1.5, 0.5): server_lr = 10**server_lr_lg config = TorchFederatedLearnerEMNISTConfig( CLIENT_LEARNING_RATE=client_lr, CLIENT_OPT=common.get_name(client_opt), CLIENT_OPT_ARGS=common.get_args(client_opt), # CLIENT_OPT_L2=1e-4, CLIENT_OPT_STRATEGY=client_opt_strategy, SERVER_OPT=common.get_name(server_opt), SERVER_OPT_ARGS=common.get_args(server_opt), SERVER_LEARNING_RATE=server_lr, IS_IID_DATA=is_iid, BATCH_SIZE=B, CLIENT_FRACTION=C, N_CLIENTS=NC, N_EPOCH_PER_CLIENT=E, MAX_ROUNDS=max_rounds, MODEL=model, SCAFFOLD=True) config_technical = TorchFederatedLearnerTechnicalConfig(