ace

Python package for performing the Alternating Conditional Expectation (ACE) regression

https://github.com/partofthething/ace

Science Score: 13.0%

This score indicates how likely this project is to be science-related based on various indicators:

  • CITATION.cff file
  • codemeta.json file
  • .zenodo.json file
  • DOI references
    Found 1 DOI reference(s) in README
  • Academic publication links
  • Committers with academic emails
  • Institutional organization owner
  • JOSS paper metadata
  • Scientific vocabulary similarity
    Low similarity (17.0%) to scientific vocabulary
Last synced: 11 months ago · JSON representation

Repository

Python package for performing the Alternating Conditional Expectation (ACE) regression

Basic Info
  • Host: GitHub
  • Owner: partofthething
  • License: mit
  • Language: Python
  • Default Branch: master
  • Size: 163 KB
Statistics
  • Stars: 72
  • Watchers: 5
  • Forks: 21
  • Open Issues: 3
  • Releases: 0
Created about 12 years ago · Last pushed over 3 years ago
Metadata Files
Readme Changelog License

README.rst

===============
The ace Package
===============

.. image:: https://travis-ci.org/partofthething/ace.svg?branch=develop
    :target: https://travis-ci.org/partofthething/ace
    
ace is an implementation of the Alternating Conditional Expectation (ACE) algorithm [Breiman85]_,
which can be used to find otherwise difficult-to-find relationships between predictors
and responses and as a multivariate regression tool.

The code for this project, as well as the issue tracker, etc. is
`hosted on GitHub `_.
The documentation is hosted at http://partofthething.com/ace.


What is it?
-----------
ACE can be used for a variety of purposes. With it, you can:

 - build easy-to-evaluate surrogate models of data. For example, if you are optimizing input
   parameters to a complex and long-running simulation, you can feed the results of a parameter
   sweep into ACE to get a model that will instantly give you predictions of results of any
   combination of input within the parameter range.

 - expose interesting and meaningful relations between predictors and responses from complicated
   data sets. For instance, if you have survey results from 1000 people and you and you want to
   see how one answer is related to a bunch of others, ACE will help you.

The fascinating thing about ACE is that it is a *non-parametric* multivariate regression
tool. This means that it doesn't make any assumptions about the functional form of the data.
You may be used to fitting polynomials or lines to data. Well, ACE doesn't do that. It
uses an iteration with a variable-span scatterplot smoother (implementing local least
squares estimates) to figure out the structure of your data. As you'll see, that
turns out to be a powerful difference.

Installing it
-------------
ace is available in the `Python Package Index `_,
and can be installed simply with the following.

On Linux::

	sudo pip install ace

On Windows, use::

	pip install ace

Directly from source::

	git clone git@github.com:partofthething/ace.git
	cd ace
	python setup.py install

.. note::

	If you don't have git, you can just download the source directly from
	`here `_.

You can verify that the installation completed successfully by running the automated test
suite in the install directory::

	python -m unittest discover -bv

Using it
--------
To use, get some sample data:

.. code:: python

    from ace.samples import wang04
    x, y = wang04.build_sample_ace_problem_wang04(N=200)

and run:

.. code:: python

    from ace import model
    myace = model.Model()
    myace.build_model_from_xy(x, y)
    myace.eval([0.1, 0.2, 0.5, 0.3, 0.5])

For some plotting (matplotlib required), try:

.. code:: python

    from ace import ace
    ace.plot_transforms(myace.ace, fname = 'mytransforms.pdf')
    myace.ace.write_transforms_to_file(fname = 'mytransforms.txt')

Note that you could alternatively have loaded your data from a whitespace delimited
text file:

.. code:: python

	myace.build_model_from_txt(fname = 'myinput.txt')

.. warning:: The more data points ACE is given as input, the better the results will be.
			 Be careful with less than 50 data points or so.

Demo
----
A combination of various functions with noise is shown below:

.. have to use full path here to work in built docs and github-rendered README

.. image:: https://partofthething.com/ace/_static/ace_input_wang04.png
	   :alt: Plot of the input data, which is all over the place

Given just those points and zero knowledge of the underlying functions, ACE comes back
with this:

.. image:: https://partofthething.com/ace/_static/ace_transforms_wang04.png
	:alt: Plot of the output transforms, which clearly show the underlying structure


A longer version of this demo is available in the
`Sample ACE Problems `_ section.

Other details
-------------
This implementation of ACE isn't as fast as the original FORTRAN version, but it can
still crunch through a problem with 5 independent variables having 1000 observations each
in on the order of 15 seconds. Not bad.

ace also contains a pure-Python implementation of Friedman's SuperSmoother [Friedman82]_,
the variable-span smoother mentioned above. This can be useful on its own
for smoothing scatterplot data.

History
-------
The ACE algorithm was published in 1985 by Breiman and Friedman [Breiman85]_, and the original
FORTRAN source code is available from `Friedman's webpage `_.

