SlicedInverseRegression¶
- class SlicedInverseRegression(*args)¶
Sliced Inverse Regression algorithm.
Warning
This class is experimental and likely to be modified in future releases. To use it, import the
openturns.experimentalsubmodule.Sliced Inverse Regression (SIR, [li1991]) is a dimension reduction technique. It describes a low-dimensional linear subspace that captures all the necessary information a high-dimensional set of predictors holds about a response variable.
It assumes the following regression model:
where the response variable
is univariate, the regressor
is
-dimensional the vector
represents the EDR directions and
is independent of
.
The algorithm proceeds as follows:
Standardize the data: Transform the predictor variables X so they have a mean of zero and an identity covariance matrix.
Slice the response variable: Sort your data by the values of the response variable Y. Then, divide the sorted data into H distinct, equally sized intervals or “slices”.
Calculate slice means: Within each slice, compute the average of the standardized predictor variables X.
Apply Principal Component Analysis (PCA): Perform an eigen-decomposition or PCA on the covariance matrix of these sliced means.
Detailed steps consist in:
Sort the output
and divide it into
slices of equal size
Center the input sample:
Compute the QR decomposition of the centered input matrix:
Standardize
For each slice
, compute the weighted mean:
Compute the singular value decomposition of the slice-mean matrix:
The right singular vectors
(columns of
) are the eigenvectors of
with eigenvalues
Back-transform the eigenvectors to the original space:
Keep only the first
directions according to
Normalize the directions:
The transformation maps an input vector
to its coordinates in the EDR basis:
- Parameters:
- X
Sample Input sample
- Y
Sample Output, supervision sample
- sliceNumberint, optional
Number of slices, defaults to
ResourceMapentry SlicedInverseRegression-DefaultSliceNumber
- X
Methods
Accessor to the object's name.
getName()Accessor to the object's name.
Accessor to the number of EDR directions.
Accessor to the result.
Accessor to the number of slices.
hasName()Test if the object is named.
run()Run the algorithm.
setName(name)Accessor to the object's name.
setNbModes(nbModes)Accessor to the number of EDR directions.
setSliceNumber(sliceNumber)Accessor to the number of slices.
Examples
>>> import openturns as ot >>> import openturns.experimental as otexp >>> N = 100 >>> X = ot.Normal([0.0] * 2, [0.1] * 2).getSample(N) >>> X += [[i / (N - 1), 2 * i / (N - 1)] for i in range(N)] >>> # X is centered internally by the SIR algorithm >>> f = ot.SymbolicFunction(['x1', 'x2'], ['4*(x1+2*x2)+2']) >>> Y = f(X) + ot.Normal(0.0, 0.2).getSample(N) >>> algo = otexp.SlicedInverseRegression(X, Y) >>> algo.run() >>> transformation = algo.getResult().getTransformation()
- __init__(*args)¶
- getClassName()¶
Accessor to the object’s name.
- Returns:
- class_namestr
The object class name (object.__class__.__name__).
- getName()¶
Accessor to the object’s name.
- Returns:
- namestr
The name of the object.
- getNbModes()¶
Accessor to the number of EDR directions.
- Returns:
- nbModesint
Number of EDR directions retained.
- getResult()¶
Accessor to the result.
- Returns:
- result
SlicedInverseRegressionResult Result class
- result
- getSliceNumber()¶
Accessor to the number of slices.
- Returns:
- sliceNumberint
Number of slices
- hasName()¶
Test if the object is named.
- Returns:
- hasNamebool
True if the name is not empty.
- run()¶
Run the algorithm.
- setName(name)¶
Accessor to the object’s name.
- Parameters:
- namestr
The name of the object.
- setNbModes(nbModes)¶
Accessor to the number of EDR directions.
- Parameters:
- nbModesint
Number of EDR directions retained.
- setSliceNumber(sliceNumber)¶
Accessor to the number of slices.
- Parameters:
- sliceNumberint
Number of slices
OpenTURNS