inversion_ideas.LinearRegressor#
- class inversion_ideas.LinearRegressor(matrix, *, build_jacobian=True, cache=True)#
Linear regressor simulation.
Implements a linear regressor that generates data values as the product between its matrix and a given model vector.
Important
This class is included mainly as an example of a simple simulation class that could be created and used within the inversion framework.
- Parameters:
- matrix(
n_data,n_params)array Matrix used in the definition of the linear regressor.
- build_jacobianbool, optional
Whether the Jacobian matrix will be created as a dense matrix (True) or as a
LinearOperator(False). Default to True.- cachebool, optional
Whether to cache the results of the
__call__()method for the last model vector or not. Default to True.
- matrix(
Attributes
Methods
__call__(model)Evaluate simulation for a given model.
create_random(n_data, n_params, *[, seed])Create a linear regressor with a random matrix.
jacobian(model)Jacobian matrix for a given model.
Notes
Given the matrix \(\mathbf{X}\), the linear regressor simulation computes the data vector \(\mathbf{y}\) for a given model vector \(\mathbf{m}\) as follows:
\[\mathbf{y} = \mathbf{X} \cdot \mathbf{m}\]
Attributes#
- LinearRegressor.n_data#
- LinearRegressor.n_params#
Methods#
Methods documentation
- LinearRegressor.__call__(model)#
Evaluate simulation for a given model.
- classmethod LinearRegressor.create_random(n_data, n_params, *, seed=None, **kwargs)#
Create a linear regressor with a random matrix.
- Parameters:
- n_data
int Number of data values that the simulation will generate.
- n_params
int Number of elements in the model vector.
- seed
intorNone, optional Random seed or random state used to generate the matrix.
- **kwargs
Keyword arguents passed to the constructor of
LinearRegressor.
- n_data
- LinearRegressor.jacobian(model)#
Jacobian matrix for a given model.
- Parameters:
- Returns:
- (
n_data,n_params)arrayorLinearOperator Jacobian matrix as a dense or sparse array, or as a
LinearOperator.
- (