lamatrix.models.gaussian#
Model objects for Gaussian types of models
Classes
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
- class lamatrix.models.gaussian.Gaussian(x_name: str = 'x', sigma: float = 1.0, mu: float = 0.0, priors=None, posteriors=None)[source]#
Bases:
MathMixins
,LatexMixins
,IOMixins
,Model
- 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(**kwargs)[source]#
Build a 1D polynomial in
x_name
.- Returns:
X – Design matrix with shape (len(x), self.nvectors)
- Return type:
np.ndarray
- 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(data: ndarray[Any, dtype[_ScalarType_co]], errors: ndarray[Any, dtype[_ScalarType_co]] | None = None, mask: ndarray[Any, dtype[_ScalarType_co]] | None = None, **kwargs)#
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 posterior_amplitude#
- property prior_amplitude#
- 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.models.gaussian.Gaussian2D(x_name: str = 'x', y_name: str = 'y', priors=None, posteriors=None, sigma_x=1, sigma_y=1, mu_x=0, mu_y=0, rho=0.0)[source]#
Bases:
MathMixins
,Model
- 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(**kwargs)[source]#
Build a 1D polynomial in
x_name
.- Returns:
X – Design matrix with shape (len(x), self.nvectors)
- Return type:
np.ndarray
- 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(data: ndarray[Any, dtype[_ScalarType_co]], errors: ndarray[Any, dtype[_ScalarType_co]] | None = None, mask: ndarray[Any, dtype[_ScalarType_co]] | None = None, **kwargs)#
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 fit_amplitude#
- property nvectors#
Returns the number of vectors required to build the object.
- property prior_amplitude#
- sample(**kwargs)#
Given an input set of arguments, will evaluate the model with a sample of the best fit weights drawn from the posteriors.
- property width#
Returns the width of the design matrix once built.
- class lamatrix.models.gaussian.dGaussian(weights: List, x_name: str = 'x', sigma: float = 1.0, mu: float = 0.0, priors=None, posteriors=None)[source]#
Bases:
MathMixins
,Model
- 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(**kwargs)[source]#
Build a 1D polynomial in
x_name
.- Returns:
X – Design matrix with shape (len(x), self.nvectors)
- Return type:
np.ndarray
- 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(data: ndarray[Any, dtype[_ScalarType_co]], errors: ndarray[Any, dtype[_ScalarType_co]] | None = None, mask: ndarray[Any, dtype[_ScalarType_co]] | None = None, **kwargs)#
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 posterior_amplitude#
- property prior_amplitude#
- sample(**kwargs)#
Given an input set of arguments, will evaluate the model with a sample of the best fit weights drawn from the posteriors.
- property width#
Returns the width of the design matrix once built.
- class lamatrix.models.gaussian.dGaussian2D(weights: List, x_name: str = 'x', y_name: str = 'y', priors=None, posteriors=None, sigma_x=1, sigma_y=1, mu_x=0, mu_y=0, rho=0.5)[source]#
Bases:
MathMixins
,Model
- 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(**kwargs)[source]#
Build a 1D polynomial in
x_name
.- Returns:
X – Design matrix with shape (len(x), self.nvectors)
- Return type:
np.ndarray
- 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(data: ndarray[Any, dtype[_ScalarType_co]], errors: ndarray[Any, dtype[_ScalarType_co]] | None = None, mask: ndarray[Any, dtype[_ScalarType_co]] | None = None, **kwargs)#
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 fit_amplitude#
- property nvectors#
Returns the number of vectors required to build the object.
- property prior_amplitude#
- sample(**kwargs)#
Given an input set of arguments, will evaluate the model with a sample of the best fit weights drawn from the posteriors.
- property width#
Returns the width of the design matrix once built.
- class lamatrix.models.gaussian.dlnGaussian(mu: float, sigma: float, x_name: str = 'x', priors=None, posteriors=None)[source]#
Bases:
MathMixins
,Model
- 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(**kwargs)[source]#
- Parameters:
x (np.ndarray) – Vector to create ln Gaussian of
- Returns:
X – Design matrix with shape (len(x), 2)
- Return type:
np.ndarray
- 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(data: ndarray[Any, dtype[_ScalarType_co]], errors: ndarray[Any, dtype[_ScalarType_co]] | None = None, mask: ndarray[Any, dtype[_ScalarType_co]] | None = None, **kwargs)#
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.
- property width#
Returns the width of the design matrix once built.
- class lamatrix.models.gaussian.dlnGaussian2D(mu_x: float, sigma_x: float, mu_y: float, sigma_y: float, x_name: str = 'x', y_name: str = 'y', priors=None, posteriors=None)[source]#
Bases:
MathMixins
,Model
- 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(**kwargs)[source]#
- Parameters:
x (np.ndarray) – Vector to create ln Gaussian of
- Returns:
X – Design matrix with shape (len(x), 2)
- Return type:
np.ndarray
- 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(data: ndarray[Any, dtype[_ScalarType_co]], errors: ndarray[Any, dtype[_ScalarType_co]] | None = None, mask: ndarray[Any, dtype[_ScalarType_co]] | None = None, **kwargs)#
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.
- property width#
Returns the width of the design matrix once built.
- class lamatrix.models.gaussian.lnGaussian(x_name: str = 'x', priors=None, posteriors=None, prior_A=None, prior_mu=None, prior_sigma=None)[source]#
Bases:
MathMixins
,Model
- property A#
- 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(**kwargs)[source]#
- Parameters:
x (np.ndarray) – Vector to create ln Gaussian of
- Returns:
X – Design matrix with shape (len(x), 2)
- Return type:
np.ndarray
- 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(data: ndarray[Any, dtype[_ScalarType_co]], errors: ndarray[Any, dtype[_ScalarType_co]] | None = None, mask: ndarray[Any, dtype[_ScalarType_co]] | None = None, **kwargs)#
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 mu#
- 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.
- property sigma#
- property width#
Returns the width of the design matrix once built.
- class lamatrix.models.gaussian.lnGaussian2D(x_name: str = 'x', y_name: str = 'y', priors=None, posteriors=None, prior_A=None, prior_mu_x=None, prior_sigma_x=None, prior_mu_y=None, prior_sigma_y=None)[source]#
Bases:
MathMixins
,Model
- property A#
- 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(**kwargs)[source]#
- Parameters:
x (np.ndarray) – Vector to create ln Gaussian of
- Returns:
X – Design matrix with shape (len(x), 2)
- Return type:
np.ndarray
- 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(data: ndarray[Any, dtype[_ScalarType_co]], errors: ndarray[Any, dtype[_ScalarType_co]] | None = None, mask: ndarray[Any, dtype[_ScalarType_co]] | None = None, **kwargs)#
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 mu_x#
- property mu_y#
- 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.
- property sigma_x#
- property sigma_y#
- property width#
Returns the width of the design matrix once built.