ace 0.2__tar.gz → 0.3.3__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (35) hide show
  1. ace-0.3.3/LICENSE +21 -0
  2. ace-0.3.3/PKG-INFO +201 -0
  3. ace-0.3.3/README.rst +175 -0
  4. {ace-0.2 → ace-0.3.3}/ace/__init__.py +15 -15
  5. {ace-0.2 → ace-0.3.3}/ace/ace.py +51 -72
  6. {ace-0.2 → ace-0.3.3}/ace/model.py +42 -33
  7. ace-0.3.3/ace/samples/__init__.py +1 -0
  8. ace-0.3.3/ace/samples/breiman85.py +65 -0
  9. {ace-0.2 → ace-0.3.3}/ace/samples/smoother_friedman82.py +4 -12
  10. {ace-0.2 → ace-0.3.3}/ace/samples/supersmoother_friedman82.py +3 -7
  11. {ace-0.2 → ace-0.3.3}/ace/samples/wang04.py +4 -10
  12. {ace-0.2 → ace-0.3.3}/ace/smoother.py +58 -74
  13. {ace-0.2 → ace-0.3.3}/ace/supersmoother.py +25 -26
  14. ace-0.3.3/ace/tests/__init__.py +1 -0
  15. {ace-0.2 → ace-0.3.3}/ace/tests/test_ace.py +11 -2
  16. {ace-0.2 → ace-0.3.3}/ace/tests/test_model.py +14 -15
  17. {ace-0.2 → ace-0.3.3}/ace/tests/test_smoother.py +20 -29
  18. ace-0.3.3/ace/validation/__init__.py +1 -0
  19. {ace-0.2 → ace-0.3.3}/ace/validation/validate_smoothers.py +62 -55
  20. ace-0.3.3/ace.egg-info/PKG-INFO +201 -0
  21. {ace-0.2 → ace-0.3.3}/ace.egg-info/SOURCES.txt +2 -2
  22. ace-0.3.3/ace.egg-info/requires.txt +2 -0
  23. {ace-0.2 → ace-0.3.3}/setup.cfg +0 -1
  24. {ace-0.2 → ace-0.3.3}/setup.py +16 -12
  25. ace-0.2/PKG-INFO +0 -96
  26. ace-0.2/README.txt +0 -76
  27. ace-0.2/ace/samples/__init__.py +0 -3
  28. ace-0.2/ace/samples/breiman85.py +0 -37
  29. ace-0.2/ace/tests/__init__.py +0 -3
  30. ace-0.2/ace/validation/__init__.py +0 -0
  31. ace-0.2/ace/validation/run_supsmu.py +0 -37
  32. ace-0.2/ace.egg-info/PKG-INFO +0 -96
  33. ace-0.2/ace.egg-info/requires.txt +0 -2
  34. {ace-0.2 → ace-0.3.3}/ace.egg-info/dependency_links.txt +0 -0
  35. {ace-0.2 → ace-0.3.3}/ace.egg-info/top_level.txt +0 -0
