Exemple #1
0
    def test_model_learn(config):
        """
        Compares the model output with exact GP
        """
        method = config['method']
        sparsify_factor = config['sparse_factor']
        np.random.seed(12000)
        names = []
        num_input_samples = 20
        gaussian_sigma = .2

        X, Y, kernel = DataSource.normal_generate_samples(num_input_samples, gaussian_sigma)
        train_n = int(0.5 * num_input_samples)

        Xtrain = X[:train_n, :]
        Ytrain = Y[:train_n, :]
        Xtest = X[train_n:, :]
        Ytest = Y[train_n:, :]
        kernel1 = ModelLearn.get_kernels(Xtrain.shape[1], 1, True)
        kernel2 = ModelLearn.get_kernels(Xtrain.shape[1], 1, True)
        gaussian_sigma = 1.0

        #number of inducing points
        num_inducing = int(Xtrain.shape[0] * sparsify_factor)
        num_samples = 10000
        cond_ll = UnivariateGaussian(np.array(gaussian_sigma))

        n1, _ = ModelLearn.run_model(Xtest, Xtrain, Ytest, Ytrain, cond_ll, kernel1, method,
                                           'test_' + ModelLearn.get_ID(), 'test', num_inducing,
                                     num_samples, sparsify_factor, ['mog', 'll', 'hyp'], IdentityTransformation, True,
                                           logging.DEBUG, True)

        n2, _ =ModelLearn.run_model(Xtest, Xtrain, Ytest, Ytrain, cond_ll, kernel2, 'gp',
                                           'test_' + ModelLearn.get_ID(), 'test', num_inducing,
                                     num_samples, sparsify_factor, ['mog', 'll', 'hyp'], IdentityTransformation)

        PlotOutput.plot_output('test', ModelLearn.get_output_path(), [n1, n2], None, False)
Exemple #2
0
 def plot():
     PlotOutput.plot_output_all('boston', ModelLearn.get_output_path(),
                                lambda x: x['method'] == 'full', False)
Exemple #3
0
 def plot():
     PlotOutput.plot_output_all('boston', ModelLearn.get_output_path(),
                                lambda x: x['method'] == 'full', False)