Motivation
----------
Before this package, the ACE algorithm has only been available in Python by using the rpy2 module
to load in the acepack package of the R statistical language. This package is a pure-Python
re-write of the ACE algorithm based on the original publication, using modern software practices.
This package is slower than the original FORTRAN code, but it is easier to understand. This package
should be suitable for medium-weight data and as a learning tool.

For the record, it is also quite easy to run the original FORTRAN code in Python using f2py.

About the Author
----------------
This package was originated by Nick Touran, a nuclear engineer specializing in reactor physics.
He was exposed to ACE by his thesis advisor, Professor John Lee, and used it in his
Ph.D. dissertation to evaluate objective functions in a multidisciplinary
design optimization study of nuclear reactor cores [Touran12]_.

License
-------
This package is released under the MIT License, `reproduced
here `_.

References
----------
.. [Breiman85] L. BREIMAN and J. H. FRIEDMAN, "Estimating optimal transformations for multiple regression and
   correlation," Journal of the American Statistical Association, 80, 580 (1985).
   `[Link1] `_

.. [Friedman82] J. H. FRIEDMAN and W. STUETZLE, "Smoothing of scatterplots," ORION-003, Stanford
   University, (1982). `[Link2] `_

.. [Wang04] D. WANG and M. MURPHY, "Estimating optimal transformations for multiple regression using the
   ACE algorithm," Journal of Data Science, 2, 329 (2004).
   `[Link3] `_

.. [Touran12] N. TOURAN, "A Modal Expansion Equilibrium Cycle Perturbation Method for
   Optimizing High Burnup Fast Reactors," Ph.D. dissertation, Univ. of Michigan, (2012).
   `[The Thesis] `_


Owner

  • Name: Nick Touran
  • Login: partofthething
  • Kind: user
  • Location: Seattle, WA

Nuclear engineer in Seattle. Into energy and other neat problems.

GitHub Events

Total
  • Watch event: 4
  • Fork event: 1
Last Year
  • Watch event: 4
  • Fork event: 1

Committers

Last synced: almost 3 years ago

All Time
  • Total Commits: 61
  • Total Committers: 4
  • Avg Commits per committer: 15.25
  • Development Distribution Score (DDS): 0.262
Past Year
  • Commits: 1
  • Committers: 1
  • Avg Commits per committer: 1.0
  • Development Distribution Score (DDS): 0.0
Top Committers
Name Email Commits
Nick Touran n****k@p****m 45
ntouran p****g 13
g g****n@g****m 2
Niko Pasanen n****n@v****m 1
Committer Domains (Top 20 + Academic)

Issues and Pull Requests

Last synced: about 1 year ago

All Time
  • Total issues: 13
  • Total pull requests: 3
  • Average time to close issues: 4 months
  • Average time to close pull requests: about 8 hours
  • Total issue authors: 6
  • Total pull request authors: 3
  • Average comments per issue: 3.0
  • Average comments per pull request: 0.67
  • Merged pull requests: 2
  • Bot issues: 0
  • Bot pull requests: 0
Past Year
  • Issues: 0
  • Pull requests: 0
  • Average time to close issues: N/A
  • Average time to close pull requests: N/A
  • Issue authors: 0
  • Pull request authors: 0
  • Average comments per issue: 0
  • Average comments per pull request: 0
  • Merged pull requests: 0
  • Bot issues: 0
  • Bot pull requests: 0
Top Authors
Issue Authors
  • partofthething (3)
  • mycarta (3)
  • SimplyKnownAsG (3)
  • paulperry (2)
  • AtticusBeachy (1)
  • snowlover173 (1)
Pull Request Authors
  • np-8 (1)
  • SimplyKnownAsG (1)
  • klausweinbauer (1)
Top Labels
Issue Labels
enhancement (1) bug (1) help wanted (1)
Pull Request Labels

Packages

  • Total packages: 1
  • Total downloads:
    • pypi 1,167 last-month
  • Total dependent packages: 0
  • Total dependent repositories: 9
  • Total versions: 6
  • Total maintainers: 1
pypi.org: ace

Non-parametric multivariate regressions by Alternating Conditional Expectations

  • Versions: 6
  • Dependent Packages: 0
  • Dependent Repositories: 9
  • Downloads: 1,167 Last month
Rankings
Dependent repos count: 4.9%
Forks count: 8.4%
Stargazers count: 8.5%
Average: 8.9%
Dependent packages count: 10.0%
Downloads: 12.9%
Maintainers (1)
Last synced: 11 months ago

Dependencies

requirements.txt pypi
  • matplotlib >=1.0
  • numpy >=1.0
  • numpydoc >=0.1
  • scipy >=0.12
requirements_test.txt pypi
  • coveralls >=1.1 test
  • pydocstyle * test
  • pylint * test
  • pytest >=2.9.2 test
  • pytest-cov >=2.3.1 test
  • pytest-sugar >=0.7.1 test
  • pytest-timeout >=1.2.0 test
  • sphinx-rtd-theme * test
setup.py pypi
  • numpy *
  • scipy >=0.17