Skip to main content

Basic implementation with GPy of an Automatic Bayesian Covariance Discovery (ABCD) system

Project description

Latest PyPI version Python Versions License Build

Basic implementation with GPy of an Automatic Bayesian Covariance Discovery (ABCD) system

(as in Lloyd, James Robert; Duvenaud, David Kristjanson; Grosse, Roger Baker; Tenenbaum, Joshua B.; Ghahramani, Zoubin (2014): Automatic construction and natural-language description of nonparametric regression models. In: National Conference on Artificial Intelligence, 7/27/2014, pp. 1242-1250. Available online at https://academic.microsoft.com/paper/1950803081.)

Usage

import numpy as np
import GPy_ABCD

if __name__ == '__main__':
    X = np.linspace(-10, 10, 101)[:, None]
    Y = np.cos( (X - 5) / 2 )**2 * X * 2 + np.random.randn(101, 1)

    best_mods, all_mods, all_exprs = GPy_ABCD.find_best_model(X, Y,
        start_kernels = standard_start_kernels, p_rules = production_rules_all,
        restarts = 5, utility_function = 'BIC', rounds = 2, buffer = 3,
        dynamic_buffer = True, verbose = False, parallel = True)

    # Typical full output printout

    for mod_depth in all_mods: print(', '.join([str(mod.kernel_expression) for mod in mod_depth]) + f'\n{len(mod_depth)}')

    from matplotlib import pyplot as plt
    for bm in best_mods[:3]:
        print(bm.kernel_expression)
        print(bm.model.kern)
        print(bm.model.log_likelihood())
        print(bm.cached_utility_function)
        bm.model.plot()
        print(bm.interpret())

    predict_X = np.linspace(10, 15, 50)[:, None]
    preds = best_mods[0].predict(predict_X)
    print(preds)

    plt.show()

Note: if the parallel argument is True then the function should be called from within a if __name__ == '__main__':

Installation

pip install GPy_ABCD

Requirements

Python 3.7

See requirements.txt

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Files for GPy-ABCD, version 0.1.4
Filename, size File type Python version Upload date Hashes
Filename, size GPy_ABCD-0.1.4-py3-none-any.whl (50.3 kB) File type Wheel Python version py3 Upload date Hashes View hashes
Filename, size GPy-ABCD-0.1.4.tar.gz (37.6 kB) File type Source Python version None Upload date Hashes View hashes

Supported by

Elastic Elastic Search Pingdom Pingdom Monitoring Google Google BigQuery Sentry Sentry Error logging AWS AWS Cloud computing DataDog DataDog Monitoring Fastly Fastly CDN DigiCert DigiCert EV certificate StatusPage StatusPage Status page