ace


Nameace JSON
Version 0.3.3 PyPI version JSON
download
home_pagehttps://github.com/partofthething/ace
SummaryNon-parametric multivariate regressions by Alternating Conditional Expectations
upload_time2023-05-03 06:15:47
maintainer
docs_urlNone
authorNick Touran
requires_python
licenseMIT
keywords regression ace multivariate statistics
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI
coveralls test coverage No coveralls.
            ===============
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 <https://github.com/partofthething/ace>`_.
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 <https://pypi.python.org/pypi/ace/>`_,
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 <https://github.com/partofthething/ace/archive/master.zip>`_.

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 <http://partofthething.com/ace/samples.html>`_ 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 <http://statweb.stanford.edu/~jhf/>`_.

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 <https://github.com/partofthething/ace/blob/master/LICENSE>`_.

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] <http://www.jstor.org/discover/10.2307/2288477?uid=2&uid=4&sid=21104902100507>`_

.. [Friedman82] J. H. FRIEDMAN and W. STUETZLE, "Smoothing of scatterplots," ORION-003, Stanford
   University, (1982). `[Link2] <http://www.slac.stanford.edu/cgi-wrap/getdoc/slac-pub-3013.pdf>`_

.. [Wang04] D. WANG and M. MURPHY, "Estimating optimal transformations for multiple regression using the
   ACE algorithm," Journal of Data Science, 2, 329 (2004).
   `[Link3] <http://www.jds-online.com/files/JDS-156.pdf>`_

