skutil.odr module

skutil.odr is a python port of R’s QR Decomposition backend (legacy Fortran subroutines)

class skutil.odr.QRDecomposition(X, pivot=1)[source]

Bases: sklearn.base.BaseEstimator

Performs the QR decomposition using LINPACK, BLAS and LAPACK Fortran subroutines, and provides an interface for other useful QR utility methods.

Parameters:

X : array_like, shape (n_samples, n_features)

The matrix to decompose

pivot : int, optional (default=1)

Whether to perform pivoting. 0 is False, any other value will be coerced to 1 (True).

Attributes:

qr : array_like, shape (n_samples, n_features)

The decomposed matrix

qraux : array_like, shape (n_features,)

Contains further information required to recover the orthogonal part of the decomposition.

pivot : array_like, shape (n_features,)

The pivots, if pivot was set to 1, else None

rank : int

The rank of the input matrix

Methods

get_R() Get the R matrix from the decomposition.
get_R_rank() Get the rank of the R matrix.
get_coef(X)
get_params([deep]) Get parameters for this estimator.
get_rank() Get the rank of the decomposition.
set_params(\*\*params) Set the parameters of this estimator.
get_R()[source]

Get the R matrix from the decomposition.

Returns:

r : np.ndarray

The R portion of the decomposed matrix.

get_R_rank()[source]

Get the rank of the R matrix.

Returns:

rank : int

The rank of the R matrix

get_coef(X)[source]
get_rank()[source]

Get the rank of the decomposition.

Returns:

self.rank : int

The rank of the decomposition

skutil.odr.qr_decomposition(X, job=1)[source]

Performs the QR decomposition using LINPACK, BLAS and LAPACK Fortran subroutines.

Parameters:

X : array_like, shape (n_samples, n_features)

The matrix to decompose

job : int, optional (default=1)

Whether to perform pivoting. 0 is False, any other value will be coerced to 1 (True).

Returns:

X : np.ndarray, shape=(n_samples, n_features)

The matrix

rank : int

The rank of the matrix

qraux : np.ndarray, shape=(n_features,)

Contains further information required to recover the orthogonal part of the decomposition.

pivot : np.ndarray, shape=(n_features,)

The pivot array, or None if not job