pylops.Regression

class pylops.Regression(taxis, order, dtype='float64')[source]

Polynomial regression.

Creates an operator that applies polynomial regression to a set of points. Values along the t-axis must be provided while initializing the operator. The coefficients of the polynomial regression form the model vector to be provided in forward mode, while the values of the regression curve shall be provided in adjoint mode.

Parameters:
taxis : numpy.ndarray

Elements along the t-axis.

order : int

Order of the regressed polynomial.

dtype : str, optional

Type of elements in input array.

Raises:
TypeError

If t is not numpy.ndarray.

See also

LinearRegression
Linear regression

Notes

The Regression operator solves the following problem:

\[y_i = \sum_{n=0}^{order} x_n t_i^n \qquad \forall i=1,2,...,N\]

where \(N\) represents the order of the chosen polynomial. We can express this problem in a matrix form

\[\mathbf{y}= \mathbf{A} \mathbf{x}\]

where

\[\mathbf{y}= [y_1, y_2,...,y_N]^T, \qquad \mathbf{x}= [x_0, x_1,...,x_{order}]^T\]

and

\[\begin{split}\mathbf{A} = \begin{bmatrix} 1 & t_{1} & t_{1}^2 & .. & t_{1}^{order} \\ 1 & t_{2} & t_{2}^2 & .. & t_{1}^{order} \\ .. & .. & .. & .. & .. \\ 1 & t_{N} & t_{N}^2 & .. & t_{N}^{order} \\ \end{bmatrix}\end{split}\]
Attributes:
shape : tuple

Operator shape

explicit : bool

Operator contains a matrix that can be solved explicitly (True) or not (False)

Methods

__init__(self, taxis, order[, dtype]) Initialize this LinearOperator.
adjoint(self) Hermitian adjoint.
apply(self, t, x) Return values along y-axis given certain t location(s) along t-axis and regression coefficients x
cond(self, \*\*kwargs_eig) Condition number of linear operator.
conj(self) Complex conjugate operator
div(self, y[, niter]) Solve the linear problem \(\mathbf{y}=\mathbf{A}\mathbf{x}\).
dot(self, x) Matrix-matrix or matrix-vector multiplication.
eigs(self[, neigs, symmetric, niter]) Most significant eigenvalues of linear operator.
matmat(self, X) Matrix-matrix multiplication.
matvec(self, x) Matrix-vector multiplication.
rmatvec(self, x) Adjoint matrix-vector multiplication.
transpose(self) Transpose this linear operator.
apply(self, t, x)[source]

Return values along y-axis given certain t location(s) along t-axis and regression coefficients x

Parameters:
taxis : numpy.ndarray

Elements along the t-axis.

x : numpy.ndarray

Regression coefficients

dtype : str, optional
Returns
———-
y : numpy.ndarray

Values along y-axis

Examples using pylops.Regression