def main(lambda_f=1, algs=None, num_alpha=None, data=None): lambda_ = 0.1 # Initialize A alg_name = algs #if alg_name is None else alg_name simExperiment = simulateOnlineData() algorithms = {} if alg_name == 'EC_Bandit': algorithms[alg_name] = EC_Bandit(feature_dim=raw_feature_dim, E_FEATURE_DIM=E_FEATURE_DIM, C_FEATURE_DIM=C_FEATURE_DIM) if alg_name == 'hLinUCB': n_users = 505 n_articles = 3000 algorithms[alg_name] = HLinUCBAlgorithm( context_dimension=raw_feature_dim, latent_dimension=5, alpha=0.2, alpha2=0.2, lambda_=lambda_, n=n_users, itemNum=n_articles, init='random', window_size=-1) if alg_name == 'Logistic': algorithms[alg_name] = Logistic(feature_dim=raw_feature_dim, E_FEATURE_DIM=E_FEATURE_DIM, C_FEATURE_DIM=C_FEATURE_DIM) if alg_name == 'Random': algorithms[alg_name] = Random(dimension=raw_feature_dim, alpha=num_alpha, lambda_=lambda_) if alg_name == 'PBMUCB': algorithms[alg_name] = initialPBMUCB() print(algorithms) return simExperiment.runAlgorithms(algorithms, data=data)
if algName == 'LinUCB': algorithms['LinUCB'] = N_LinUCBAlgorithm(dimension=context_dimension, alpha=alpha, lambda_=lambda_) algorithms['CoLin'] = AsyCoLinUCBAlgorithm(dimension=context_dimension, alpha=alpha, lambda_=lambda_, n=n_users, W=simExperiment.getW()) if algName == 'hLinUCB': algorithms['hLinUCB'] = HLinUCBAlgorithm( context_dimension=context_dimension, latent_dimension=latent_dimension, alpha=0.1, alpha2=0.1, lambda_=lambda_, n=n_users, itemNum=n_articles, init='zero', window_size=-1) algorithms['LinUCB'] = N_LinUCBAlgorithm(dimension=context_dimension, alpha=alpha, lambda_=lambda_, n=n_users) if algName == 'PTS': algorithms['PTS'] = PTSAlgorithm(particle_num=10, dimension=10, n=n_users, itemNum=n_articles, sigma=np.sqrt(.5), sigmaU=1,