Пример #1
0
def mnist_binary_inducing_experiment(method,
                                     components,
                                     sparsity_factor,
                                     run_id,
                                     image=None,
                                     n_threads=1,
                                     partition_size=3000,
                                     optimize_stochastic=False):
    """
    Run the binary mnist experiment with inducing point learning.

    Parameters
    ----------
    method : str
        The method under which to run the experiment (mix1, mix2, or full).
    sparsity_factor : float
        The sparsity of inducing points.
    run_id : int
        The id of the configuration.
    """
    name = 'mnist_binary'
    data = data_source.mnist_binary_data()[run_id - 1]
    kernel = [
        ExtRBF(data['train_inputs'].shape[1],
               variance=11,
               lengthscale=np.array((9., )),
               ARD=False)
    ]
    cond_ll = likelihood.LogisticLL()
    transform = data_transformation.IdentityTransformation(
        data['train_inputs'], data['train_outputs'])

    return run_model.run_model(data['train_inputs'],
                               data['train_outputs'],
                               data['test_inputs'],
                               data['test_outputs'],
                               cond_ll,
                               kernel,
                               method,
                               components,
                               name,
                               data['id'],
                               sparsity_factor,
                               transform,
                               False,
                               False,
                               optimization_config={
                                   'mog': 60,
                                   'hyp': 15,
                                   'inducing': 6
                               },
                               max_iter=9,
                               n_threads=n_threads,
                               ftol=10,
                               model_image_dir=image,
                               partition_size=partition_size,
                               optimize_stochastic=optimize_stochastic)
Пример #2
0
def wisconsin_experiment(method,
                         components,
                         sparsity_factor,
                         run_id,
                         optimize_stochastic=False):
    """
    Run the wisconsin experiment.

    Parameters
    ----------
    method : str
        The method under which to run the experiment (mix1, mix2, or full).
    sparsity_factor : float
        The sparsity of inducing points.
    run_id : int
        The id of the configuration.
    """
    name = 'breast_cancer'
    data = data_source.wisconsin_breast_cancer_data()[run_id - 1]
    kernel = get_kernels(data['train_inputs'].shape[1], 1, False)
    cond_ll = likelihood.LogisticLL()
    transform = data_transformation.IdentityTransformation(
        data['train_inputs'], data['train_outputs'])

    return run_model.run_model(data['train_inputs'],
                               data['train_outputs'],
                               data['test_inputs'],
                               data['test_outputs'],
                               cond_ll,
                               kernel,
                               method,
                               components,
                               name,
                               data['id'],
                               sparsity_factor,
                               transform,
                               True,
                               False,
                               optimization_config={
                                   'mog': 25,
                                   'hyp': 25
                               },
                               max_iter=200)