lamatrix.combine#
Classes and methods to combine models
Classes
|
Initialization function for all models. |
|
Initialization function for all models. |
- class lamatrix.combine.CrosstermModel(*args, posteriors=None)[source]#
Bases:
Model
,IOMixins
,LatexMixins
Initialization function for all models. All models must be provided with input priors and posteriors that match their width.
- property arg_names#
Returns a set of the user defined strings for all the arguments that the design matrix requires.
- copy()#
Returns a deep copy of
self
.
- design_matrix(*args, **kwargs)[source]#
Returns a design matrix, given inputs listed in self.arg_names.
- property equation#
Provides the equation for the model in latex.
If accessed within a jupyter instance will return the equation in displayed latex, otherwise will return the equation in raw latex.
- evaluate(**kwargs)#
Given an input set of arguments, will evaluate the model with the current best fit weights.
- fit(*args, **kwargs)[source]#
Fit the design matrix of this model object.
Executing this function will update the posteriors argument to the best fit posteriors.
- Parameters:
data (np.ndarray) – Input data to fit
errors (np.ndarray, optional) – Errors on the input data
mask (np.ndarray, optional) – Mask to apply when fitting. Values where mask is False will not be used during the fit.
- property nvectors#
Returns the number of vectors required to build the object.
- sample(**kwargs)#
Given an input set of arguments, will evaluate the model with a sample of the best fit weights drawn from the posteriors.
- to_latex()#
- property width#
Returns the width of the design matrix once built.
- class lamatrix.combine.JointModel(*args, posteriors=None)[source]#
Bases:
Model
,IOMixins
,LatexMixins
Initialization function for all models. All models must be provided with input priors and posteriors that match their width.
- property arg_names#
Returns a set of the user defined strings for all the arguments that the design matrix requires.
- copy()#
Returns a deep copy of
self
.
- design_matrix(*args, **kwargs)[source]#
Returns a design matrix, given inputs listed in self.arg_names.
- property equation#
Provides the equation for the model in latex.
If accessed within a jupyter instance will return the equation in displayed latex, otherwise will return the equation in raw latex.
- evaluate(**kwargs)#
Given an input set of arguments, will evaluate the model with the current best fit weights.
- fit(*args, **kwargs)[source]#
Fit the design matrix of this model object.
Executing this function will update the posteriors argument to the best fit posteriors.
- Parameters:
data (np.ndarray) – Input data to fit
errors (np.ndarray, optional) – Errors on the input data
mask (np.ndarray, optional) – Mask to apply when fitting. Values where mask is False will not be used during the fit.
- property nvectors#
Returns the number of vectors required to build the object.
- property priors#
- sample(**kwargs)#
Given an input set of arguments, will evaluate the model with a sample of the best fit weights drawn from the posteriors.
- to_latex()#
- property width#
Returns the width of the design matrix once built.