.. [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] <http://deepblue.lib.umich.edu/bitstream/handle/2027.42/95981/ntouran_1.pdf?sequence=1>`_



            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/partofthething/ace",
    "name": "ace",
    "maintainer": "",
    "docs_url": null,
    "requires_python": "",
    "maintainer_email": "",
    "keywords": "regression ace multivariate statistics",
    "author": "Nick Touran",
    "author_email": "ace@partofthething.com",
    "download_url": "https://files.pythonhosted.org/packages/45/e3/6ff5edf791d33896d49abf77fe505e7c69476220379a7883207483b4ee3c/ace-0.3.3.tar.gz",
    "platform": null,
    "description": "===============\nThe ace Package\n===============\n\n.. image:: https://travis-ci.org/partofthething/ace.svg?branch=develop\n    :target: https://travis-ci.org/partofthething/ace\n    \nace is an implementation of the Alternating Conditional Expectation (ACE) algorithm [Breiman85]_,\nwhich can be used to find otherwise difficult-to-find relationships between predictors\nand responses and as a multivariate regression tool.\n\nThe code for this project, as well as the issue tracker, etc. is\n`hosted on GitHub <https://github.com/partofthething/ace>`_.\nThe documentation is hosted at http://partofthething.com/ace.\n\n\nWhat is it?\n-----------\nACE can be used for a variety of purposes. With it, you can:\n\n - build easy-to-evaluate surrogate models of data. For example, if you are optimizing input\n   parameters to a complex and long-running simulation, you can feed the results of a parameter\n   sweep into ACE to get a model that will instantly give you predictions of results of any\n   combination of input within the parameter range.\n\n - expose interesting and meaningful relations between predictors and responses from complicated\n   data sets. For instance, if you have survey results from 1000 people and you and you want to\n   see how one answer is related to a bunch of others, ACE will help you.\n\nThe fascinating thing about ACE is that it is a *non-parametric* multivariate regression\ntool. This means that it doesn't make any assumptions about the functional form of the data.\nYou may be used to fitting polynomials or lines to data. Well, ACE doesn't do that. It\nuses an iteration with a variable-span scatterplot smoother (implementing local least\nsquares estimates) to figure out the structure of your data. As you'll see, that\nturns out to be a powerful difference.\n\nInstalling it\n-------------\nace is available in the `Python Package Index <https://pypi.python.org/pypi/ace/>`_,\nand can be installed simply with the following.\n\nOn Linux::\n\n\tsudo pip install ace\n\nOn Windows, use::\n\n\tpip install ace\n\nDirectly from source::\n\n\tgit clone git@github.com:partofthething/ace.git\n\tcd ace\n\tpython setup.py install\n\n.. note::\n\n\tIf you don't have git, you can just download the source directly from\n\t`here <https://github.com/partofthething/ace/archive/master.zip>`_.\n\nYou can verify that the installation completed successfully by running the automated test\nsuite in the install directory::\n\n\tpython -m unittest discover -bv\n\nUsing it\n--------\nTo use, get some sample data:\n\n.. code:: python\n\n    from ace.samples import wang04\n    x, y = wang04.build_sample_ace_problem_wang04(N=200)\n\nand run:\n\n.. code:: python\n\n    from ace import model\n    myace = model.Model()\n    myace.build_model_from_xy(x, y)\n    myace.eval([0.1, 0.2, 0.5, 0.3, 0.5])\n\nFor some plotting (matplotlib required), try:\n\n.. code:: python\n\n    from ace import ace\n    ace.plot_transforms(myace.ace, fname = 'mytransforms.pdf')\n    myace.ace.write_transforms_to_file(fname = 'mytransforms.txt')\n\nNote that you could alternatively have loaded your data from a whitespace delimited\ntext file:\n\n.. code:: python\n\n\tmyace.build_model_from_txt(fname = 'myinput.txt')\n\n.. warning:: The more data points ACE is given as input, the better the results will be.\n\t\t\t Be careful with less than 50 data points or so.\n\nDemo\n----\nA combination of various functions with noise is shown below:\n\n.. have to use full path here to work in built docs and github-rendered README\n\n.. image:: https://partofthething.com/ace/_static/ace_input_wang04.png\n\t   :alt: Plot of the input data, which is all over the place\n\nGiven just those points and zero knowledge of the underlying functions, ACE comes back\nwith this:\n\n.. image:: https://partofthething.com/ace/_static/ace_transforms_wang04.png\n\t:alt: Plot of the output transforms, which clearly show the underlying structure\n\n\nA longer version of this demo is available in the\n`Sample ACE Problems <http://partofthething.com/ace/samples.html>`_ section.\n\nOther details\n-------------\nThis implementation of ACE isn't as fast as the original FORTRAN version, but it can\nstill crunch through a problem with 5 independent variables having 1000 observations each\nin on the order of 15 seconds. Not bad.\n\nace also contains a pure-Python implementation of Friedman's SuperSmoother [Friedman82]_,\nthe variable-span smoother mentioned above. This can be useful on its own\nfor smoothing scatterplot data.\n\nHistory\n-------\nThe ACE algorithm was published in 1985 by Breiman and Friedman [Breiman85]_, and the original\nFORTRAN source code is available from `Friedman's webpage <http://statweb.stanford.edu/~jhf/>`_.\n\nMotivation\n----------\nBefore this package, the ACE algorithm has only been available in Python by using the rpy2 module\nto load in the acepack package of the R statistical language. This package is a pure-Python\nre-write of the ACE algorithm based on the original publication, using modern software practices.\nThis package is slower than the original FORTRAN code, but it is easier to understand. This package\nshould be suitable for medium-weight data and as a learning tool.\n\nFor the record, it is also quite easy to run the original FORTRAN code in Python using f2py.\n\nAbout the Author\n----------------\nThis package was originated by Nick Touran, a nuclear engineer specializing in reactor physics.\nHe was exposed to ACE by his thesis advisor, Professor John Lee, and used it in his\nPh.D. dissertation to evaluate objective functions in a multidisciplinary\ndesign optimization study of nuclear reactor cores [Touran12]_.\n\nLicense\n-------\nThis package is released under the MIT License, `reproduced\nhere <https://github.com/partofthething/ace/blob/master/LICENSE>`_.\n\nReferences\n----------\n.. [Breiman85] L. BREIMAN and J. H. FRIEDMAN, \"Estimating optimal transformations for multiple regression and\n   correlation,\" Journal of the American Statistical Association, 80, 580 (1985).\n   `[Link1] <http://www.jstor.org/discover/10.2307/2288477?uid=2&uid=4&sid=21104902100507>`_\n\n.. [Friedman82] J. H. FRIEDMAN and W. STUETZLE, \"Smoothing of scatterplots,\" ORION-003, Stanford\n   University, (1982). `[Link2] <http://www.slac.stanford.edu/cgi-wrap/getdoc/slac-pub-3013.pdf>`_\n\n.. [Wang04] D. WANG and M. MURPHY, \"Estimating optimal transformations for multiple regression using the\n   ACE algorithm,\" Journal of Data Science, 2, 329 (2004).\n   `[Link3] <http://www.jds-online.com/files/JDS-156.pdf>`_\n\n.. [Touran12] N. TOURAN, \"A Modal Expansion Equilibrium Cycle Perturbation Method for\n   Optimizing High Burnup Fast Reactors,\" Ph.D. dissertation, Univ. of Michigan, (2012).\n   `[The Thesis] <http://deepblue.lib.umich.edu/bitstream/handle/2027.42/95981/ntouran_1.pdf?sequence=1>`_\n\n\n",
    "bugtrack_url": null,
    "license": "MIT",
    "summary": "Non-parametric multivariate regressions by Alternating Conditional Expectations",
    "version": "0.3.3",
    "project_urls": {
        "Homepage": "https://github.com/partofthething/ace"
    },
    "split_keywords": [
        "regression",
        "ace",
        "multivariate",
        "statistics"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "3adccba6c428710a97ce908e0aa4aa3b5f6cbb7c55dcfc999fb302726a8e3f1c",
                "md5": "1544a0c57452d04939f53ed18c79d206",
                "sha256": "21a5875ea75f4f00db8e103a630dc857b6f95363f4e802d369499ee5d2f89781"
            },
            "downloads": -1,
            "filename": "ace-0.3.3-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "1544a0c57452d04939f53ed18c79d206",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": null,
            "size": 23745,
            "upload_time": "2023-05-03T06:15:45",
            "upload_time_iso_8601": "2023-05-03T06:15:45.549100Z",
            "url": "https://files.pythonhosted.org/packages/3a/dc/cba6c428710a97ce908e0aa4aa3b5f6cbb7c55dcfc999fb302726a8e3f1c/ace-0.3.3-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "45e36ff5edf791d33896d49abf77fe505e7c69476220379a7883207483b4ee3c",
                "md5": "7c2b524b6136fd591af470f760e68ae0",
                "sha256": "16d554262f72daba2e4dde21182fea264e63411fd644c5be90eb6e461906df08"
            },
            "downloads": -1,
            "filename": "ace-0.3.3.tar.gz",
            "has_sig": false,
            "md5_digest": "7c2b524b6136fd591af470f760e68ae0",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": null,
            "size": 21606,
            "upload_time": "2023-05-03T06:15:47",
            "upload_time_iso_8601": "2023-05-03T06:15:47.968610Z",
            "url": "https://files.pythonhosted.org/packages/45/e3/6ff5edf791d33896d49abf77fe505e7c69476220379a7883207483b4ee3c/ace-0.3.3.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2023-05-03 06:15:47",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "partofthething",
    "github_project": "ace",
    "travis_ci": true,
    "coveralls": false,
    "github_actions": false,
    "requirements": [],
    "tox": true,
    "lcname": "ace"
}
        
Elapsed time: 0.06113s