Skip to content

Commit 5033dc8

Browse files
edaubnbarlowATIots22Ubuntu
authored
v0.7.0 (#232)
* rename cov_gpu to kernel, and refactor with class structure * preparatory work for adding Matern52 kernel * add C++ test for Matern kernel * first implementation of Matern52 kernel * minor corrections to docstrings * implement deriv wrt x for Matern52 kernel * add deriv wrt theta for Matern52 kernel * refactor - put typedefs into types.hpp and more utility functions into utils * add kernel functions to replicate python functionality via pybind11 * rename cov_gpu to kernel * fix kernel check in GPU test * add pybind11 interface for Matern52Kernel * revert to using Python kernels for gp.kernel interface in GaussianProcessGPU (and document this) * only import kernel_type from LibGPGPU if gpu is available (fix Travis test) * first implementation of const mean function * first implementation of const mean function * implement const mean function for predict * add logpost_deriv for mean function * add fixed mean and polynomial mean to C++ * add fixed mean and polynomial mean to C++ * add fixed mean and polynomial mean to C++ * refactor logic around meanfunc in GaussianProcessGPU and add function to parse formula and create python-wrapped C++ object * add test for C++ implementation of mean function * pass BaseMeanFunc from python to C++, so get rid of no-longer-needed meanfunc_type * add more useful exception messages * use mat52_ prefix for Matern52 kernel rather than just mat_ * change import in test_GPUMeanFunction to not give errors if HPU unavailable * rename gpu_basic to test_gpu_basic * rename gpu_kernel to test_gpu_kernel * rename gpu_test_utils to test_gpu_utils * rename gpu_cholesky to test_gpu_cholesky * add basic test for nlopt minimization * rename gpu_meanfunc.cu to test_meanfunc.cu * start implementing GP_MAP fitting in C++ * C++ test for DenseGP_GPU * modify logic about when to refit in logpost getter * cache current theta in C++ class * further steps towards C++ implementation of fit_GP_MAP * almost-working C++ fitting with nlopt * use dlib optimizer for fitting * use dlib optimizer for fitting * refactor, store nugget value in C++ rather than python * refactor, store nugget value in C++ rather than python * use C++ fitting for GPU implementation * use raw strings for regex, and add property for current_logpost * set nugget type in C++ class when instantiating python GaussianProcessGPU class * tweak fitting tests for GPU implementation * add function to find dlib in setup.py * basic implementation of parameters object with tests * updated parameters object to allow data to be none * make ZeroMeanFunc the default for DenseGP_GPU * modified GP class to use GPParams class, plust additional unit tests and fixes * fixed up parameter changes in SequentialDesign * fixed MOGP class and fitting routines plus tests for new params class * tweaked transformations to be correct and added docstrings * added params class to API docs * fixed up setup.py to correct error due to setuptools change (#189) * reset version number in setup.py for starting work on next release (#190) * Fix merge conflicts from devel-to-master PR (#187) * Merge updated devel branch into master (#12) * Fixed tsunami benchmarks to use numpy for loading data and added more detailed readme file * added files for sphinx documentation and made some docstring corrections for autodoc compatability * fixed minor formatting issues in readme headings * added files needed for Travis CI * fixed tests to be slightly more tolerant with numerical comparisons * removed python 3.7 from Travis and decreased tolerance on minimization algorithms in GP unit tests * additional increase in tolerance for GP unit tests for minimization * added version number in setup.py file that is automatically found in package and docs * need to install package in travis to get version number to load * implemented fix to correctly compute kernel derivatives with respect to inputs * added unit tests for input derivatives of kernel * added docstrings for new kernel functions * incremented version number for bug fix * reformatted kernel tests to shorten lines and a few other things * V0.2.0rc (#64) * Add dimension reduction functionality (python impl. of gKDR) * Tweaks to dimension reduction test * Add documentation for DimensionReduction * Add/fix some tests for DimensionReduction * Fix test (DimensionReduction) * Docstring -> raw string to fix invalid escape sequence warning * Add sanity checks for parameters passed to DimensionReduction * Fix assertion in DimensionReduction constructor * Fix assertion in DimensionReduction constructor * Test: optimize structural dimension * First attempt at tuning the structural dimension (kdr) * Make GaussianProcess objects callable (for prediction) * Add 'train_model' interface to GaussianProcess * DimensionReduction tweak to example * Introduce X_scale/Y_scale parameters in gKDR kernel (DimensionReduction) * Fix whitespace * DimensionReduction: use specialized Hermitian eigensolver * Tune parameters (structural dimension and kernel lengthscales) within gKDR - rename tune_structural_dimension -> tune_parameters - documentation - improved optimization routine * Improved tests for parameter tuning (gKDR) * Tweak to test (DimensionReduction) * Whitespace cleanup * Correct naming of variable (DimensionReduction) * Factor out internal loss function from gKDR.tune_parameters * Use a smaller test example to reduce test runtime * MCMC (#33) * added separate functions to calculated squared exponential kernel * added matern 5/2 covariance function * put kernel computations into a separate function and removed conjugate gradient based unit test that always gave problems * moved kernel functions and tests to separate files * added function to compute gradient of the squared exponential kernel * changed GP class to use derivative function * added derivatives for matern 5/2 kernel * quick and dirty modification to GP in order to use kernel functions * cleaned up distance calculation to use standardized euclidean distance * modified fast GP in MICE code to use kernel interface * made correction to meaning of nugget parameter for MICE candidate GP to be relative to current variance * fixed minor issues in MICE design to allow for zero samples and ensuring that parameter values are correctly set * updated MICE benchmark details * cosmetic tweaks to MICE benchmark * full hessian implementation in kernel functions * refactored kernel functions into objects * implemented Hessian computation into GP class * Documented base kernel class * Documented derived kernel classes * added documentation pages for kernels * corrected documentation to include newly implemented classes and fixed some old bugs * renamed run_init_design to be consistent with other methods that use *_initial_design * made minor change in MICEFastGP documentation * broke up prediction methods into single and multiple parameter sets, plus some other changes needed to accomodate them * added routine to compute local covariance matrix from hessian * implemented approximate normal hyperparameter sampling * added utility functions for MCMC sampling * fully implemented basic MCMC sampler * working MCMC implementation with full set of tests * fixed a few bugs in GP and MCMC implmentation * fixed bug in variance prediction where roundoff error can cause negative variance * added docstrings for MCMC routines * added documentation for MCMC-related methods and code additions * created benchmark for MCMC sampling and added documentation pages for it * added information on MCMC benchmark to readme * added additional pages to documentation for MCMC sampling * removed renamed mcmc benchmark file * fixed MCMC docstring in GP class * Fix whitespace in Makefile * Forward kwargs (gKDR._compute_loss); correct number of cross-validation folds * Add benchmark for gKDR * Wrap long lines in docstrings * Versioning (#38) * added code needed for versioning to devel branch * forgot to modify setup.py file * corrected line accidentally deleted from __init__.py * added prerelease number to devel branch to track commits on devel * corrected comments in conf.py to reflect full release numbering * added simple demos for GP and MICE (#46) * added simple demos for GP and MICE * incremented prerelease number for merge * History Matching (#39) * initial commit of history matching class and benchmark with minor tweaks * broke benchmark and sanity checks into two files for history matching * reindented code to use 4 spaces * added unit tests and some bug fixes for HistoryMatching * added tests for implausability plus some other checks and bug fixes in HistoryMatching * fixed misspelling of implausibility * changed file name for benchmark in makefile * fixed documentation in HistoryMatching class to be consistent with others * improved documentation, cleaned up code, added a few unit tests for HistoryMatching * fixed some docstring formatting and base rst file for HistoryMatching * full implementation of history matching with unit tests and documentation * simplified model discrepancy based on discussion with Danny * fixes to history matching file and tests * fixed some comparisons with None in SequentialDesign * broke up long test for Hessian into parts * incremented prerelease for history match merge * Feature/mucmtoolkit (#54) * added toolkit with converted pages and images * incremented version number * Feature/mucmtoolkit (#55) * fixed bug in documentation to display methods * version number change for corrected PR * merge input derivative bugfix into devel (#61) * Fix/cachefactmat (#62) * corrected GP class to cache factorized matrix rather than inverse plus cleaned up a few unneeded internal variables * incremented prerelease version number * missed a line that should have been deleted * added test to confirm that variance predictions are stable * fixed solve routines to use cho_solve in scipy * Fix/toolkitcorr (#63) * toolkit proofreading and corrections * continuing updates of toolkit pages * edits to toolkit pages * finished corrections up through meta section * updated toolkit threads section * updates to proc section of toolkit * incremented prerelease version number * modified version for release v0.2.0 * Adjust the paper references in DimensionReduction.py * Update paper reference in documentation * V0.3.0rc (#125) * Add dimension reduction functionality (python impl. of gKDR) * Tweaks to dimension reduction test * Add documentation for DimensionReduction * Add/fix some tests for DimensionReduction * Fix test (DimensionReduction) * Docstring -> raw string to fix invalid escape sequence warning * Add sanity checks for parameters passed to DimensionReduction * Fix assertion in DimensionReduction constructor * Fix assertion in DimensionReduction constructor * Test: optimize structural dimension * First attempt at tuning the structural dimension (kdr) * Make GaussianProcess objects callable (for prediction) * Add 'train_model' interface to GaussianProcess * DimensionReduction tweak to example * Introduce X_scale/Y_scale parameters in gKDR kernel (DimensionReduction) * Fix whitespace * DimensionReduction: use specialized Hermitian eigensolver * Tune parameters (structural dimension and kernel lengthscales) within gKDR - rename tune_structural_dimension -> tune_parameters - documentation - improved optimization routine * Improved tests for parameter tuning (gKDR) * Tweak to test (DimensionReduction) * Whitespace cleanup * Correct naming of variable (DimensionReduction) * Factor out internal loss function from gKDR.tune_parameters * Use a smaller test example to reduce test runtime * MCMC (#33) * added separate functions to calculated squared exponential kernel * added matern 5/2 covariance function * put kernel computations into a separate function and removed conjugate gradient based unit test that always gave problems * moved kernel functions and tests to separate files * added function to compute gradient of the squared exponential kernel * changed GP class to use derivative function * added derivatives for matern 5/2 kernel * quick and dirty modification to GP in order to use kernel functions * cleaned up distance calculation to use standardized euclidean distance * modified fast GP in MICE code to use kernel interface * made correction to meaning of nugget parameter for MICE candidate GP to be relative to current variance * fixed minor issues in MICE design to allow for zero samples and ensuring that parameter values are correctly set * updated MICE benchmark details * cosmetic tweaks to MICE benchmark * full hessian implementation in kernel functions * refactored kernel functions into objects * implemented Hessian computation into GP class * Documented base kernel class * Documented derived kernel classes * added documentation pages for kernels * corrected documentation to include newly implemented classes and fixed some old bugs * renamed run_init_design to be consistent with other methods that use *_initial_design * made minor change in MICEFastGP documentation * broke up prediction methods into single and multiple parameter sets, plus some other changes needed to accomodate them * added routine to compute local covariance matrix from hessian * implemented approximate normal hyperparameter sampling * added utility functions for MCMC sampling * fully implemented basic MCMC sampler * working MCMC implementation with full set of tests * fixed a few bugs in GP and MCMC implmentation * fixed bug in variance prediction where roundoff error can cause negative variance * added docstrings for MCMC routines * added documentation for MCMC-related methods and code additions * created benchmark for MCMC sampling and added documentation pages for it * added information on MCMC benchmark to readme * added additional pages to documentation for MCMC sampling * removed renamed mcmc benchmark file * fixed MCMC docstring in GP class * Fix whitespace in Makefile * Forward kwargs (gKDR._compute_loss); correct number of cross-validation folds * Add benchmark for gKDR * Wrap long lines in docstrings * Versioning (#38) * added code needed for versioning to devel branch * forgot to modify setup.py file * corrected line accidentally deleted from __init__.py * added prerelease number to devel branch to track commits on devel * corrected comments in conf.py to reflect full release numbering * added simple demos for GP and MICE (#46) * added simple demos for GP and MICE * incremented prerelease number for merge * History Matching (#39) * initial commit of history matching class and benchmark with minor tweaks * broke benchmark and sanity checks into two files for history matching * reindented code to use 4 spaces * added unit tests and some bug fixes for HistoryMatching * added tests for implausability plus some other checks and bug fixes in HistoryMatching * fixed misspelling of implausibility * changed file name for benchmark in makefile * fixed documentation in HistoryMatching class to be consistent with others * improved documentation, cleaned up code, added a few unit tests for HistoryMatching * fixed some docstring formatting and base rst file for HistoryMatching * full implementation of history matching with unit tests and documentation * simplified model discrepancy based on discussion with Danny * fixes to history matching file and tests * fixed some comparisons with None in SequentialDesign * broke up long test for Hessian into parts * incremented prerelease for history match merge * Feature/mucmtoolkit (#54) * added toolkit with converted pages and images * incremented version number * Feature/mucmtoolkit (#55) * fixed bug in documentation to display methods * version number change for corrected PR * merge input derivative bugfix into devel (#61) * Fix/cachefactmat (#62) * corrected GP class to cache factorized matrix rather than inverse plus cleaned up a few unneeded internal variables * incremented prerelease version number * missed a line that should have been deleted * added test to confirm that variance predictions are stable * fixed solve routines to use cho_solve in scipy * Fix/toolkitcorr (#63) * toolkit proofreading and corrections * continuing updates of toolkit pages * edits to toolkit pages * finished corrections up through meta section * updated toolkit threads section * updates to proc section of toolkit * incremented prerelease version number * reset version to 0.3.0dev0 be consistent with master update (#70) * Feature/meanfunc (#74) * initial working implementation of mean function with tests * implemented polynomial mean function * added finite difference tests to mean function unit tests * made finite difference spacing a fixture * changed fixed mean to use a function rather than lambda for derivative * implemented mean function (note only unit tests assume zero mean, will write new ones during refactor of interface) * fixed bugs in mean function implementation * implemented additional mean function capabilities and wrote tests * added docstrings to base mean function class * documented mean sum class * documented mean product class * documented mean composite class * documented fixed mean class * added documentation and a few other checks to the fixed mean function implementations * added documentation for coefficient class * added documentation for polynomial mean class * added module docstring and test for indexing error in composite mean * added documentation page for mean function * implemented power mean function * fixed bugs in mean power and wrote unit tests * updated pre-release version for merge to devel * Feature/formula (#77) * initial working implementation of mean function with tests * implemented polynomial mean function * added finite difference tests to mean function unit tests * made finite difference spacing a fixture * changed fixed mean to use a function rather than lambda for derivative * implemented mean function (note only unit tests assume zero mean, will write new ones during refactor of interface) * fixed bugs in mean function implementation * implemented additional mean function capabilities and wrote tests * added docstrings to base mean function class * documented mean sum class * documented mean product class * documented mean composite class * documented fixed mean class * added documentation and a few other checks to the fixed mean function implementations * added documentation for coefficient class * added documentation for polynomial mean class * added module docstring and test for indexing error in composite mean * added documentation page for mean function * implemented power mean function * fixed bugs in mean power and wrote unit tests * basic working formula parser on linear terms * wrote tokenizer function * modified tokenizer to correct exponentiation and wrote expression parser * removed unneeded function * appear to have working formula parser * fixed issue with square bracket parsing * added class method and moved some things around * added some unit tests for formula parsing * implemented tests for tokenizing, parsing, and evaluating functions * full set of unit tests for formulas and additional method in mean function to create from a formula * changed base name and created functional interface for formula plus string methods * added docstrings and renamed some functions * added documentation for formulas and modified the mean function page a bit * added patsy to install for testing and updated python version to 3.7 * updated version number for merge into devel * Feature/GPrefactor (#81) * initial working implementation of mean function with tests * implemented polynomial mean function * added finite difference tests to mean function unit tests * made finite difference spacing a fixture * changed fixed mean to use a function rather than lambda for derivative * implemented mean function (note only unit tests assume zero mean, will write new ones during refactor of interface) * fixed bugs in mean function implementation * implemented additional mean function capabilities and wrote tests * added docstrings to base mean function class * documented mean sum class * documented mean product class * documented mean composite class * documented fixed mean class * added documentation and a few other checks to the fixed mean function implementations * added documentation for coefficient class * added documentation for polynomial mean class * added module docstring and test for indexing error in composite mean * added documentation page for mean function * implemented power mean function * fixed bugs in mean power and wrote unit tests * basic working formula parser on linear terms * wrote tokenizer function * modified tokenizer to correct exponentiation and wrote expression parser * removed unneeded function * appear to have working formula parser * fixed issue with square bracket parsing * added class method and moved some things around * added some unit tests for formula parsing * implemented tests for tokenizing, parsing, and evaluating functions * full set of unit tests for formulas and additional method in mean function to create from a formula * changed base name and created functional interface for formula plus string methods * added docstrings and renamed some functions * added documentation for formulas and modified the mean function page a bit * added patsy to install for testing and updated python version to 3.7 * replaced GP class with new version and unit tests * refactored some GP methods to use property decorator * initial implementation of MLE fitting function * fixed dimension reduction tests to use new GP interface * fixed history matching to work with new GP interface * fixed mice code to handle new GP interface * remove multi output GP as planned part of refactor * wrote unit test for MLE fitting function * added code to GP class to allow for priors * put bare bones MOGP class back into repository * changed code to use log posterior and wrote fitting routine in parallel for MOGP * initial implementation of normal and inverse gamma priors * added gamma distribution to priors and put in second derivatives * fixed scale parameter in gamma distribution to be consistent with scipy definition * fixed other tests and classes to use new MAP function and added unit test for single GP MAP routine * correctly passed uncertainty/derivative flags to multiouput predict method * added some bare bones tests for MultiOutputGP * added tests for prior classes * added unit tests and put in extra checks on nugget prior * put more tests on priors into GP class * fixed mean function in MOGP to accept strings * added test for multiplt output fitting * made some functions in formula module private * added brief docstrings for Priors and added priors to documentation * cleaned up some GP documentation * improved docstring and made nugget parameter more configurable for MOGP * improvde fitting documentation * put better math in prior docstrings * fixed bug in prior inputs to MOGP * fixed docstring issue needing raw string * wrote R example using GP fitting and prediction * updated prerelease version number for merge * Fix/powermeanderiv (#83) * fixed bugs in computation of PowerMean derivatives plus unit tests to verify * incremented version number for merge into devel * added code of conduct to project documentation (#86) * added code of conduct to project documentation * updated prerelease number for merge into devel * Feature/requirements (#92) * added additional requirements files for optional packages, testing packages, and documentation * incremented version number * Fix/absoluteimports (#98) * fconverted to absolute imports for clarity and to fix issue with docs building * added missing init file in linalg package * corrected travis file to use requirements files * incremented version number for merge * Fix/pdfdocs (#99) * fixed latex typos in threads section of toolkit * corrected tex rendering in proc section of toolkit * fixed tex formatting in examples section of toolkit * fixed latex formatting in disc section of toolkit * modified docs pages to fix latex build in alt section of toolkit * incremented version number for merge into devel * forcing pytest version in travis file to fix conflicting dependency * moved pytest requirement to requirements file * Feature/refactor readme (#106) * added contributing guidelines and fixed typo in code of conduct * refactored index page on docs, moved implementation docs to separate directory to avoid clutter * added demo pages to documentation * moved benchmarks to a separate benchmark directory from the unit tests * added symlinks from benchmarks to test directory in case those are used somewhere * added some additional link targets to facilitate links between pages * fixed some doc errors in benchmarks * refactored readme and intro doc pages * removed lfs storage file .gitattributes * fixed link issue in README * reworked intro sections and added workflow figure * added blurb on pip installation to installation docs page * incremented version number for merge * Fix/windows mogp (#107) * default to single process when running on windows * made multi output tests only use a single processor for consistency * incremented version number * Feature/tutorial (#116) * added tutorial code and projectile simulator code to demos * finished implementing tutorial code * wrote tutorial up through validation section * slight edits to docs organization and index page * finished writing tutorial and added image showing output * fixed a few typos and made a few corrections to tutorial * increment version number for merge * clarified requirement for scipy version 1.4 in tutorial * Fix/gp interface (#117) * fixed issue with empty list in GP init function and added support for string version of kernels * updated docstrings in GP class to match new options * incremented versin number for merge * updated GP docstrings to fix some issues * fixed prior and kernel initiation in MOGP class * fixed up docstring with Oliver's suggestion * Fix/predictnugget (#120) * included predictions in nugget with a corresponding unit test * incremented version number for merge * modified MOGP class to include nugget flag * MultiOutputGP Optimization start points (#121) * modified fitting routine to accept different start points for each emulator * increment version number * minor tweak to fitting function wrapper * trying to fix occasional runtime errors in mogp fitting tests * Fix/demo updates (#124) * rewrote GP demo to use new interface and use priors to improve emulator * moved convenience function for printing into projectile * modified tutorial to use printing function * modified MICE demo to match new interface * modified benchmarks to use new interface * tidied a few things in MICE demo * removed link to nonexistent file * updated setup.py for merge * updated version number for update to master * fix/test fitting (#127) * fixed minor issue in mogp fitting tests where tests did not fail correctly * updated version number for merge to devel * Fix markdown link to Contributor Covenant * Fix gpu and fpga label links Co-authored-by: Oliver Strickson <ostrickson@turing.ac.uk> Co-authored-by: Oliver Strickson <ots22@users.noreply.github.com> * Fix/kerneldist (#130) * bugfix to catch situation where kernel distance returns NaN * following confirmed bug fix, incremented version number for master update * V0.4.0 (#148) * Add dimension reduction functionality (python impl. of gKDR) * Tweaks to dimension reduction test * Add documentation for DimensionReduction * Add/fix some tests for DimensionReduction * Fix test (DimensionReduction) * Docstring -> raw string to fix invalid escape sequence warning * Add sanity checks for parameters passed to DimensionReduction * Fix assertion in DimensionReduction constructor * Fix assertion in DimensionReduction constructor * Test: optimize structural dimension * First attempt at tuning the structural dimension (kdr) * Make GaussianProcess objects callable (for prediction) * Add 'train_model' interface to GaussianProcess * DimensionReduction tweak to example * Introduce X_scale/Y_scale parameters in gKDR kernel (DimensionReduction) * Fix whitespace * DimensionReduction: use specialized Hermitian eigensolver * Tune parameters (structural dimension and kernel lengthscales) within gKDR - rename tune_structural_dimension -> tune_parameters - documentation - improved optimization routine * Improved tests for parameter tuning (gKDR) * Tweak to test (DimensionReduction) * Whitespace cleanup * Correct naming of variable (DimensionReduction) * Factor out internal loss function from gKDR.tune_parameters * Use a smaller test example to reduce test runtime * MCMC (#33) * added separate functions to calculated squared exponential kernel * added matern 5/2 covariance function * put kernel computations into a separate function and removed conjugate gradient based unit test that always gave problems * moved kernel functions and tests to separate files * added function to compute gradient of the squared exponential kernel * changed GP class to use derivative function * added derivatives for matern 5/2 kernel * quick and dirty modification to GP in order to use kernel functions * cleaned up distance calculation to use standardized euclidean distance * modified fast GP in MICE code to use kernel interface * made correction to meaning of nugget parameter for MICE candidate GP to be relative to current variance * fixed minor issues in MICE design to allow for zero samples and ensuring that parameter values are correctly set * updated MICE benchmark details * cosmetic tweaks to MICE benchmark * full hessian implementation in kernel functions * refactored kernel functions into objects * implemented Hessian computation into GP class * Documented base kernel class * Documented derived kernel classes * added documentation pages for kernels * corrected documentation to include newly implemented classes and fixed some old bugs * renamed run_init_design to be consistent with other methods that use *_initial_design * made minor change in MICEFastGP documentation * broke up prediction methods into single and multiple parameter sets, plus some other changes needed to accomodate them * added routine to compute local covariance matrix from hessian * implemented approximate normal hyperparameter sampling * added utility functions for MCMC sampling * fully implemented basic MCMC sampler * working MCMC implementation with full set of tests * fixed a few bugs in GP and MCMC implmentation * fixed bug in variance prediction where roundoff error can cause negative variance * added docstrings for MCMC routines * added documentation for MCMC-related methods and code additions * created benchmark for MCMC sampling and added documentation pages for it * added information on MCMC benchmark to readme * added additional pages to documentation for MCMC sampling * removed renamed mcmc benchmark file * fixed MCMC docstring in GP class * Fix whitespace in Makefile * Forward kwargs (gKDR._compute_loss); correct number of cross-validation folds * Add benchmark for gKDR * Wrap long lines in docstrings * Versioning (#38) * added code needed for versioning to devel branch * forgot to modify setup.py file * corrected line accidentally deleted from __init__.py * added prerelease number to devel branch to track commits on devel * corrected comments in conf.py to reflect full release numbering * added simple demos for GP and MICE (#46) * added simple demos for GP and MICE * incremented prerelease number for merge * History Matching (#39) * initial commit of history matching class and benchmark with minor tweaks * broke benchmark and sanity checks into two files for history matching * reindented code to use 4 spaces * added unit tests and some bug fixes for HistoryMatching * added tests for implausability plus some other checks and bug fixes in HistoryMatching * fixed misspelling of implausibility * changed file name for benchmark in makefile * fixed documentation in HistoryMatching class to be consistent with others * improved documentation, cleaned up code, added a few unit tests for HistoryMatching * fixed some docstring formatting and base rst file for HistoryMatching * full implementation of history matching with unit tests and documentation * simplified model discrepancy based on discussion with Danny * fixes to history matching file and tests * fixed some comparisons with None in SequentialDesign * broke up long test for Hessian into parts * incremented prerelease for history match merge * Feature/mucmtoolkit (#54) * added toolkit with converted pages and images * incremented version number * Feature/mucmtoolkit (#55) * fixed bug in documentation to display methods * version number change for corrected PR * merge input derivative bugfix into devel (#61) * Fix/cachefactmat (#62) * corrected GP class to cache factorized matrix rather than inverse plus cleaned up a few unneeded internal variables * incremented prerelease version number * missed a line that should have been deleted * added test to confirm that variance predictions are stable * fixed solve routines to use cho_solve in scipy * Fix/toolkitcorr (#63) * toolkit proofreading and corrections * continuing updates of toolkit pages * edits to toolkit pages * finished corrections up through meta section * updated toolkit threads section * updates to proc section of toolkit * incremented prerelease version number * reset version to 0.3.0dev0 be consistent with master update (#70) * Feature/meanfunc (#74) * initial working implementation of mean function with tests * implemented polynomial mean function * added finite difference tests to mean function unit tests * made finite difference spacing a fixture * changed fixed mean to use a function rather than lambda for derivative * implemented mean function (note only unit tests assume zero mean, will write new ones during refactor of interface) * fixed bugs in mean function implementation * implemented additional mean function capabilities and wrote tests * added docstrings to base mean function class * documented mean sum class * documented mean product class * documented mean composite class * documented fixed mean class * added documentation and a few other checks to the fixed mean function implementations * added documentation for coefficient class * added documentation for polynomial mean class * added module docstring and test for indexing error in composite mean * added documentation page for mean function * implemented power mean function * fixed bugs in mean power and wrote unit tests * updated pre-release version for merge to devel * Feature/formula (#77) * initial working implementation of mean function with tests * implemented polynomial mean function * added finite difference tests to mean function unit tests * made finite difference spacing a fixture * changed fixed mean to use a function rather than lambda for derivative * implemented mean function (note only unit tests assume zero mean, will write new ones during refactor of interface) * fixed bugs in mean function implementation * implemented additional mean function capabilities and wrote tests * added docstrings to base mean function class * documented mean sum class * documented mean product class * documented mean composite class * documented fixed mean class * added documentation and a few other checks to the fixed mean function implementations * added documentation for coefficient class * added documentation for polynomial mean class * added module docstring and test for indexing error in composite mean * added documentation page for mean function * implemented power mean function * fixed bugs in mean power and wrote unit tests * basic working formula parser on linear terms * wrote tokenizer function * modified tokenizer to correct exponentiation and wrote expression parser * removed unneeded function * appear to have working formula parser * fixed issue with square bracket parsing * added class method and moved some things around * added some unit tests for formula parsing * implemented tests for tokenizing, parsing, and evaluating functions * full set of unit tests for formulas and additional method in mean function to create from a formula * changed base name and created functional interface for formula plus string methods * added docstrings and renamed some functions * added documentation for formulas and modified the mean function page a bit * added patsy to install for testing and updated python version to 3.7 * updated version number for merge into devel * Feature/GPrefactor (#81) * initial working implementation of mean function with tests * implemented polynomial mean function * added finite difference tests to mean function unit tests * made finite difference spacing a fixture * changed fixed mean to use a function rather than lambda for derivative * implemented mean function (note only unit tests assume zero mean, will write new ones during refactor of interface) * fixed bugs in mean function implementation * implemented additional mean function capabilities and wrote tests * added docstrings to base mean function class * documented mean sum class * documented mean product class * documented mean composite class * documented fixed mean class * added documentation and a few other checks to the fixed mean function implementations * added documentation for coefficient class * added documentation for polynomial mean class * added module docstring and test for indexing error in composite mean * added documentation page for mean function * implemented power mean function * fixed bugs in mean power and wrote unit tests * basic working formula parser on linear terms * wrote tokenizer function * modified tokenizer to correct exponentiation and wrote expression parser * removed unneeded function * appear to have working formula parser * fixed issue with square bracket parsing * added class method and moved some things around * added some unit tests for formula parsing * implemented tests for tokenizing, parsing, and evaluating functions * full set of unit tests for formulas and additional method in mean function to create from a formula * changed base name and created functional interface for formula plus string methods * added docstrings and renamed some functions * added documentation for formulas and modified the mean function page a bit * added patsy to install for testing and updated python version to 3.7 * replaced GP class with new version and unit tests * refactored some GP methods to use property decorator * initial implementation of MLE fitting function * fixed dimension reduction tests to use new GP interface * fixed history matching to work with new GP interface * fixed mice code to handle new GP interface * remove multi output GP as planned part of refactor * wrote unit test for MLE fitting function * added code to GP class to allow for priors * put bare bones MOGP class back into repository * changed code to use log posterior and wrote fitting routine in parallel for MOGP * initial implementation of normal and inverse gamma priors * added gamma distribution to priors and put in second derivatives * fixed scale parameter in gamma distribution to be consistent with scipy definition * fixed other tests and classes to use new MAP function and added unit test for single GP MAP routine * correctly passed uncertainty/derivative flags to multiouput predict method * added some bare bones tests for MultiOutputGP * added tests for prior classes * added unit tests and put in extra checks on nugget prior * put more tests on priors into GP class * fixed mean function in MOGP to accept strings * added test for multiplt output fitting * made some functions in formula module private * added brief docstrings for Priors and added priors to documentation * cleaned up some GP documentation * improved docstring and made nugget parameter more configurable for MOGP * improvde fitting documentation * put better math in prior docstrings * fixed bug in prior inputs to MOGP * fixed docstring issue needing raw string * wrote R example using GP fitting and prediction * updated prerelease version number for merge * Fix/powermeanderiv (#83) * fixed bugs in computation of PowerMean derivatives plus unit tests to verify * incremented version number for merge into devel * added code of conduct to project documentation (#86) * added code of conduct to project documentation * updated prerelease number for merge into devel * Feature/requirements (#92) * added additional requirements files for optional packages, testing packages, and documentation * incremented version number * Fix/absoluteimports (#98) * fconverted to absolute imports for clarity and to fix issue with docs building * added missing init file in linalg package * corrected travis file to use requirements files * incremented version number for merge * Fix/pdfdocs (#99) * fixed latex typos in threads section of toolkit * corrected tex rendering in proc section of toolkit * fixed tex formatting in examples section of toolkit * fixed latex formatting in disc section of toolkit * modified docs pages to fix latex build in alt section of toolkit * incremented version number for merge into devel * forcing pytest version in travis file to fix conflicting dependency * moved pytest requirement to requirements file * Feature/refactor readme (#106) * added contributing guidelines and fixed typo in code of conduct * refactored index page on docs, moved implementation docs to separate directory to avoid clutter * added demo pages to documentation * moved benchmarks to a separate benchmark directory from the unit tests * added symlinks from benchmarks to test directory in case those are used somewhere * added some additional link targets to facilitate links between pages * fixed some doc errors in benchmarks * refactored readme and intro doc pages * removed lfs storage file .gitattributes * fixed link issue in README * reworked intro sections and added workflow figure * added blurb on pip installation to installation docs page * incremented version number for merge * Fix/windows mogp (#107) * default to single process when running on windows * made multi output tests only use a single processor for consistency * incremented version number * Feature/tutorial (#116) * added tutorial code and projectile simulator code to demos * finished implementing tutorial code * wrote tutorial up through validation section * slight edits to docs organization and index page * finished writing tutorial and added image showing output * fixed a few typos and made a few corrections to tutorial * increment version number for merge * clarified requirement for scipy version 1.4 in tutorial * Fix/gp interface (#117) * fixed issue with empty list in GP init function and added support for string version of kernels * updated docstrings in GP class to match new options * incremented versin number for merge * updated GP docstrings to fix some issues * fixed prior and kernel initiation in MOGP class * fixed up docstring with Oliver's suggestion * Fix/predictnugget (#120) * included predictions in nugget with a corresponding unit test * incremented version number for merge * modified MOGP class to include nugget flag * MultiOutputGP Optimization start points (#121) * modified fitting routine to accept different start points for each emulator * increment version number * minor tweak to fitting function wrapper * trying to fix occasional runtime errors in mogp fitting tests * Fix/demo updates (#124) * rewrote GP demo to use new interface and use priors to improve emulator * moved convenience function for printing into projectile * modified tutorial to use printing function * modified MICE demo to match new interface * modified benchmarks to use new interface * tidied a few things in MICE demo * removed link to nonexistent file * updated setup.py for merge * fix/test fitting (#127) * fixed minor issue in mogp fitting tests where tests did not fail correctly * updated version number for merge to devel * reset version number to start work on next release (#129) * Fix/kerneldist (#131) * Merge updated devel branch into master (#12) * Fixed tsunami benchmarks to use numpy for loading data and added more detailed readme file * added files for sphinx documentation and made some docstring corrections for autodoc compatability * fixed minor formatting issues in readme headings * added files needed for Travis CI * fixed tests to be slightly more tolerant with numerical comparisons * removed python 3.7 from Travis and decreased tolerance on minimization algorithms in GP unit tests * additional increase in tolerance for GP unit tests for minimization * added version number in setup.py file that is automatically found in package and docs * need to install package in travis to get version number to load * implemented fix to correctly compute kernel derivatives with respect to inputs * added unit tests for input derivatives of kernel * added docstrings for new kernel functions * incremented version number for bug fix * reformatted kernel tests to shorten lines and a few other things * V0.2.0rc (#64) * Add dimension reduction functionality (python impl. of gKDR) * Tweaks to dimension reduction test * Add documentation for DimensionReduction * Add/fix some tests for DimensionReduction * Fix test (DimensionReduction) * Docstring -> raw string to fix invalid escape sequence warning * Add sanity checks for parameters passed to DimensionReduction * Fix assertion in DimensionReduction constructor * Fix assertion in DimensionReduction constructor * Test: optimize structural dimension * First attempt at tuning the structural dimension (kdr) * Make GaussianProcess objects callable (for prediction) * Add 'train_model' interface to GaussianProcess * DimensionReduction tweak to example * Introduce X_scale/Y_scale parameters in gKDR kernel (DimensionReduction) * Fix whitespace * DimensionReduction: use specialized Hermitian eigensolver * Tune parameters (structural dimension and kernel lengthscales) within gKDR - rename tune_structural_dimension -> tune_parameters - documentation - improved optimization routine * Improved tests for parameter tuning (gKDR) * Tweak to test (DimensionReduction) * Whitespace cleanup * Correct naming of variable (DimensionReduction) * Factor out internal loss function from gKDR.tune_parameters * Use a smaller test example to reduce test runtime * MCMC (#33) * added separate functions to calculated squared exponential kernel * added matern 5/2 covariance function * put kernel computations into a separate function and removed conjugate gradient based unit test that always gave problems * moved kernel functions and tests to separate files * added function to compute gradient of the squared exponential kernel * changed GP class to use derivative function * added derivatives for matern 5/2 kernel * quick and dirty modification to GP in order to use kernel functions * cleaned up distance calculation to use standardized euclidean distance * modified fast GP in MICE code to use kernel interface * made correction to meaning of nugget parameter for MICE candidate GP to be relative to current variance * fixed minor issues in MICE design to allow for zero samples and ensuring that parameter values are correctly set * updated MICE benchmark details * cosmetic tweaks to MICE benchmark * full hessian implementation in kernel functions * refactored kernel functions into objects * implemented Hessian computation into GP class * Documented base kernel class * Documented derived kernel classes * added documentation pages for kernels * corrected documentation to include newly implemented classes and fixed some old bugs * renamed run_init_design to be consistent with other methods that use *_initial_design * made minor change in MICEFastGP documentation * broke up prediction methods into single and multiple parameter sets, plus some other changes needed to accomodate them * added routine to compute local covariance matrix from hessian * implemented approximate normal hyperparameter sampling * added utility functions for MCMC sampling * fully implemented basic MCMC sampler * working MCMC implementation with full set of tests * fixed a few bugs in GP and MCMC implmentation * fixed bug in variance prediction where roundoff error can cause negative variance * added docstrings for MCMC routines * added documentation for MCMC-related methods and code additions * created benchmark for MCMC sampling and added documentation pages for it * added information on MCMC benchmark to readme * added additional pages to documentation for MCMC sampling * removed renamed mcmc benchmark file * fixed MCMC docstring in GP class * Fix whitespace in Makefile * Forward kwargs (gKDR._compute_loss); correct number of cross-validation folds * Add benchmark for gKDR * Wrap long lines in docstrings * Versioning (#38) * added code needed for versioning to devel branch * forgot to modify setup.py file * corrected line accidentally deleted from __init__.py * added prerelease number to devel branch to track commits on devel * corrected comments in conf.py to reflect full release numbering * added simple demos for GP and MICE (#46) * added simple demos for GP and MICE * incremented prerelease number for merge * History Matching (#39) * initial commit of history matching class and benchmark with minor tweaks * broke benchmark and sanity checks into two files for history matching * reindented code to use 4 spaces * added unit tests and some bug fixes for HistoryMatching * added tests for implausability plus some other checks and bug fixes in HistoryMatching * fixed misspelling of implausibility * changed file name for benchmark in makefile * fixed documentation in HistoryMatching class to be consistent with others * improved documentation, cleaned up code, added a few unit tests for HistoryMatching * fixed some docstring formatting and base rst file for HistoryMatching * full implementation of history matching with unit tests and documentation * simplified model discrepancy based on discussion with Danny * fixes to history matching file and tests * fixed some comparisons with None in SequentialDesign * broke up long test for Hessian into parts * incremented prerelease for history match merge * Feature/mucmtoolkit (#54) * added toolkit with converted pages and images * incremented version number * Feature/mucmtoolkit (#55) * fixed bug in documentation to display methods * version number change for corrected PR * merge input derivative bugfix into devel (#61) * Fix/cachefactmat (#62) * corrected GP class to cache factorized matrix rather than inverse plus cleaned up a few unneeded internal variables * incremented prerelease version number * missed a line that should have been deleted * added test to confirm that variance predictions are stable * fixed solve routines to use cho_solve in scipy * Fix/toolkitcorr (#63) * toolkit proofreading and corrections * continuing updates of toolkit pages * edits to toolkit pages * finished corrections up through meta section * updated toolkit threads section * updates to proc section of toolkit * incremented prerelease version number * modified version for release v0.2.0 * Adjust the paper references in DimensionReduction.py * Update paper reference in documentation * V0.3.0rc (#125) * Add dimension reduction functionality (python impl. of gKDR) * Tweaks to dimension reduction test * Add documentation for DimensionReduction * Add/fix some tests for DimensionReduction * Fix test (DimensionReduction) * Docstring -> raw string to fix invalid escape sequence warning * Add sanity checks for parameters passed to DimensionReduction * Fix assertion in DimensionReduction constructor * Fix assertion in DimensionReduction constructor * Test: optimize structural dimension * First attempt at tuning the structural dimension (kdr) * Make GaussianProcess objects callable (for prediction) * Add 'train_model' interface to GaussianProcess * DimensionReduction tweak to example * Introduce X_scale/Y_scale parameters in gKDR kernel (DimensionReduction) * Fix whitespace * DimensionReduction: use specialized Hermitian eigensolver * Tune parameters (structural dimension and kernel lengthscales) within gKDR - rename tune_structural_dimension -> tune_parameters - documentation - improved optimization routine * Improved tests for parameter tuning (gKDR) * Tweak to test (DimensionReduction) * Whitespace cleanup * Correct naming of variable (DimensionReduction) * Factor out internal loss function from gKDR.tune_parameters * Use a smaller test example to reduce test runtime * MCMC (#33) * added separate functions to calculated squared exponential kernel * added matern 5/2 covariance function * put kernel computations into a separate function and removed conjugate gradient based unit test that always gave problems * moved kernel functions and tests to separate files * added function to compute gradient of the squared exponential kernel * changed GP class to use derivative function * added derivatives for matern 5/2 kernel * quick and dirty modification to GP in order to use kernel functions * cleaned up distance calculation to use standardized euclidean distance * modified fast GP in MICE code to use kernel interface * made correction to meaning of nugget parameter for MICE candidate GP to be relative to current variance * fixed minor issues in MICE design to allow for zero samples and ensuring that parameter values are correctly set * updated MICE benchmark details * cosmetic tweaks to MICE benchmark * full hessian implementation in kernel functions * refactored kernel functions into objects * implemented Hessian computation into GP class * Documented base kernel class * Documented derived kernel classes * added documentation pages for kernels * corrected documentation to include newly implemented classes and fixed some old bugs * renamed run_init_design to be consistent with other methods that use *_initial_design * made minor change in MICEFastGP documentation * broke up prediction methods into single and multiple parameter sets, plus some other changes needed to accomodate them * added routine to compute local covariance matrix from hessian * implemented approximate normal hyperparameter sampling * added utility functions for MCMC sampling * fully implemented basic MCMC sampler * working MCMC implementation with full set of tests * fixed a few bugs in GP and MCMC implmentation * fixed bug in variance prediction where roundoff error can cause negative variance * added docstrings for MCMC routines * added documentation for MCMC-related methods and code additions * created benchmark for MCMC sampling and added documentation pages for it * added information on MCMC benchmark to readme * added additional pages to documentation for MCMC sampling * removed renamed mcmc benchmark file * fixed MCMC docstring in GP class * Fix whitespace in Makefile * Forward kwargs (gKDR._compute_loss); correct number of cross-validation folds * Add benchmark for gKDR * Wrap long lines in docstrings * Versioning (#38) * added code needed for versioning to devel branch * forgot to modify setup.py file * corrected line accidentally deleted from __init__.py * added prerelease number to devel branch to track commits on devel * corrected comments in conf.py to reflect full release numbering * added simple demos for GP and MICE (#46) * added simple demos for GP and MICE * incremented prerelease number for merge * History Matching (#39) * initial commit of history matching class and benchmark with minor tweaks * broke benchmark and sanity checks into two files for history matching * reindented code to use 4 spaces * added unit tests and some bug fixes for HistoryMatching * added tests for implausability plus some other checks and bug fixes in HistoryMatching * fixed misspelling of implausibility * changed file name for benchmark in makefile * fixed documentation in HistoryMatching class to be consistent with others * improved documentation, cleaned up code, added a few unit tests for HistoryMatching * fixed some docstring formatting and base rst file for HistoryMatching * full implementation of history matching with unit tests and documentation * simplified model discrepancy based on discussion with Danny * fixes to history matching file and tests * fixed some comparisons with None in SequentialDesign * broke up long test for Hessian into parts * incremented prerelease for history match merge * Feature/mucmtoolkit (#54) * added toolkit with converted pages and images * incremented version number * Feature/mucmtoolkit (#55) * fixed bug in documentation to display methods * version number change for corrected PR * merge input derivative bugfix into devel (#61) * Fix/cachefactmat (#62) * corrected GP class to cache factorized matrix rather than inverse plus cleaned up a few unneeded internal variables * incremented prerelease version number * missed a line that should have been deleted * added test to confirm that variance predictions are stable * fixed solve routines to use cho_solve in scipy * Fix/toolkitcorr (#63) * toolkit proofreading and corrections * continuing updates of toolkit pages * edits to toolkit pages * finished corrections up through meta section * updated toolkit threads section * updates to proc section of toolkit * incremented prerelease version number * reset version to 0.3.0dev0 be consistent with master update (#70) * Feature/meanfunc (#74) * initial working implementation of mean function with tests * implemented polynomial mean function * added finite difference tests to mean function unit tests * made finite difference spacing a fixture * changed fixed mean to use a function rather than lambda for derivative * implemented mean function (note only unit tests assume zero mean, will write new ones during refactor of interface) * fixed bugs in mean function implementation * implemented additional mean function capabilities and wrote tests * added docstrings to base mean function class * documented mean sum class * documented mean product class * documented mean composite class * documented fixed mean class * added documentation and a few other checks to the fixed mean function implementations * added documentation for coefficient class * added documentation for polynomial mean class * added module docstring and test for indexing error in composite mean * added documentation page for mean function * implemented power mean function * fixed bugs in mean power and wrote unit tests * updated pre-release version for merge to devel * Feature/formula (#77) * initial working implementation of mean function with tests * implemented polynomial mean function * added finite difference tests to mean function unit tests * made finite difference spacing a fixture * changed fixed mean to use a function rather than lambda for derivative * implemented mean function (note only unit tests assume zero mean, will write new ones during refactor of interface) * fixed bugs in mean function implementation * implemented additional mean function capabilities and wrote tests * added docstrings to base mean function class * documented mean sum class * documented mean product class * documented mean composite class * documented fixed mean class * added documentation and a few other checks to the fixed mean function implementations * added documentation for coefficient class * added documentation for polynomial mean class * added module docstring and test for indexing error in composite mean * added documentation page for mean function * implemented power mean function * fixed bugs in mean power and wrote unit tests * basic working formula parser on linear terms * wrote tokenizer function * modified tokenizer to correct exponentiation and wrote expression parser * removed unneeded function * appear to have working formula parser * fixed issue with square bracket parsing * added class method and moved some things around * added some unit tests for formula parsing * implemented tests for tokenizing, parsing, and evaluating functions * full set of unit tests for formulas and additional method in mean function to create from a formula * changed base name and created functional interface for formula plus string methods * added docstrings and renamed some functions * added documentation for formulas and modified the mean function page a bit * added patsy to install for testing and updated python version to 3.7 * updated version number for merge into devel * Feature/GPrefactor (#81) * initial working implementation of mean function with tests * implemented polynomial mean function * added finite difference tests to mean function unit tests * made finite difference spacing a fixture * changed fixed mean to use a function rather than lambda for derivative * implemented mean function (note only unit tests assume zero mean, will write new ones during refactor of interface) * fixed bugs in mean function implementation * implemented additional mean function capabilities and wrote tests * added docstrings to base mean function class * documented mean sum class * documented mean product class * documented mean composite class * documented fixed mean class * added documentation and a few other checks to the fixed mean function implementations * added documentation for coefficient class * added documentation for polynomial mean class * added module docstring and test for indexing error in composite mean * added documentation page for mean function * implemented power mean function * fixed bugs in mean power and wrote unit tests * basic working formula parser on linear terms * wrote tokenizer function * modified tokenizer to correct exponentiation and wrote expression parser * removed unneeded function * appear to have working formula parser * fixed issue with square bracket parsing * added class method and moved some things around * added some unit tests for formula parsing * implemented tests for tokenizing…
1 parent e97f041 commit 5033dc8

43 files changed

Lines changed: 3358 additions & 434 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.travis.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
language: python
2+
dist: focal
23
python:
3-
- "3.7"
4+
- "3.9"
45
install:
56
- pip install 'numpy>=1.19'
67
- pip install -r requirements.txt
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
.. _multioutput_tutorial:
2+
3+
Multi-Output Tutorial
4+
=====================
5+
6+
*Note: This tutorial requires Scipy version 1.4 or later to run the simulator.*
7+
8+
This page includes an end-to-end example of using ``mogp_emulator`` to perform model calibration
9+
with a simulator with multiple outputs. Note that this builds on the main tutorial with a
10+
second output (in this case, the velocity of the projectile at the end of the simulation),
11+
which is able to further constrain the NROY space as described in the first tutorial.
12+
13+
.. literalinclude:: ../../mogp_emulator/demos/multioutput_tutorial.py
14+
15+
One thing to note about multiple outputs is that they must be run as a script with a
16+
``if __name__ == __main__`` block in order to correctly use the multiprocessing
17+
library. This can usually be done as in the example for short scripts, while for more
18+
complex analyses it is usually better to define functions (as in the benchmark for
19+
multiple outputs).
20+
21+
More Details
22+
------------
23+
24+
More details about these steps can be found in the :ref:`methods` section, or on the following page
25+
that goes into :ref:`more details <methoddetails>` on the options available in this software library.
26+
For more on the specific implementation detials, see the various
27+
:ref:`implementation pages <implementation>` describing the software components.

docs/implementation/DimensionReduction.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,3 +30,4 @@ Utilities
3030
.. rubric:: References
3131
.. [Fukumizu1] https://www.ism.ac.jp/~fukumizu/software.html
3232
.. [FL13] Fukumizu, Kenji and Chenlei Leng. "Gradient-based kernel dimension reduction for regression." Journal of the American Statistical Association 109, no. 505 (2014): 359-370
33+
.. [LG17] Liu, Xiaoyu and Guillas, Serge. "Dimension Reduction for Gaussian Process Emulation: An Application to the Influence of Bathymetry on Tsunami Heights." SIAM/ASA Journal on Uncertainty Quantification 5, no. 1 (2017): 787-812 https://doi.org/10.1137/16M1090648

docs/implementation/ExperimentalDesign.rst

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,4 +42,19 @@ The ``LatinHypercubeDesign`` Class
4242
:members:
4343
:inherited-members:
4444

45+
.. automethod:: __init__
46+
47+
**********************************
48+
The ``MaxiMinLHC`` Class
49+
**********************************
50+
51+
.. _MaxiMinLHC:
52+
53+
.. automodule:: mogp_emulator.ExperimentalDesign.MaxiMinLHC
54+
:noindex:
55+
56+
.. autoclass:: mogp_emulator.ExperimentalDesign.MaxiMinLHC
57+
:members:
58+
:inherited-members:
59+
4560
.. automethod:: __init__

docs/implementation/implementation.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ mogp_emulator Implementation Details
1111
GaussianProcessGPU
1212
MultiOutputGP
1313
fitting
14+
validation
1415
MeanFunction
1516
formula
1617
Kernel

docs/implementation/validation.rst

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
.. _validation:
2+
3+
**********************************
4+
The ``validation`` Module
5+
**********************************
6+
7+
.. automodule:: mogp_emulator.validation
8+
:members:
9+
:noindex:

docs/index.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ details, and some included benchmarks.
3232
be used are:
3333

3434
demos/gp_demos
35+
demos/multioutput_tutorial
3536
demos/gp_kernel_demos
3637
demos/mice_demos
3738
demos/historymatch_demos

docs/intro/tutorial.rst

Lines changed: 19 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ the two input parameters of the drag coefficient :math:`C` and the initial veloc
5858
and returning a single value, which is :math:`x` at the end of the simulation.
5959

6060
.. literalinclude:: ../../mogp_emulator/demos/projectile.py
61-
:lines: 1-3,12-43,46-
61+
:lines: 1-80
6262

6363
Parameter Space
6464
~~~~~~~~~~~~~~~
@@ -103,7 +103,7 @@ distributions are fairly common due to their simplicity.
103103
To construct our experimental design and draw samples from it, we do the following:
104104

105105
.. literalinclude:: ../../mogp_emulator/demos/tutorial.py
106-
:lines: 1-4,24-28
106+
:lines: 1-5,25-29
107107

108108
This constructs an instance of :ref:`LatinHypercubeDesign <LatinHypercubeDesign>`, and
109109
creates the underlying distributions by providing a list of tuples. Each tuple gives the
@@ -131,11 +131,13 @@ by passing the GP object to the ``fit_GP_MAP`` function, which returns the same
131131
GP object but with the parameter values estimated.
132132

133133
.. literalinclude:: ../../mogp_emulator/demos/tutorial.py
134-
:lines: 33-37
134+
:lines: 34-40
135135

136-
While the function is called ``fit_GP_MAP`` (MAP means Maximum A Posteriori),
137-
in this case we have not provided any prior information on the parameter values,
138-
so it results in MLE.
136+
By default, if no priors are specified for the hyperparameters then defaults
137+
are chosen. In particular, for correlation lengths, default priors are fit
138+
that attempt to put most of the distribution mass in the range spanned by
139+
the input data. This tends to stabilize the fitting and improve performance,
140+
as fewer iterations are needed to ensure a good fit.
139141

140142
Following fitting, we print out some of the hyperparameters that are estimated.
141143
First, we print out the correlation lengths estimated for each of the input
@@ -162,15 +164,19 @@ and the uncertainty. This is done with the ``predict`` method of
162164
:ref:`GaussianProcess <GaussianProcess>`:
163165

164166
.. literalinclude:: ../../mogp_emulator/demos/tutorial.py
165-
:lines: 44-52
167+
:lines: 46-55
166168

167169
``predictions`` is an object containing the mean and uncertainty (variance)
168170
of the predictions. A GP assumes that the outputs follow a Normal Distribution,
169171
so we can perform validation by asking how many of our validation points mean estimates
170-
are within 2 standard deviations of the true value. Usually for this example this is
171-
about 8/10, so not quite as we would expect if it were perfectly recreating the
172-
function. However, we will see that this still is good enough in most cases
173-
for the task at hand.
172+
are within 2 standard deviations of the true value by computing the standard errors
173+
of the emulator predictions on the validation points. ``mogp_emulator`` contains
174+
a number of methods of automatically validating an emulator given some validation
175+
points, including computing standard errors (see the :ref:`validation <validation>`
176+
documentation for more details). Usually for this example we would expect
177+
about 8/10 to be within 2 standard devations, so not quite as we would expect if
178+
it were perfectly recreating the function. However, we will see that this still is
179+
good enough in most cases for the task at hand.
174180

175181
History Matching
176182
~~~~~~~~~~~~~~~~
@@ -206,7 +212,7 @@ and Monte Carlo sampling (especially in only 2 dimensions). Then, we create a
206212
Yet" (NROY). This is done as follows:
207213

208214
.. literalinclude:: ../../mogp_emulator/demos/tutorial.py
209-
:lines: 58-65
215+
:lines: 60-68
210216

211217
First, we set a large number of samples and draw them from the experimental design object. Then,
212218
We construct the :ref:`HistoryMatching <HistoryMatching>` object by giving the fit GP
@@ -226,7 +232,7 @@ surrogate model for reference. This plotting command is only executed if ``matpl
226232
installed:
227233

228234
.. literalinclude:: ../../mogp_emulator/demos/tutorial.py
229-
:lines: 5-10,69-
235+
:lines: 6-11,71-
230236

231237
which should make a plot that looks something like this:
232238

mogp_emulator/DimensionReduction.py

Lines changed: 7 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
"""This module provides classes and utilities for performing dimension
2-
reduction. Currently there is a single class :class:`mogp_emulator.gKDR` which implements
3-
the method of Fukumizu and Leng [FL13]_.
2+
reduction. There is a single class :class:`mogp_emulator.gKDR` which
3+
implements the method of Fukumizu and Leng [FL13]_, and which can be
4+
used jointly with Gaussian process emulation as in [LG17]_.
45
56
Example: ::
67
@@ -120,21 +121,11 @@ class gKDR(object):
120121

121122
"""Dimension reduction by the gKDR method.
122123
123-
See link [Fukumizu1]_ (and in particular, [FL13]_) for details of
124-
the method.
125-
126-
Note that this is a simpler and faster method than the original
127-
"KDR" method by the same authors (but with an added
128-
approximation). The KDR method will be implemented separately.
124+
See [Fukumizu1]_, [FL13]_ and [LG17]_.
129125
130126
An instance of this class is callable, with the ``__call__``
131127
method taking an input coordinate and mapping it to a reduced
132128
coordinate.
133-
134-
Note that this class currently implements a *direct* translation
135-
of the Matlab implementation of KernelDeriv (see link above) into
136-
Python/NumPy. It is due to be replaced with a Fortran
137-
implementation, but this should not affect the interface.
138129
"""
139130

140131
def __init__(self, X, Y, K=None, X_scale = 1.0, Y_scale = 1.0, EPS=1E-8, SGX=None, SGY=None):
@@ -378,18 +369,17 @@ def tune_parameters(cls, X, Y, train_model, cXs=None, cYs=None,
378369
within the kernel, minimizing the the loss from a
379370
Gaussian process regression:
380371
381-
>>> from mogp_emulator import gKDR
382-
>>> from mogp_emulator import GaussianProcess
372+
>>> from mogp_emulator import gKDR, GaussianProcess, fit_GP_MAP
383373
>>> X = ...
384374
>>> Y = ...
385-
>>> dr, loss = gKDR.tune_parameters(X, Y, GaussianProcess.train_model)
375+
>>> dr, loss = gKDR.tune_parameters(X, Y, fit_GP_MAP)
386376
>>> gp = GaussianProcess(dr(X), Y)
387377
388378
Or, specifying some optional parameters for the lengthscales,
389379
the maximum value of `K` to use, the number of folds for
390380
cross-validation, and producing verbose output:
391381
392-
>>> dr, loss = gKDR.tune_parameters(X, Y, GaussianProcess.train_model,
382+
>>> dr, loss = gKDR.tune_parameters(X, Y, fit_GP_MAP,
393383
... cXs = [0.5, 1.0, 2.0], cYs = [2.0],
394384
... maxK = 25, cross_validation_folds=4, verbose = True)
395385

mogp_emulator/ExperimentalDesign.py

Lines changed: 103 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import numpy as np
22
import scipy.stats
3+
from scipy.spatial.distance import pdist
34
from inspect import signature
45

56
class ExperimentalDesign(object):
@@ -235,13 +236,13 @@ def _draw_samples(self, n_samples):
235236
"""
236237
raise NotImplementedError
237238

238-
def sample(self, n_samples):
239+
def sample(self, n_samples, **kwargs):
239240
"""
240241
Draw parameter samples from the experimental design
241242
242243
This method implements drawing parameter samples from the experimental design. The method does
243244
this by calling the ``_draw_samples`` method to obtain samples from the :math:`[0,1]^n` hypercube,
244-
where :math:`n` is the number of parameters. The ``sample``method then transforms these samples
245+
where :math:`n` is the number of parameters. The ``sample`` method then transforms these samples
245246
drawn from the low level method to the actual parameter values using the PPF functions provided
246247
when initilizing the object. Note that this method also checks that all parameter values are
247248
finite; if any ``NaN`` values are returned, an error will be raised.
@@ -250,6 +251,9 @@ def sample(self, n_samples):
250251
using a different protocol only needs to change the ``_draw_samples`` method. This makes it
251252
simpler to define new designs, as only a single method needs to be altered.
252253
254+
Also accepts a ``kwargs`` argument to allow other derived classes to implement additional
255+
keyword arguments.
256+
253257
:param n_samples: Number of samples to be drawn from the design (must be a positive integer)
254258
:type n_samples: int
255259
:returns: Samples drawn from the design parameter space as a numpy array with shape
@@ -261,16 +265,13 @@ def sample(self, n_samples):
261265
assert n_samples > 0, "number of samples must be positive"
262266

263267
sample_values = np.zeros((n_samples, self.get_n_parameters()))
264-
random_draws = self._draw_samples(n_samples)
268+
random_draws = self._draw_samples(n_samples, **kwargs)
265269

266270
assert np.all(random_draws >= 0.) and np.all(random_draws <= 1.), "error in generating random samples"
267271

268272
for (dist, index) in zip(self.distributions, range(self.get_n_parameters())):
269-
try:
270-
sample_values[:,index] = dist(random_draws[:,index])
271-
except:
272-
for sample_index in range(n_samples):
273-
sample_values[sample_index, index] = dist(random_draws[sample_index,index])
273+
for sample_index in range(n_samples):
274+
sample_values[sample_index, index] = dist(random_draws[sample_index,index])
274275

275276
assert np.all(np.isfinite(sample_values)), "error due to non-finite values of parameters"
276277

@@ -406,7 +407,7 @@ def __init__(self, *args):
406407
self.method = "Monte Carlo"
407408
super().__init__(*args)
408409

409-
def _draw_samples(self, n_samples):
410+
def _draw_samples(self, n_samples, **kwargs):
410411
"""
411412
Low level method for drawing random samples from a Monte Carlo design
412413
@@ -546,7 +547,7 @@ def __init__(self, *args):
546547
self.method = "Latin Hypercube"
547548
super().__init__(*args)
548549

549-
def _draw_samples(self, n_samples):
550+
def _draw_samples(self, n_samples, **kwargs):
550551
"""
551552
Low level method for drawing random samples from a Latin Hypercube design
552553
@@ -560,7 +561,7 @@ def _draw_samples(self, n_samples):
560561
561562
:param n_samples: Number of samples to be drawn from the design (must be a positive integer)
562563
:type n_samples: int
563-
:returns: Random Monte Carlo samples drawn from the :math:`[0,1]^n` hypercube as a numpy
564+
:returns: Random samples drawn from the :math:`[0,1]^n` hypercube as a numpy
564565
array with shape ``(n_samples, n_parameters)``
565566
:rtype: ndarray
566567
"""
@@ -580,4 +581,94 @@ def _draw_samples(self, n_samples):
580581

581582
assert np.all(random_samples >= 0.) and np.all(random_samples <= 1.), "error in generating latin hypercube samples"
582583

583-
return random_samples
584+
return random_samples
585+
586+
class MaxiMinLHC(LatinHypercubeDesign):
587+
def __init__(self, *args):
588+
"""
589+
Class representing a one-shot design of experiments with uncorrelated parameters using
590+
MaxiMin Latin Hypercube Sampling
591+
592+
This class provides an implementation for a class for designing experiments to sample
593+
the parameter space of a complex model using MaxiMin Latin Hypercube sampling. MaxiMin
594+
LHCs repeatedly draw samples from the base LHC design, keeping the realization that
595+
maximizes the minimum pairwise distance between all design points. Because of this,
596+
MaxiMin designs tend to spread their samples closer to the edge of the parameter
597+
space and in many cases result in more accurate sampling than a single LHC draw.
598+
599+
The parameter space can be specified in a variety of ways, but essentially the user must
600+
provide a Probability Point Function (PPF, or inverse of the Cumulative Distribution Function)
601+
for each input parameter. Each PPF function takes a single numeric input and maps from
602+
the interval :math:`[0,1]` to the desired parameter distribution value for a given parameter,
603+
and each parameter has a separate function describing its distribution. Note that this makes
604+
the assumption of no correlations between any of the parameter values (a future version may
605+
implement an experimental design where there are such parameter correlations). Once the
606+
design is initialized, a desired number of samples can be drawn from the design, returning
607+
an array holding the desired number of samples from the parameter space.
608+
609+
Internally, the class holds the set of PPFs for all of the parameter values, and samples are
610+
drawn by calling the ``sample`` method. To draw the samples, the ``_draw_samples`` is used
611+
to generate a series of points in the :math:`[0,1]^n` hypercube using MaxiMin Latin Hypercube
612+
sampling, where :math:`n` is the number of paramters. This set of samples from the Latin
613+
Hypercube is then mapped to the parameter space using the given PPF functions.
614+
615+
Unlike Monte Carlo sampling, Latin Hypercube designs attempt to sample more uniformly from the
616+
parameter space. Latin Hypercube sampling ensures that each sample is drawn from a different
617+
part of the space for each parameter. For example, if four samples are drawn, then for each
618+
parameter, one sample is guaranteed to be drawn from each quartile of the distribution. This
619+
ensures a more uniform sampling when compared on Monte Carlo sampling, but requires slightly
620+
more computation to generate the samples. Note however, that for very large numbers of parameters,
621+
Latin Hypercubes still may not sample very efficiently. This is due to the fact that the size of
622+
the parameter space grows exponentially with the number of dimensions, so a fixed number of
623+
samples will sample the space more poorly as the number of parameters increases.
624+
"""
625+
self.method = "MaxiMinLHC"
626+
super().__init__(*args)
627+
628+
def _draw_samples(self, n_samples, n_tries=1000, **kwargs):
629+
"""
630+
Sampling method for MaxiMin LHCs
631+
632+
Iterates over multiple LHCs and return the one that maximizes the
633+
minimum distance between pairs of points. The number of iterations
634+
over which to look for this MaxiMin critera can be specified by
635+
``n_tries``.
636+
637+
Distances are computed by ``scipy.spatial.distance.pdist``. Any
638+
additional ``kwargs`` passed here will be sent on to the ``pdist``
639+
function.
640+
641+
:param n_samples: Number of samples to be drawn from the design (must be a positive integer)
642+
:type n_samples: int
643+
:param n_tries: Number of LHC realizations to use in maximizing
644+
the MaxiMin criteria
645+
:type n_tries: int
646+
:param **kwargs: Keyword arguments to be passed to the
647+
``scipy.spatial.distance.pdist`` function.
648+
:returns: Random Monte Carlo samples drawn from the :math:`[0,1]^n` hypercube as a numpy
649+
array with shape ``(n_samples, n_parameters)``
650+
:rtype: ndarray
651+
"""
652+
653+
n_samples = int(n_samples)
654+
assert n_samples > 0, "number of samples must be positive"
655+
assert n_tries > 0, "n_tries must be a positive integer"
656+
n_tries = int(n_tries)
657+
658+
n_parameters = self.get_n_parameters()
659+
660+
best_samples = np.empty((n_samples, n_parameters))
661+
max_dist = -np.inf
662+
663+
for i in range(n_tries):
664+
random_samples = super()._draw_samples(n_samples)
665+
min_dist = np.min(pdist(random_samples, **kwargs))
666+
if min_dist > max_dist:
667+
max_dist = min_dist
668+
best_samples = random_samples
669+
670+
assert np.all(best_samples >= 0.0) and np.all(
671+
best_samples <= 1.0
672+
), "error in generating latin hypercube samples"
673+
674+
return best_samples

0 commit comments

Comments
 (0)