Skip to content

blakeaw/ObjectiveLearner

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

11 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

ObjectiveLearner

Get more out of objective function evaluations.

Python version badge license version release DOI

ObjectiveLearner is a python module that provides functionality to run Supervised Machine Learning (linear regression) and Sensitivity Analysis on the objective function versus parameter relationship using the thousands (to millions) of (sometimes expensive) objective function evaluations performed during model calibration with packages like PyDREAM, simplePSO, Gleipnir, and GAlibrate.

ObjectiveLearner provides easy to use objective function decorators which allow users to save data from the objective function evaluations performed during model calibration, and thereby provides them a way to utilize what would typically be lost data (i.e., not saved by the calibrator) and learn even more about the objective function and its relationship to model parameters, as well as learn more about the underlying model and assumptions the objective function represents.


Install

! Warning
ObjectiveLearner is still under heavy development and may rapidly change.

ObjectiveLearner installs as the objlearner package. It is compatible (i.e., tested) with Python >= 3.6.

Note that objlearner has the following core dependencies:

pip install

You can install the latest release of the objlearner package using pip sourced from the GitHub repo:

pip install -e git+https://github.com/blakeaw/ObjectiveLearner@v0.1.0#egg=objlearner

However, this will not automatically install the core dependencies. You will have to do that separately:

pip install numpy pandas scikit-learn SALib

Recommended additional software

The following software is not required for the basic operation of ObjectiveLearner, but provides extra capabilities and features when installed.

PySB

PySB is needed to run PySB models.

Jupyter

If you want to run the Jupyter IPython notebooks that come with ObjectiveLearner then you need to install Jupyter.


License

This project is licensed under the MIT License - see the LICENSE file for details


Documentation and Usage

Quick Overview

Principally, ObjectiveLearner defines the ObjectiveLearner class,

from objlearner import ObjectiveLearner

which defines an object that can be used to decorate a objective function:

@ObjectiveLearner
def objective(theta):
    ...
    ...
    return objective_value

The ObjectiveLearner decorator saves the input parameter vectors and the corresponding objective values generated when the objective function is called during model calibrations and provides functions to post-analyze the values with linear regression (using tools from scikit-learn) and sensitivity analysis (using tools from SALib).

Additionally, ObjectiveLearner provides two other decorator classes:

  • ObjectiveCounter - simply keeps count of the number of calls to the objective function.
  • ObjectiveSaver - In addition to keeping count of the number of calls to the objective function, it stores the parameter vectors and corresponding objective function values and provides functions to write the data to a file.

Jupyter Notebooks

Checkout the Jupyter IPython Notebook:

  1. Basics of ObjectiveLearner

Contact

To report problems or bugs, make comments, suggestions, or feature requests please open a GitHub Issue.


Citing

If you use the ObjectiveLearner software in your research, please cite it. You can export the reference in your preferred format from its Zenodo DOI entry.

Also, please cite the following references as appropriate for software used with/via ObjectiveLearner:

Packages from the SciPy ecosystem

These include NumPy and pandas for which references can be obtained from: https://www.scipy.org/citing.html

scikit-learn

  1. Scikit-learn: Machine Learning in Python, Pedregosa et al., JMLR 12, pp. 2825-2830, 2011.

SALib

  1. Herman, J. and Usher, W. (2017) SALib: An open-source Python library for sensitivity analysis. Journal of Open Source Software, 2(9). doi:10.21105/joss.00097

PySB

  1. Lopez, C. F., Muhlich, J. L., Bachman, J. A. & Sorger, P. K. Programming biological models in Python using PySB. Mol Syst Biol 9, (2013). doi:10.1038/msb.2013.1