batch_train=True) one_vs_rest = SeparateClassifiers(deepcopy(base_algorithm), nchoices=nchoices, beta_prior=beta_prior, batch_train=True) epsilon_greedy = EpsilonGreedy(deepcopy(base_algorithm), nchoices=nchoices, beta_prior=beta_prior, batch_train=True) epsilon_greedy_nodecay = EpsilonGreedy(deepcopy(base_algorithm), nchoices=nchoices, beta_prior=beta_prior, decay=None, batch_train=True) adaptive_greedy_thr = AdaptiveGreedy(deepcopy(base_algorithm), nchoices=nchoices, decay_type='threshold', batch_train=True) adaptive_greedy_perc = AdaptiveGreedy(deepcopy(base_algorithm), nchoices=nchoices, beta_prior=beta_prior, decay_type='percentile', decay=0.9997, batch_train=True) explore_first = ExploreFirst(deepcopy(base_algorithm), nchoices=nchoices, beta_prior=None, explore_rounds=1500, batch_train=True) active_explorer = ActiveExplorer(deepcopy(base_algorithm), nchoices=nchoices, beta_prior=beta_prior,
num_samples, num_features = X.shape[0], X.shape[1] # Contextual bandits setup nchoices = 2 #hit or miss base_algorithm = LogisticRegression(random_state=0, solver='lbfgs') block_size = 1 max = 10 alpha = max / 2 beta = max / 2 beta_prior = ((alpha, beta), max / 2) # Models model_opts = [ AdaptiveGreedy(deepcopy(base_algorithm), nchoices=nchoices, decay_type='threshold'), AdaptiveGreedy(deepcopy(base_algorithm), nchoices=nchoices, beta_prior=beta_prior, decay_type='percentile', decay=0.9997), AdaptiveGreedy(deepcopy(base_algorithm), nchoices=nchoices, beta_prior=beta_prior, active_choice='weighted', decay_type='percentile', decay=0.9997), BootstrappedTS(deepcopy(base_algorithm), nchoices=nchoices, beta_prior=beta_prior),
X, y = parse_data("all.txt") nchoices = y.shape[1] base_sgd = SGDClassifier(random_state=123, loss='log', warm_start=False) base_ols = LinearRegression(fit_intercept=True) ## Metaheuristic using different base algorithms and configurations linucb = LinUCB(nchoices=nchoices, alpha=0.1) ### Important!!! the default hyperparameters for LinUCB in the reference paper ### are very different from what's used in this example adaptive_active_greedy = AdaptiveGreedy( deepcopy(base_ols), nchoices=nchoices, smoothing=None, beta_prior=((3. / nchoices, 4.), 2), active_choice='weighted', decay_type='percentile', decay=0.9997, batch_train=True, ) softmax_explorer = SoftmaxExplorer(deepcopy(base_sgd), nchoices=nchoices, smoothing=(1, 2), beta_prior=None, batch_train=True, refit_buffer=50, deep_copy_buffer=False, random_state=3333) adaptive_greedy_perc = AdaptiveGreedy(deepcopy(base_ols), nchoices=nchoices, smoothing=(1, 2),