LinearModelStepwiseAlgorithm

class LinearModelStepwiseAlgorithm(*args)

Stepwise linear model algorithm.

Available usages:

LinearModelStepwiseAlgorithm(inputSample, basis, outputSample, minimalIndices, isForward, penalty, maximumIterationNumber)

LinearModelStepwiseAlgorithm(inputSample, basis, outputSample, minimalIndices, startIndices, penalty, maximumIterationNumber)

Parameters
inputSample, outputSample2-d sequence of float

The input and output samples of a model.

basisBasis

Functional basis to estimate the trend.

minimalIndicessequence of int

The indices of minimal model

isForwardbool

the boolean value used for the stepwise regression method direction FORWARD and BACKWARD.

startIndicessequence of int

The indices of start model used for the stepwise regression method direction BOTH.

penaltyfloat

The multiple of the degrees of freedom used for the penalty of the stepwise regression method:

  • 2 Akaike information criterion (AIC)

  • log(n) Bayesian information criterion (BIC)

maximumIterationNumberint

The maximum number of iterations of the stepwise regression method.

Notes

The objective is to select the best linear regression model by using the stepwise method. Starting from the basis and minimalIndices, the stepwise strategy consists in adding basis elements (if isForward is True), dropping some (if isForward is False) or adding and dropping (both strategy) some elements. At each step, we get a model. We compute the corresponding penalty (BIC or AIC) and we continue repeatedly this process until the penalty could not be improved or the maximum iterations number is reached. Finally we get a regression model between the scalar variable Y and the n-dimensional one \vect{X} = (X_i)_{i \leq n} writes as follows:

\tilde{Y} = a_0 + \sum_{i \in I} a_i \phi_i(X) + \epsilon

where \epsilon is the residual, supposed to follow the standard Normal distribution, \phi_i the i-th element of the basis.

Methods

getClassName(self)

Accessor to the object’s name.

getDirection(self)

Accessor to the direction.

getFormula(self)

Accessor to the formula.

getId(self)

Accessor to the object’s id.

getInputSample(self)

Accessor to the input sample.

getMaximumIterationNumber(self)

Accessor to the maximum iteration number.

getName(self)

Accessor to the object’s name.

getOutputSample(self)

Accessor to the output sample.

getPenalty(self)

Accessor to the penalty.

getResult(self)

Accessor to the result.

getShadowedId(self)

Accessor to the object’s shadowed id.

getVisibility(self)

Accessor to the object’s visibility state.

hasName(self)

Test if the object is named.

hasVisibleName(self)

Test if the object has a distinguishable name.

run(self)

Run the algorithm.

setName(self, name)

Accessor to the object’s name.

setShadowedId(self, id)

Accessor to the object’s shadowed id.

setVisibility(self, visible)

Accessor to the object’s visibility state.

__init__(self, \*args)

Initialize self. See help(type(self)) for accurate signature.

getClassName(self)

Accessor to the object’s name.

Returns
class_namestr

The object class name (object.__class__.__name__).

getDirection(self)

Accessor to the direction.

Returns
directionint

Direction.

getFormula(self)

Accessor to the formula.

Returns
formulastr

Formula.

getId(self)

Accessor to the object’s id.

Returns
idint

Internal unique identifier.

getInputSample(self)

Accessor to the input sample.

Returns
input_sampleSample

Input sample.

getMaximumIterationNumber(self)

Accessor to the maximum iteration number.

Returns
maximum_iterationint

Maximum number of iterations.

getName(self)

Accessor to the object’s name.

Returns
namestr

The name of the object.

getOutputSample(self)

Accessor to the output sample.

Returns
output_sampleSample

Output sample.

getPenalty(self)

Accessor to the penalty.

Returns
penaltyfloat

Penalty.

getResult(self)

Accessor to the result.

Returns
resultLinearModelResult

The result.

getShadowedId(self)

Accessor to the object’s shadowed id.

Returns
idint

Internal unique identifier.

getVisibility(self)

Accessor to the object’s visibility state.

Returns
visiblebool

Visibility flag.

hasName(self)

Test if the object is named.

Returns
hasNamebool

True if the name is not empty.

hasVisibleName(self)

Test if the object has a distinguishable name.

Returns
hasVisibleNamebool

True if the name is not empty and not the default one.

run(self)

Run the algorithm.

setName(self, name)

Accessor to the object’s name.

Parameters
namestr

The name of the object.

setShadowedId(self, id)

Accessor to the object’s shadowed id.

Parameters
idint

Internal unique identifier.

setVisibility(self, visible)

Accessor to the object’s visibility state.

Parameters
visiblebool

Visibility flag.