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()

Accessor to the object’s name.

getDirection()

Accessor to the direction.

getFormula()

Accessor to the formula.

getId()

Accessor to the object’s id.

getInputSample()

Accessor to the input sample.

getMaximumIterationNumber()

Accessor to the maximum iteration number.

getName()

Accessor to the object’s name.

getOutputSample()

Accessor to the output sample.

getPenalty()

Accessor to the penalty.

getResult()

Accessor to the result.

getShadowedId()

Accessor to the object’s shadowed id.

getVisibility()

Accessor to the object’s visibility state.

hasName()

Test if the object is named.

hasVisibleName()

Test if the object has a distinguishable name.

run()

Run the algorithm.

setName(name)

Accessor to the object’s name.

setShadowedId(id)

Accessor to the object’s shadowed id.

setVisibility(visible)

Accessor to the object’s visibility state.

__init__(*args)

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

getClassName()

Accessor to the object’s name.

Returns
class_namestr

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

getDirection()

Accessor to the direction.

Returns
directionint

Direction.

getFormula()

Accessor to the formula.

Returns
formulastr

Formula.

getId()

Accessor to the object’s id.

Returns
idint

Internal unique identifier.

getInputSample()

Accessor to the input sample.

Returns
input_sampleSample

Input sample.

getMaximumIterationNumber()

Accessor to the maximum iteration number.

Returns
maximum_iterationint

Maximum number of iterations.

getName()

Accessor to the object’s name.

Returns
namestr

The name of the object.

getOutputSample()

Accessor to the output sample.

Returns
output_sampleSample

Output sample.

getPenalty()

Accessor to the penalty.

Returns
penaltyfloat

Penalty.

getResult()

Accessor to the result.

Returns
resultLinearModelResult

The result.

getShadowedId()

Accessor to the object’s shadowed id.

Returns
idint

Internal unique identifier.

getVisibility()

Accessor to the object’s visibility state.

Returns
visiblebool

Visibility flag.

hasName()

Test if the object is named.

Returns
hasNamebool

True if the name is not empty.

hasVisibleName()

Test if the object has a distinguishable name.

Returns
hasVisibleNamebool

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

run()

Run the algorithm.

setName(name)

Accessor to the object’s name.

Parameters
namestr

The name of the object.

setShadowedId(id)

Accessor to the object’s shadowed id.

Parameters
idint

Internal unique identifier.

setVisibility(visible)

Accessor to the object’s visibility state.

Parameters
visiblebool

Visibility flag.