ace.ace module

The Alternating Conditional Expectation (ACE) algorithm.

ACE was invented by L. Breiman and J. Friedman [Breiman85]. It is a powerful way to perform multidimensional regression without assuming any functional form of the model. Given a data set:

\(y = f(X)\)

where \(X\) is made up of a number of independent variables xi, ACE will tell you how \(y\) varies vs. each of the individual independents \(xi\). This can be used to:

  • Understand the relative shape and magnitude of y’s dependence on each xi

  • Produce a lightweight surrogate model of a more complex response

  • other stuff

class ace.ace.ACESolver(delrsq=0.01, maxit=20, nterm=3)[source]

Bases: object

The Alternating Conditional Expectation algorithm to perform regressions.

The iteration control follows Friedman’s mace.f rather than the simpler description in [Breiman85].

Parameters:
delrsqfloat, optional

Termination threshold. Iteration stops when R^2 changes by less than this over nterm consecutive outer iterations.

maxitint, optional

Maximum number of inner and of outer iterations.

ntermint, optional

Number of consecutive outer iterations considered for convergence.

specify_data_set(x_input, y_input)[source]

Define input to ACE.

Parameters:
x_inputlist

list of iterables, one for each independent variable

y_inputarray

the dependent observations

solve()[source]

Run the ACE calculational loop.

write_input_to_file(fname='ace_input.txt')[source]

Write y and x values used in this run to a space-delimited txt file.

write_transforms_to_file(fname='ace_transforms.txt')[source]

Write y and x transforms used in this run to a space-delimited txt file.

ace.ace.sort_vector(data, indices_of_increasing)[source]

Permutate 1-d data using given indices.

ace.ace.unsort_vector(data, indices_of_increasing)[source]

Upermutate 1-D data that is sorted by indices_of_increasing.

ace.ace.plot_transforms(ace_model, fname='ace_transforms.png')[source]

Plot the transforms.

ace.ace.plot_input(ace_model, fname='ace_input.png')[source]

Plot the transforms.