A matrix of column vectors for use in linear regression.
The purpose of this class is to provide a convenient method to interact
with a set of one or more regressors which are known to correlate with
trends or systematic noise signals which we want to remove from a light
curve. Specifically, this class is designed to provide the design matrix
for use by Lightkurve’s RegressionCorrector class.
Columns to include in the design matrix. If this object is not a
DataFrame then it will be passed to the DataFrame constructor.
Column names, if not already provided via df.
Name of the matrix.
Prior means of the coefficients associated with each column in a linear
Prior standard deviations of the coefficients associated with each
column in a linear regression problem.
>>> from lightkurve.correctors.designmatrix import DesignMatrix, create_spline_matrix
>>> DesignMatrix(np.arange(100), name='slope')
slope DesignMatrix (100, 1)
>>> create_spline_matrix(np.arange(100), n_knots=5, name='spline')
spline DesignMatrix (100, 5)
Initialize self. See help(type(self)) for accurate signature.
__init__(df[, columns, name, prior_mu, …])
append_constant([prior_mu, prior_sigma, inplace])
Returns a new DesignMatrix with a column of ones appended.
Join two designmatrices, return a design matrix collection
Returns a deepcopy of DesignMatrix
Returns a new DesignMatrix with a smaller number of regressors.
Visualize the design matrix values as an image.
Visualize the coefficient priors.
Returns a new DesignMatrix with regressors split into multiple columns.
Returns a new DesignMatrix in which the columns have been median-subtracted and sigma-divided.
Convert this dense matrix object to a SparseDesignMatrix.
Emits LightkurveWarning if matrix has low rank or priors have incorrect shape.
Design matrix “X” to be used in RegressionCorrector objects
Matrix rank computed using numpy.linalg.matrix_rank.
Tuple specifying the shape of the matrix as (n_rows, n_columns).
2D numpy array containing the matrix values.