ace-0.3.3/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2014 Nicholas W. Touran
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
ace-0.3.3/PKG-INFO ADDED
@@ -0,0 +1,201 @@
1
+ Metadata-Version: 2.1
2
+ Name: ace
3
+ Version: 0.3.3
4
+ Summary: Non-parametric multivariate regressions by Alternating Conditional Expectations
5
+ Home-page: https://github.com/partofthething/ace
6
+ Author: Nick Touran
7
+ Author-email: ace@partofthething.com
8
+ License: MIT
9
+ Keywords: regression ace multivariate statistics
10
+ Classifier: Development Status :: 3 - Alpha
11
+ Classifier: Intended Audience :: Science/Research
12
+ Classifier: Topic :: Scientific/Engineering :: Information Analysis
13
+ Classifier: License :: OSI Approved :: MIT License
14
+ Classifier: Programming Language :: Python :: 2
15
+ Classifier: Programming Language :: Python :: 2.7
16
+ Classifier: Programming Language :: Python :: 3
17
+ Classifier: Programming Language :: Python :: 3.4
18
+ Classifier: Programming Language :: Python :: 3.5
19
+ Classifier: Programming Language :: Python :: 3.6
20
+ Classifier: Programming Language :: Python :: 3.7
21
+ Classifier: Programming Language :: Python :: 3.8
22
+ Classifier: Programming Language :: Python :: 3.9
23
+ Classifier: Programming Language :: Python :: 3.10
24
+ Classifier: Programming Language :: Python :: 3.11
25
+ License-File: LICENSE
26
+
27
+ ===============
28
+ The ace Package
29
+ ===============
30
+
31
+ .. image:: https://travis-ci.org/partofthething/ace.svg?branch=develop
32
+ :target: https://travis-ci.org/partofthething/ace
33
+
34
+ ace is an implementation of the Alternating Conditional Expectation (ACE) algorithm [Breiman85]_,
35
+ which can be used to find otherwise difficult-to-find relationships between predictors
36
+ and responses and as a multivariate regression tool.
37
+
38
+ The code for this project, as well as the issue tracker, etc. is
39
+ `hosted on GitHub <https://github.com/partofthething/ace>`_.
40
+ The documentation is hosted at http://partofthething.com/ace.
41
+
42
+
43
+ What is it?
44
+ -----------
45
+ ACE can be used for a variety of purposes. With it, you can:
46
+
47
+ - build easy-to-evaluate surrogate models of data. For example, if you are optimizing input
48
+ parameters to a complex and long-running simulation, you can feed the results of a parameter
49
+ sweep into ACE to get a model that will instantly give you predictions of results of any
50
+ combination of input within the parameter range.
51
+
52
+ - expose interesting and meaningful relations between predictors and responses from complicated
53
+ data sets. For instance, if you have survey results from 1000 people and you and you want to
54
+ see how one answer is related to a bunch of others, ACE will help you.
55
+
56
+ The fascinating thing about ACE is that it is a *non-parametric* multivariate regression
57
+ tool. This means that it doesn't make any assumptions about the functional form of the data.
58
+ You may be used to fitting polynomials or lines to data. Well, ACE doesn't do that. It
59
+ uses an iteration with a variable-span scatterplot smoother (implementing local least
60
+ squares estimates) to figure out the structure of your data. As you'll see, that
61
+ turns out to be a powerful difference.
62
+
63
+ Installing it
64
+ -------------
65
+ ace is available in the `Python Package Index <https://pypi.python.org/pypi/ace/>`_,
66
+ and can be installed simply with the following.
67
+
68
+ On Linux::
69
+
70
+ sudo pip install ace
71
+
72
+ On Windows, use::
73
+
74
+ pip install ace
75
+
76
+ Directly from source::
77
+
78
+ git clone git@github.com:partofthething/ace.git
79
+ cd ace
80
+ python setup.py install
81
+
82
+ .. note::
83
+
84
+ If you don't have git, you can just download the source directly from
85
+ `here <https://github.com/partofthething/ace/archive/master.zip>`_.
86
+
87
+ You can verify that the installation completed successfully by running the automated test
88
+ suite in the install directory::
89
+
90
+ python -m unittest discover -bv
91
+
92
+ Using it
93
+ --------
94
+ To use, get some sample data:
95
+
96
+ .. code:: python
97
+
98
+ from ace.samples import wang04
99
+ x, y = wang04.build_sample_ace_problem_wang04(N=200)
100
+
101
+ and run:
102
+
103
+ .. code:: python
104
+
105
+ from ace import model
106
+ myace = model.Model()
107
+ myace.build_model_from_xy(x, y)
108
+ myace.eval([0.1, 0.2, 0.5, 0.3, 0.5])
109
+
110
+ For some plotting (matplotlib required), try:
111
+
112
+ .. code:: python
113
+
114
+ from ace import ace
115
+ ace.plot_transforms(myace.ace, fname = 'mytransforms.pdf')
116
+ myace.ace.write_transforms_to_file(fname = 'mytransforms.txt')
117
+
118
+ Note that you could alternatively have loaded your data from a whitespace delimited
119
+ text file:
120
+
121
+ .. code:: python
122
+
123
+ myace.build_model_from_txt(fname = 'myinput.txt')
124
+
125
+ .. warning:: The more data points ACE is given as input, the better the results will be.
126
+ Be careful with less than 50 data points or so.
127
+
128
+ Demo
129
+ ----
130
+ A combination of various functions with noise is shown below:
131
+
132
+ .. have to use full path here to work in built docs and github-rendered README
133
+
134
+ .. image:: https://partofthething.com/ace/_static/ace_input_wang04.png
135
+ :alt: Plot of the input data, which is all over the place
136
+
137
+ Given just those points and zero knowledge of the underlying functions, ACE comes back
138
+ with this:
139
+
140
+ .. image:: https://partofthething.com/ace/_static/ace_transforms_wang04.png
141
+ :alt: Plot of the output transforms, which clearly show the underlying structure
142
+
143
+
144
+ A longer version of this demo is available in the
145
+ `Sample ACE Problems <http://partofthething.com/ace/samples.html>`_ section.
146
+
147
+ Other details
148
+ -------------
149
+ This implementation of ACE isn't as fast as the original FORTRAN version, but it can
150
+ still crunch through a problem with 5 independent variables having 1000 observations each
151
+ in on the order of 15 seconds. Not bad.
152
+
153
+ ace also contains a pure-Python implementation of Friedman's SuperSmoother [Friedman82]_,
154
+ the variable-span smoother mentioned above. This can be useful on its own
155
+ for smoothing scatterplot data.
156
+
157
+ History
158
+ -------
159
+ The ACE algorithm was published in 1985 by Breiman and Friedman [Breiman85]_, and the original
160
+ FORTRAN source code is available from `Friedman's webpage <http://statweb.stanford.edu/~jhf/>`_.
161
+
162
+ Motivation
163
+ ----------
164
+ Before this package, the ACE algorithm has only been available in Python by using the rpy2 module
165
+ to load in the acepack package of the R statistical language. This package is a pure-Python
166
+ re-write of the ACE algorithm based on the original publication, using modern software practices.
167
+ This package is slower than the original FORTRAN code, but it is easier to understand. This package
168
+ should be suitable for medium-weight data and as a learning tool.
169
+
170
+ For the record, it is also quite easy to run the original FORTRAN code in Python using f2py.
171
+
172
+ About the Author
173
+ ----------------
174
+ This package was originated by Nick Touran, a nuclear engineer specializing in reactor physics.
175
+ He was exposed to ACE by his thesis advisor, Professor John Lee, and used it in his
176
+ Ph.D. dissertation to evaluate objective functions in a multidisciplinary
177
+ design optimization study of nuclear reactor cores [Touran12]_.
178
+
179
+ License
180
+ -------
181
+ This package is released under the MIT License, `reproduced
182
+ here <https://github.com/partofthething/ace/blob/master/LICENSE>`_.
183
+
184
+ References
185
+ ----------
186
+ .. [Breiman85] L. BREIMAN and J. H. FRIEDMAN, "Estimating optimal transformations for multiple regression and
187
+ correlation," Journal of the American Statistical Association, 80, 580 (1985).
188
+ `[Link1] <http://www.jstor.org/discover/10.2307/2288477?uid=2&uid=4&sid=21104902100507>`_
189
+
190
+ .. [Friedman82] J. H. FRIEDMAN and W. STUETZLE, "Smoothing of scatterplots," ORION-003, Stanford
191
+ University, (1982). `[Link2] <http://www.slac.stanford.edu/cgi-wrap/getdoc/slac-pub-3013.pdf>`_
192
+
193
+ .. [Wang04] D. WANG and M. MURPHY, "Estimating optimal transformations for multiple regression using the
194
+ ACE algorithm," Journal of Data Science, 2, 329 (2004).
195
+ `[Link3] <http://www.jds-online.com/files/JDS-156.pdf>`_
196
+
197
+ .. [Touran12] N. TOURAN, "A Modal Expansion Equilibrium Cycle Perturbation Method for
198
+ Optimizing High Burnup Fast Reactors," Ph.D. dissertation, Univ. of Michigan, (2012).
199
+ `[The Thesis] <http://deepblue.lib.umich.edu/bitstream/handle/2027.42/95981/ntouran_1.pdf?sequence=1>`_
200
+
201
+
ace-0.3.3/README.rst ADDED
@@ -0,0 +1,175 @@
1
+ ===============
2
+ The ace Package
3
+ ===============
4
+
5
+ .. image:: https://travis-ci.org/partofthething/ace.svg?branch=develop
6
+ :target: https://travis-ci.org/partofthething/ace
7
+
8
+ ace is an implementation of the Alternating Conditional Expectation (ACE) algorithm [Breiman85]_,
9
+ which can be used to find otherwise difficult-to-find relationships between predictors
10
+ and responses and as a multivariate regression tool.
11
+
12
+ The code for this project, as well as the issue tracker, etc. is
13
+ `hosted on GitHub <https://github.com/partofthething/ace>`_.
14
+ The documentation is hosted at http://partofthething.com/ace.
15
+
16
+
17
+ What is it?
18
+ -----------
19
+ ACE can be used for a variety of purposes. With it, you can:
20
+
21
+ - build easy-to-evaluate surrogate models of data. For example, if you are optimizing input
22
+ parameters to a complex and long-running simulation, you can feed the results of a parameter
23
+ sweep into ACE to get a model that will instantly give you predictions of results of any
24
+ combination of input within the parameter range.
25
+
26
+ - expose interesting and meaningful relations between predictors and responses from complicated
27
+ data sets. For instance, if you have survey results from 1000 people and you and you want to
28
+ see how one answer is related to a bunch of others, ACE will help you.
29
+
30
+ The fascinating thing about ACE is that it is a *non-parametric* multivariate regression
31
+ tool. This means that it doesn't make any assumptions about the functional form of the data.
32
+ You may be used to fitting polynomials or lines to data. Well, ACE doesn't do that. It
33
+ uses an iteration with a variable-span scatterplot smoother (implementing local least
34
+ squares estimates) to figure out the structure of your data. As you'll see, that
35
+ turns out to be a powerful difference.
36
+
37
+ Installing it
38
+ -------------
39
+ ace is available in the `Python Package Index <https://pypi.python.org/pypi/ace/>`_,
40
+ and can be installed simply with the following.
41
+
42
+ On Linux::
43
+
44
+ sudo pip install ace
45
+
46
+ On Windows, use::
47
+
48
+ pip install ace
49
+
50
+ Directly from source::
51
+
52
+ git clone git@github.com:partofthething/ace.git
53
+ cd ace
54
+ python setup.py install
55
+
56
+ .. note::
57
+
58
+ If you don't have git, you can just download the source directly from
59
+ `here <https://github.com/partofthething/ace/archive/master.zip>`_.
60
+
61
+ You can verify that the installation completed successfully by running the automated test
62
+ suite in the install directory::
63
+
64
+ python -m unittest discover -bv
65
+
66
+ Using it
67
+ --------
68
+ To use, get some sample data:
69
+
70
+ .. code:: python
71
+
72
+ from ace.samples import wang04
73
+ x, y = wang04.build_sample_ace_problem_wang04(N=200)
74
+
75
+ and run:
76
+
77
+ .. code:: python
78
+
79
+ from ace import model
80
+ myace = model.Model()
81
+ myace.build_model_from_xy(x, y)
82
+ myace.eval([0.1, 0.2, 0.5, 0.3, 0.5])
83
+
84
+ For some plotting (matplotlib required), try:
85
+
86
+ .. code:: python
87
+
88
+ from ace import ace
89
+ ace.plot_transforms(myace.ace, fname = 'mytransforms.pdf')
90
+ myace.ace.write_transforms_to_file(fname = 'mytransforms.txt')
91
+
92
+ Note that you could alternatively have loaded your data from a whitespace delimited
93
+ text file:
94
+
95
+ .. code:: python
96
+
97
+ myace.build_model_from_txt(fname = 'myinput.txt')
98
+
99
+ .. warning:: The more data points ACE is given as input, the better the results will be.
100
+ Be careful with less than 50 data points or so.
101
+
102
+ Demo
103
+ ----
104
+ A combination of various functions with noise is shown below:
105
+
106
+ .. have to use full path here to work in built docs and github-rendered README
107
+
108
+ .. image:: https://partofthething.com/ace/_static/ace_input_wang04.png
109
+ :alt: Plot of the input data, which is all over the place
110
+
111
+ Given just those points and zero knowledge of the underlying functions, ACE comes back
112
+ with this:
113
+
114
+ .. image:: https://partofthething.com/ace/_static/ace_transforms_wang04.png
115
+ :alt: Plot of the output transforms, which clearly show the underlying structure
116
+
117
+
118
+ A longer version of this demo is available in the
119
+ `Sample ACE Problems <http://partofthething.com/ace/samples.html>`_ section.
120
+
121
+ Other details
122
+ -------------
123
+ This implementation of ACE isn't as fast as the original FORTRAN version, but it can
124
+ still crunch through a problem with 5 independent variables having 1000 observations each
125
+ in on the order of 15 seconds. Not bad.
126
+
127
+ ace also contains a pure-Python implementation of Friedman's SuperSmoother [Friedman82]_,
128
+ the variable-span smoother mentioned above. This can be useful on its own
129
+ for smoothing scatterplot data.
130
+
131
+ History
132
+ -------
133
+ The ACE algorithm was published in 1985 by Breiman and Friedman [Breiman85]_, and the original
134
+ FORTRAN source code is available from `Friedman's webpage <http://statweb.stanford.edu/~jhf/>`_.
135
+
136
+ Motivation
137
+ ----------
138
+ Before this package, the ACE algorithm has only been available in Python by using the rpy2 module
139
+ to load in the acepack package of the R statistical language. This package is a pure-Python
140
+ re-write of the ACE algorithm based on the original publication, using modern software practices.
141
+ This package is slower than the original FORTRAN code, but it is easier to understand. This package
142
+ should be suitable for medium-weight data and as a learning tool.
143
+
144
+ For the record, it is also quite easy to run the original FORTRAN code in Python using f2py.
145
+
146
+ About the Author
147
+ ----------------
148
+ This package was originated by Nick Touran, a nuclear engineer specializing in reactor physics.
149
+ He was exposed to ACE by his thesis advisor, Professor John Lee, and used it in his
150
+ Ph.D. dissertation to evaluate objective functions in a multidisciplinary
151
+ design optimization study of nuclear reactor cores [Touran12]_.
152
+
153
+ License
154
+ -------
155
+ This package is released under the MIT License, `reproduced
156
+ here <https://github.com/partofthething/ace/blob/master/LICENSE>`_.
157
+
158
+ References
159
+ ----------
160
+ .. [Breiman85] L. BREIMAN and J. H. FRIEDMAN, "Estimating optimal transformations for multiple regression and
161
+ correlation," Journal of the American Statistical Association, 80, 580 (1985).
162
+ `[Link1] <http://www.jstor.org/discover/10.2307/2288477?uid=2&uid=4&sid=21104902100507>`_
163
+
164
+ .. [Friedman82] J. H. FRIEDMAN and W. STUETZLE, "Smoothing of scatterplots," ORION-003, Stanford
165
+ University, (1982). `[Link2] <http://www.slac.stanford.edu/cgi-wrap/getdoc/slac-pub-3013.pdf>`_
166
+
167
+ .. [Wang04] D. WANG and M. MURPHY, "Estimating optimal transformations for multiple regression using the
168
+ ACE algorithm," Journal of Data Science, 2, 329 (2004).
169
+ `[Link3] <http://www.jds-online.com/files/JDS-156.pdf>`_
170
+
171
+ .. [Touran12] N. TOURAN, "A Modal Expansion Equilibrium Cycle Perturbation Method for
172
+ Optimizing High Burnup Fast Reactors," Ph.D. dissertation, Univ. of Michigan, (2012).
173
+ `[The Thesis] <http://deepblue.lib.umich.edu/bitstream/handle/2027.42/95981/ntouran_1.pdf?sequence=1>`_
174
+
175
+
@@ -1,5 +1,5 @@
1
1
  """
2
- ace is a multivariate regression tool that solves alternating conditional expectations
2
+ ace is a multivariate regression tool that solves alternating conditional expectations.
3
3
 
4
4
  See full documentation at http://partofthething.com/ace
5
5
 
@@ -22,31 +22,31 @@ For some plotting (matplotlib required), try::
22
22
  myace.ace.write_transforms_to_file(fname = 'mytransforms.txt')
23
23
 
24
24
  """
