示例#1
0
def sarcos_all_joints_experiment(method,
                                 components,
                                 sparsity_factor,
                                 run_id,
                                 image=None,
                                 n_threads=1,
                                 partition_size=3000,
                                 optimize_stochastic=False):
    """
    Run the sarcos experiment on all joints.

    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 = 'sarcos_all_joints'
    data = data_source.sarcos_all_joints_data()[run_id - 1]
    kernel = get_kernels(data['train_inputs'].shape[1], 8, False)
    cond_ll = likelihood.CogLL(0.1, 7, 1)

    scaler = data_transformation.preprocessing.StandardScaler().fit(
        data['train_inputs'])
    data['train_inputs'] = scaler.transform(data['train_inputs'])
    data['test_inputs'] = scaler.transform(data['test_inputs'])
    transform = data_transformation.MeanStdYTransformation(
        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': 25,
                                   'hyp': 10,
                                   'll': 10,
                                   'inducing': 6
                               },
                               max_iter=200,
                               partition_size=partition_size,
                               ftol=10,
                               n_threads=n_threads,
                               model_image_dir=image,
                               optimize_stochastic=optimize_stochastic)
def sarcos_inducing_experiment(method,
                               sparsity_factor,
                               run_id,
                               image=None,
                               n_threads=1,
                               partition_size=3000,
                               optimize_stochastic=False):
    """
    Run the sarcos experiment on two joints.

    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 = 'sarcos'
    data = data_source.sarcos_data()[run_id - 1]
    kernel = get_kernels(data['train_inputs'].shape[1], 3, False)
    cond_ll = likelihood.CogLL(0.1, 2, 1)
    transform = data_transformation.MeanStdYTransformation(
        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,
                               name,
                               data['id'],
                               sparsity_factor,
                               transform,
                               True,
                               False,
                               optimization_config={
                                   'mog': 5,
                                   'hyp': 2,
                                   'll': 2,
                                   'inducing': 1
                               },
                               max_iter=200,
                               partition_size=partition_size,
                               n_threads=n_threads,
                               model_image_dir=image,
                               optimize_stochastic=optimize_stochastic)