ade.history.Analysis(object)
class documentation
Part of ade.history
(View In Hierarchy)
I let you analyze the parameter values of a Population
.
Construct an instance of me with a sequence of parameter names, a 2-D Numpy array X of values (in columns) for the SSEs (first column) and then each of those parameters (remaining columns), and a sequence K of row indices. Or, to analyze values of all parameters, supply an empty list instead.
Each index in K points to a row of X with one SSE and the parameter values for that SSE, with the indices of K sorted in ascending order of the SSE they point to.
Instance Variable | names | A sequence of the names of all the parameters. |
Method | __init__ | Undocumented |
Method | corr | Returns the correlation coefficient between parameter values of column k1 and column k2 in my X array. |
Method | correlator | Iterates over combinations of parameters, from most correlated to least. Each iteration yields column indices of the parameter pair and their correlation coefficient. |
Method | Kf12 | Returns a 1-D Numpy array of row indices to my X array whose SSEs are from fractional value f1 to f2 between minimum and maximum SSE. |
Method | Kp12 | Returns a 1-D Numpy array of row indices to my X array whose SSEs are from fractional portion p1 to p2 between minimum and maximum SSE. |
Method | args2names | Converts args to a list of parameter names: |
Method | name2k | Returns the column index in my X array for the values of the
specified parameter name. The reverse of k2name . |
Method | k2name | Returns the parameter name for the the specified column index
k in my X array. The reverse of name2k . |
Method | value_vs_SSE | Returns a 1-D Numpy array of the SSEs of my individuals and matching 1-D Numpy arrays for each of the parameter values in names. |
Method | lineFit | Returns the slope and y-intercept of a line that has a best fit to the SSE-weighted data in column vectors of my X array at k1 (x) and k2 (y), with elements in K selected. |
Method | pick_N | Returns a sensible number of subplots to show in the next figure, given a supplied list kList of column indices of remaining parameters to show. |
Method | filePath | Obtains a unique filePath for a PNG file, or, with baseFilePath set, sets my fileSpec to a 6-list so that plotting is done to a PNG file at filePath. |
Method | makePlotter | Returns a Plotter object, constructed with the supplied
args and/or keywords, with some global options set. |
Method | plot | Plots values versus SSE for each parameter in names. Accepts
keywords used for value_vs_SSE
(only inPop is honored in this method), plus noShow,
semilog, and sp. |
Method | prettyLine | Undocumented |
Method | plotXY | Plots the values of parameter p1 versus the values of parameter p2, with a rough indication of the SSEs involved. |
Method | plotCorrelated | Plots values of N pairs of parameters with the highest correlation. The higher the SSE for a given combination of values, the less prominent the point will be in the plot. |
Method | _widthHeight | Given a string dims with W or WxL as an integer number of pixels (not inches) for the width or width x height, returns width and height in inches. |
Returns the correlation coefficient between parameter values of column k1 and column k2 in my X array.
TODO: Make SSE-weighted (lower=more weight).
Iterates over combinations of parameters, from most correlated to least. Each iteration yields column indices of the parameter pair and their correlation coefficient.
Only combinations where the first column index is lower than the second are yielded. This avoids duplication by limiting the iteration to the upper right triangle in a 2-D combination matrix where the first index is for rows and the second is for columns.
Returns a 1-D Numpy array of row indices to my X array whose SSEs are from fractional value f1 to f2 between minimum and maximum SSE.
Returns a 1-D Numpy array of row indices to my X array whose SSEs are from fractional portion p1 to p2 between minimum and maximum SSE.
The fractional portion is how far along the indices you are, not how far along the values you are. If the SSEs increased linearly, they would be the same.
Converts args to a list of parameter names:
- With no args, returns my full list of parameter names.
- With one or more strings, returns a list of the matching names.
- With integer arguments, creates a slice and returns that slice of the entries of my parameter names list.
Returns the column index in my X array for the values of the
specified parameter name. The reverse of k2name
.
Returns the parameter name for the the specified column index
k in my X array. The reverse of name2k
.
Returns a 1-D Numpy array of the SSEs of my individuals and matching 1-D Numpy arrays for each of the parameter values in names.
Parameters | inPop | Set True to only include individuals in the population. |
notInPop | Set True to only include individuals who were once but no
longer are in the population. | |
neverInPop | Set True to only include individuals who were never in the
population. | |
maxRatio | Set this to specify a maximum ratio between an included individual's SSE and the best individual's SSE. |
Returns the slope and y-intercept of a line that has a best fit to the SSE-weighted data in column vectors of my X array at k1 (x) and k2 (y), with elements in K selected.
For the best (lowest SSE) pair, the weight is 1.0. If the worst SSE is many times larger, the worst pair's weight is approximately 2*SSE_best/SSE_worst.
Returns a sensible number of subplots to show in the next figure, given a supplied list kList of column indices of remaining parameters to show.
Favors 2x2 and 3x3 plots. Single-subplot figures have too much empty space and are visually confusing.
Given a string dims with W or WxL as an integer number of pixels (not inches) for the width or width x height, returns width and height in inches.
Obtains a unique filePath for a PNG file, or, with baseFilePath set, sets my fileSpec to a 6-list so that plotting is done to a PNG file at filePath.
The 6-list is: [directory, basename, extension, count, width,
height]
A numerical suffix gets appended to the base name (but not the extension) to all files after the first one generated, ensuring that each generated figure/PNG file is unique. Without the keyword baseFilePath set, the unique file path is returned from a previous setting, along with the desired width and height in inches.
Parameters | baseFilePath | Specify this to set my fileSpec. None is returned. |
dims | Set to a string with W or WxL as an integer number of pixels (not inches) for the width or width x height of the PNG file(s). |
Returns a Plotter
object, constructed with the supplied
args and/or keywords, with some global options set.
If I have a fileSpec set, I will write the plot to a PNG file instead of showing a plot window. There will be a uniquifying numerical suffix appended to the file's base name.
Parameters | dims | Set to a string with W or WxL as an integer number of pixels (not inches)
for the width or width x height of the PNG file(s). Or None
for default (screen size) dimensions. |
Plots values versus SSE for each parameter in names. Accepts
keywords used for value_vs_SSE
(only inPop is honored in this method), plus noShow,
semilog, and sp.
If there are two integer values in names, they are used to select a range of my names sequence. (Seldom used.)
Parameters | noShow | Set True to return the Plotter object from the
last Matplotlib Figure plotted instead of calling
showAll on it, thus allowing you to do so at your convenience. |
semilog | Set True to plot parameter values on a logarithmic scale. | |
sp | Set to an instance of yampex.Plotter in subplot context and I
will render each subplots using it, with automatic subplot advancement for
each parameter. It's up to you to make sure the Plotter object
got set up with subplots in the desired arrangement, and to call it in
context before calling this method. See the docstring for
yampex.Plotter.__call__ for details. |
Plots the values of parameter p1 versus the values of parameter p2, with a rough indication of the SSEs involved.
If p1 or p2 is an integer, the parameter values for that column of my X array are used instead.
Also plots a best-fit line determined by lineFit with the pairs having the best 50% of the SSEs.
Returns a 4-tuple with the x- and y-axis labels and the slope and y-intercept of the best-fit line.
Plots values of N pairs of parameters with the highest correlation. The higher the SSE for a given combination of values, the less prominent the point will be in the plot.
You can specify one parameter that must be included. Then the correlations checked are with everything else.
Seeing a very high correlation in one of these plots is an indication that you should somehow consolidate the correlated parameters or at least make them explicitly dependent on each other at the outset, so DE doesn't waste effort searching all the deserted fitness landscape outside the narrow ellipse of their correlated values.
Parameters | noShow | Set True to return the Plotter object from the
last Matplotlib Figure plotted instead of calling
showAll on it, thus allowing you to do so at your convenience. |