pylops.Regression#
- class pylops.Regression(taxis, order, dtype='float64', name='R')[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.
- name
str
, optional New in version 2.0.0.
Name of operator (to be used by
pylops.utils.describe.describe
)
- taxis
- Raises
- TypeError
If
taxis
is notnumpy.ndarray
.
See also
LinearRegression
Linear regression
Notes
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}\]where
\[\mathbf{y}= [y_0, y_1,\ldots,y_{N-1}]^T, \qquad \mathbf{x}= [x_0, x_1,\ldots,x_\text{order}]^T\]and
\[\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}\]- Attributes
- shape
tuple
Operator shape
- explicit
bool
Operator contains a matrix that can be solved explicitly (
True
) or not (False
)
- shape
Methods
__init__
(taxis, order[, dtype, name])adjoint
()apply
(t, x)Return values along y-axis given certain
t
location(s) along t-axis and regression coefficientsx
apply_columns
(cols)Apply subset of columns of operator
cond
([uselobpcg])Condition number of linear operator.
conj
()Complex conjugate operator
div
(y[, niter, densesolver])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.
reset_count
()Reset counters
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
()