25
+
26
+ import os.path
27
+ from pkg_resources import get_distribution, DistributionNotFound
28
+
25
29
  def _get_version():
26
- from pkg_resources import get_distribution, DistributionNotFound
27
- import os.path
30
+ """
31
+ Groan single sourcing versions is a huge pain.
32
+
33
+ For now we have to manually sync it between here and setup.py (for doc build)
34
+
35
+ https://packaging.python.org/guides/single-sourcing-package-version/
36
+ """
28
37
  try:
29
38
  _dist = get_distribution('ace')
30
39
  # Normalize case for Windows systems
31
- _dist_loc = os.path.normcase(_dist.location)
40
+ _dist_loc = os.path.normcase(_dist.location) # pylint: disable=no-member
32
41
  _here = os.path.normcase(__file__)
33
42
  if not _here.startswith(os.path.join(_dist_loc, 'ace')):
34
43
  # not installed, but there is another version that *is*
35
44
  raise DistributionNotFound
36
45
  except DistributionNotFound:
37
- version = 'Please install ace with setup.py'
46
+ version = '0.3.2'
38
47
  else:
39
- version = _dist.version
48
+ version = _dist.version # pylint: disable=no-member
40
49
 
41
50
  return version
42
51
 
43
52
  __version__ = _get_version()
44
-
45
- from . import ace
46
- from . import model
47
- from . import smoother
48
- from . import supersmoother
49
- from . import samples
50
- from . import tests
51
-
52
-