Exemple #1
0
def mnist8m_experiment(method,
                       components,
                       sparsity_factor,
                       run_id,
                       image=None,
                       n_threads=1,
                       partition_size=3000,
                       optimize_stochastic=True,
                       num_samples=1000,
                       max_iter=8000):
    """
    Run the mnist8m 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 = 'mnist8m'
    data = data_source.mnist8m_data()[run_id - 1]
    kernel = [
        ExtRBF(data['train_inputs'].shape[1],
               variance=11,
               lengthscale=np.array((9., )),
               ARD=False) for _ in range(10)
    ]
    cond_ll = likelihood.SoftmaxLL(10)
    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
                               },
                               num_samples=num_samples,
                               max_iter=max_iter,
                               n_threads=n_threads,
                               ftol=10,
                               model_image_dir=image,
                               partition_size=partition_size,
                               optimize_stochastic=optimize_stochastic)
Exemple #2
0
def usps_experiment(method,
                    components,
                    sparsity_factor,
                    run_id,
                    optimize_stochastic=False):
    """
    Run the usps 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 = 'usps'
    data = data_source.usps_data()[run_id - 1]
    kernel = [
        ExtRBF(data['train_inputs'].shape[1],
               variance=2,
               lengthscale=np.array((4., )),
               ARD=False) for _ in range(3)
    ]
    cond_ll = likelihood.SoftmaxLL(3)
    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=300)