Example #1
0
        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),
        BootstrappedUCB(deepcopy(base_algorithm),
                        nchoices=nchoices,
                        beta_prior=beta_prior),
        SoftmaxExplorer(deepcopy(base_algorithm),
                        nchoices=nchoices,
                        beta_prior=beta_prior)
    ]

    model_names_opts = [
        "adaptive_greedy_thres", "adaptive_greedy_perc",
        "adaptive_active_greedy", "bootstrapped_ts", "bootstrapped_ucb",
        "softmax"
    ]
    '''
Example #2
0
X, y = parse_data("loc_9.txt")

nchoices = y.shape[1]
base_algorithm = SGDClassifier(random_state=123, loss='log')
beta_prior = (
    (3, 7), 2
)  # until there are at least 2 observations of each class, will use prior Beta(3, 7)

## The base algorithm is embedded in different metaheuristics
bootstrapped_ucb = BootstrappedUCB(deepcopy(base_algorithm),
                                   nchoices=nchoices,
                                   beta_prior=beta_prior,
                                   batch_train=True)
bootstrapped_ts = BootstrappedTS(deepcopy(base_algorithm),
                                 nchoices=nchoices,
                                 beta_prior=beta_prior,
                                 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),