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.

taxis : numpy.ndarray

Elements along the \(t\)-axis.

order : int

Order of the regressed polynomial.

dtype : str, optional

Type of elements in input array.


If taxis is not numpy.ndarray.

See also

Linear regression


The Regression operator solves the following problem:

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

where \(N\) represents the number of points in taxis. We can express this problem in a matrix form

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


\[\mathbf{y}= [y_0, y_1,\ldots,y_{N-1}]^T, \qquad \mathbf{x}= [x_0, x_1,\ldots,x_\text{order}]^T\]


\[\begin{split}\mathbf{A} = \begin{bmatrix} 1 & t_{0} & t_{0}^2 & \ldots & t_{0}^\text{order} \\ 1 & t_{1} & t_{1}^2 & \ldots & t_{1}^\text{order} \\ \vdots & \vdots & \vdots & \ddots & \vdots \\ 1 & t_{N-1} & t_{N-1}^2 & \ldots & t_{N-1}^\text{order} \end{bmatrix}_{N\times \text{order}+1}\end{split}\]
shape : tuple

Operator shape

explicit : bool

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


__init__(taxis, order[, dtype]) Initialize this LinearOperator.
adjoint() Hermitian adjoint.
apply(t, x) Return values along y-axis given certain t location(s) along t-axis and regression coefficients x
apply_columns(cols) Apply subset of columns of operator
cond([uselobpcg]) Condition number of linear operator.
conj() Complex conjugate operator
div(y[, niter]) Solve the linear problem \(\mathbf{y}=\mathbf{A}\mathbf{x}\).
dot(x) Matrix-matrix or matrix-vector multiplication.
eigs([neigs, symmetric, niter, uselobpcg]) Most significant eigenvalues of linear operator.
matmat(X) Matrix-matrix multiplication.
matvec(x) Matrix-vector multiplication.
rmatmat(X) Matrix-matrix multiplication.
rmatvec(x) Adjoint matrix-vector multiplication.
todense([backend]) Return dense matrix.
toimag([forw, adj]) Imag operator
toreal([forw, adj]) Real operator
tosparse() Return sparse matrix.
trace([neval, method, backend]) Trace of linear operator.
transpose() Transpose this linear operator.
apply(t, x)[source]

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

taxis : numpy.ndarray

Elements along the t-axis.

x : numpy.ndarray

Regression coefficients

dtype : str, optional
y : numpy.ndarray

Values along y-axis

Examples using pylops.Regression