Skip to content

Commit ecec9ea

Browse files
edaubots22
andauthored
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, 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> * bugfix to catch situation where kernel distance returns NaN * following confirmed bug fix, incremented version number for master update Co-authored-by: Oliver Strickson <ostrickson@turing.ac.uk> Co-authored-by: Oliver Strickson <ots22@users.noreply.github.com> * Feature/excaliburdemo (#133) * code to create example plots in excalibur workshop talk * updated docs to include excalibur workshop demo * increment version number * Repo name change (#147) * updated urls and pip installation instructions * updated numpy version needed for travis * increment version number for merge * fixed setup file for master update Co-authored-by: Oliver Strickson <ostrickson@turing.ac.uk> Co-authored-by: Oliver Strickson <ots22@users.noreply.github.com>
1 parent a2aefa3 commit ecec9ea

7 files changed

Lines changed: 179 additions & 25 deletions

File tree

.travis.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ language: python
22
python:
33
- "3.7"
44
install:
5+
- pip install 'numpy>=1.19'
56
- pip install -r requirements.txt
67
- pip install -r requirements-dev.txt
78
- pip install -r requirements-optional.txt

README.md

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,8 @@ values, optimizing hyperparameter values, and making predictions on unseen data.
66
experimental design, dimension reduction, and calibration tools to enable modellers to understand complex
77
computer simulations.
88

9-
[![Build Status](https://travis-ci.com/alan-turing-institute/mogp_emulator.svg?branch=master)](https://travis-ci.com/alan-turing-institute/mogp_emulator)
10-
[![codecov](https://codecov.io/gh/alan-turing-institute/mogp_emulator/branch/master/graph/badge.svg)](https://codecov.io/gh/alan-turing-institute/mogp_emulator)
9+
[![Build Status](https://travis-ci.com/alan-turing-institute/mogp-emulator.svg?branch=master)](https://travis-ci.com/alan-turing-institute/mogp-emulator)
10+
[![codecov](https://codecov.io/gh/alan-turing-institute/mogp-emulator/branch/master/graph/badge.svg)](https://codecov.io/gh/alan-turing-institute/mogp-emulator)
1111
[![Documentation Status](https://readthedocs.org/projects/mogp-emulator/badge/?version=latest)](https://mogp-emulator.readthedocs.io/en/latest/?badge=latest)
1212

1313
## Installation
@@ -16,15 +16,9 @@ computer simulations.
1616
installed via `pip`:
1717

1818
```bash
19-
pip install mogp_emulator
19+
pip install mogp-emulator
2020
```
2121

22-
(NOTE: the project is not yet on PyPI, but we expect that the current version of the `devel` branch will
23-
be the first one available to be installed that way so are accounting for this in the rewrite of this
24-
README. Until that is completed, please see the [docs/installation.rst](docs/intro/installation.rst)
25-
page for details on how to install the software manually. Thank you for your patience as we are hard
26-
at work on improvements to the software!)
27-
2822
Optionally, you may want to install some additional optional packages. `matplotlib` is useful for
2923
visualising some of the results of the benchmarks, and `patsy` is highly recommended for users that
3024
wish to parse R-style string formulas for specifying mean functions. These can be found in the
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
.. _excalibur_workshop_demo:
2+
3+
Gaussian Process Demo with Small Sample Size
4+
============================================
5+
6+
This demo includes an example shown at the ExCALIBUR workshop held online on
7+
24-25 September, 2020. The example shows the challenges of fitting a GP
8+
emulator to data that is poorly sampled, and how a mean function and
9+
hyperparameter priors can help constrain the model in a situation where
10+
a zero mean and Maximum Likelikhood Estimation perform poorly.
11+
12+
The specific example uses the projectile problem discussed in the
13+
:ref:`tutorial`. It draws 6 samples, which might be a typical sampling
14+
density for a high dimensional simulator that is expensive to run, where
15+
you might be able to draw a few samples per input parameter. It shows the
16+
true function, and then the emulator means predicted at the same points
17+
using Maximum Likelihood Estimation and a linear mean function combined with
18+
Maximum A Posteriori Estimation. The MLE emulator is completely useless,
19+
while the MAP estimation technique leads to significantly better performance
20+
and an emulator that is useful despite only drawing a small number of samples.
21+
22+
.. literalinclude::
23+
../../mogp_emulator/demos/excalibur_workshop_demo.py

docs/index.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@ details, and some included benchmarks.
3434
demos/gp_demos
3535
demos/mice_demos
3636
demos/gp_demoR
37+
demos/excalibur_workshop_demo
3738

3839
.. toctree::
3940
:maxdepth: 1

docs/intro/installation.rst

Lines changed: 13 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -6,13 +6,15 @@ Installation
66
In most cases, the easiest way to install ``mogp_emulator`` is via ``pip``, which should install the
77
library and all of its dependencies: ::
88

9-
pip install mogp_emulator
9+
pip install mogp-emulator
1010

11-
(NOTE: the project is not yet on PyPI, but we expect that the current version of the ``devel`` branch will
12-
be the first one available to be installed that way so are accounting for this in the rewrite of this
13-
documentation. Until that is completed, please follow the instructions below to install the software
14-
manually. Thank you for your patience as we are hard at work on improvements to the software!)
11+
You can also use ``pip`` to install directly from the github repository using ::
1512

13+
pip install git+https://github.com/alan-turing-institute/mogp-emulator
14+
15+
This will accomplish the same thing as the manual installation instructions
16+
below.
17+
1618
Manual Installation
1719
-------------------
1820

@@ -28,7 +30,7 @@ below.
2830

2931
If you prefer to check out the Github repository, you can download the code using: ::
3032

31-
git clone https://github.com/alan-turing-institute/mogp_emulator/
33+
git clone https://github.com/alan-turing-institute/mogp-emulator/
3234

3335
This will clone the entire git history of the software and check out the ``master`` branch by default.
3436
The ``master`` branch is the most stable version of the code, but will not have all features as the
@@ -61,15 +63,15 @@ Installation
6163

6264
Then to install the main code, run the following command: ::
6365

64-
python setup.py install
66+
python setup.py install
6567

6668
This will install the main code in the system Python installation. You may need adminstrative priveleges
6769
to install the software itself, depending on your system configuration. However, any updates to the code
6870
cloned through the github repository (particularly if you are using the devel branch, which is under more
6971
active development) will not be reflected in the system installation using this method. If you would like
7072
to always have the most active development version, install using: ::
7173

72-
python setup.py develop
74+
python setup.py develop
7375

7476
This will insert symlinks to the repository files into the system Python installation so that files
7577
are updated whenever there are changes to the code files.
@@ -86,12 +88,12 @@ change to the ``docs`` directory. There is a Makefile in the `docs` directory to
8688
documentation for you. To build the HTML version, enter the
8789
following into the shell from the ``docs`` directory: ::
8890

89-
make html
91+
make html
9092

9193
This will build the HTML version of the documentation. A standalone PDF version can be built, which
9294
requires a standard LaTeX installation, via: ::
9395

94-
make latexpdf
96+
make latexpdf
9597

9698
In both cases, the documentation files can be found in the corresponding directories in the ``docs/_build``
9799
directory. Note that if these directories are not found on your system, you may need to create them in
@@ -113,4 +115,4 @@ the code to determine test coverage.
113115
The tests can be run from the base ``mogp_emulator`` directory or the ``mogp_emulator/tests`` directory
114116
by entering ``pytest``, which will run all tests and print out the results to the console. In the
115117
``mogp_emulator/tests`` directory, there is also a ``Makefile`` that will run the tests for you.
116-
You can simply enter ``make tests`` into the shell.
118+
You can simply enter ``make tests`` into the shell.
Lines changed: 133 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,133 @@
1+
import numpy as np
2+
from projectile import simulator
3+
import mogp_emulator
4+
5+
try:
6+
import matplotlib.pyplot as plt
7+
makeplots = True
8+
except ImportError:
9+
makeplots = False
10+
11+
# define a helper function for making plots
12+
13+
def plot_solution(field, title, filename, simulation_points, validation_points, tri):
14+
plt.figure(figsize=(4,3))
15+
plt.tripcolor(validation_points[:,0], validation_points[:,1], tri.triangles,
16+
field, vmin=0, vmax=5000.)
17+
cb = plt.colorbar()
18+
plt.scatter(simulation_points[:,0], simulation_points[:,1])
19+
plt.xlabel("log drag coefficient")
20+
plt.ylabel("Launch velocity (m/s)")
21+
cb.set_label("Projectile distance (m)")
22+
plt.title(title)
23+
plt.tight_layout()
24+
plt.savefig(filename, dpi=200)
25+
26+
# A tutorial illustrating effectiveness of mean functions and priors for GP emulation
27+
28+
# Most often, we are not able to sample very densely from a simulation, so we
29+
# have relatively few samples per input parameter. This can lead to some problems
30+
# when constructing a robust emulator. This tutorial illustrates how we can build
31+
# better emulators using the tools in mogp_emulator.
32+
33+
# We need to draw some samples from the space to run some simulations and build our
34+
# emulators. We use a LHD design with only 6 sample points.
35+
36+
lhd = mogp_emulator.LatinHypercubeDesign([(-4., 0.), (0., 1000.)])
37+
38+
n_simulations = 6
39+
simulation_points = lhd.sample(n_simulations)
40+
simulation_output = np.array([simulator(p) for p in simulation_points])
41+
42+
# Next, fit the surrogate GP model using MLE, zero mean, and no priors.
43+
# Print out hyperparameter values as correlation lengths, sigma, and nugget
44+
45+
gp = mogp_emulator.GaussianProcess(simulation_points, simulation_output)
46+
gp = mogp_emulator.fit_GP_MAP(gp)
47+
48+
print("Zero mean and no priors:")
49+
print("Correlation lengths = {}".format(np.sqrt(np.exp(-gp.theta[:2]))))
50+
print("Sigma = {}".format(np.sqrt(np.exp(gp.theta[2]))))
51+
print("Nugget = {}".format(gp.nugget))
52+
print()
53+
54+
# We can look at how the emulator performs by comparing the emulator output to
55+
# a large number of validation points. Since this simulation is cheap, we can
56+
# actually compute this for a large number of points.
57+
58+
n_valid = 1000
59+
validation_points = lhd.sample(n_valid)
60+
validation_output = np.array([simulator(p) for p in validation_points])
61+
62+
if makeplots:
63+
import matplotlib.tri
64+
tri = matplotlib.tri.Triangulation((validation_points[:,0]+4.)/4.,
65+
(validation_points[:,1]/1000.))
66+
67+
plot_solution(validation_output, "True simulator", "simulator_output.png",
68+
simulation_points, validation_points, tri)
69+
70+
# Now predict values with the emulator and plot output and error
71+
72+
predictions = gp.predict(validation_points)
73+
74+
if makeplots:
75+
plot_solution(predictions.mean, "MLE emulator", "emulator_output_MLE.png",
76+
simulation_points, validation_points, tri)
77+
78+
# This is not very good! The simulation points are too sparsely sampled to give the
79+
# emulator any idea what to do about the function shape. We just know the value at a few
80+
# points, and it throws up its hands and predicts zero everywhere else.
81+
82+
# To improve this, we will specify a mean function and some priors to ensure that if we are
83+
# far away from an evaluation point we will still get some information from the emulator.
84+
85+
# We specify the mean function using a string, which follows a similar approach to R-style
86+
# formulas. There is an implicit constant term, and we use x[index] to specify how we
87+
# want the formula to depend on the inputs. We choose a simple linear form here, which has
88+
# three fitting parameters in addition to the correlations lengths, sigma, and nugget
89+
# parameters above.
90+
91+
meanfunc = "x[0]+x[1]"
92+
93+
# We now set priors for all of the hyperparameters to better constrain the estimation procedure.
94+
# We assume normal priors for the mean function parameters with a large variance (to not constrain
95+
# our choice too much). Note that the mean function parameters are on a linear scale, while the
96+
# correlation lengths, sigma, and nugget are on a logarithmic scale. Thus, if we choose normal
97+
# priors on the correlation lengths, these will actually be lognormal distributions.
98+
99+
# Finally, we choose inverse gamma and gamma distributions for the priors on sigma and the nugget
100+
# as those are typical conjugate priors for variances/precisions. We pick them to be where they are as
101+
# we expect sigma to be large (as the function is very sensitive to inputs) while we want the
102+
# nugget to be small.
103+
104+
priors = [mogp_emulator.Priors.NormalPrior(0., 10.),
105+
mogp_emulator.Priors.NormalPrior(0., 10.),
106+
mogp_emulator.Priors.NormalPrior(0., 10.),
107+
mogp_emulator.Priors.NormalPrior(0., 1.),
108+
mogp_emulator.Priors.NormalPrior(-10., 1.),
109+
mogp_emulator.Priors.InvGammaPrior(1., 1.),
110+
mogp_emulator.Priors.GammaPrior(1., 1.)]
111+
112+
# Now, construct another GP using the mean function and priors. note that we also specify that we
113+
# want to estimate the nugget based on our prior, rather than adaptively fitting it as we did in
114+
# the first go.
115+
116+
gp_map = mogp_emulator.GaussianProcess(simulation_points, simulation_output,
117+
mean=meanfunc, priors=priors, nugget="fit")
118+
gp_map = mogp_emulator.fit_GP_MAP(gp_map)
119+
120+
print("With mean and priors:")
121+
print("Mean function parameters = {}".format(gp_map.theta[:3]))
122+
print("Correlation lengths = {}".format(np.sqrt(np.exp(-gp_map.theta[3:5]))))
123+
print("Sigma = {}".format(np.sqrt(np.exp(gp_map.theta[-2]))))
124+
print("Nugget = {}".format(gp_map.nugget))
125+
126+
# Use the new fit GP to predict the validation points and plot to see if this improved
127+
# the fit to the true data:
128+
129+
predictions_map = gp_map.predict(validation_points)
130+
131+
if makeplots:
132+
plot_solution(predictions_map.mean, "Mean/Prior emulator", "emulator_output_MAP.png",
133+
simulation_points, validation_points, tri)

setup.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@
22

33
# version information
44
MAJOR = 0
5-
MINOR = 3
6-
MICRO = 1
5+
MINOR = 4
6+
MICRO = 0
77
PRERELEASE = 0
88
ISRELEASED = True
99
version = "{}.{}.{}".format(MAJOR, MINOR, MICRO)
@@ -36,12 +36,12 @@ def write_version_file(version):
3636
long_description_content_type="text/markdown",
3737
url='https://mogp-emulator.readthedocs.io/',
3838
project_urls={
39-
"Bug Tracker": "https://github.com/alan-turing-institute/mogp_emulator/issues",
39+
"Bug Tracker": "https://github.com/alan-turing-institute/mogp-emulator/issues",
4040
"Documentation": "https://mogp-emulator.readthedocs.io/",
41-
"Source Code": "https://github.com/alan-turing-institute/mogp_emulator/",
41+
"Source Code": "https://github.com/alan-turing-institute/mogp-emulator/",
4242
},
4343
author='Alan Turing Institute Research Engineering Group',
4444
author_email='edaub@turing.ac.uk',
4545
packages=setuptools.find_packages(),
4646
license=['MIT'],
47-
install_requires=['numpy', 'scipy'])
47+
install_requires=['numpy', 'scipy'])

0 commit comments

Comments
 (0)