Taweret.models namespace
Submodules
- class Taweret.models.coleman_models.coleman_model_1[source]
Bases:
BaseModel
- evaluate(input_values: array, model_param: array, full_corr=False) array [source]
Predict the mean and error for given input values
- Parameters
input_values (numpy 1darray) -- input parameter values
model_param (numpy 1darray) -- value of the model parameter
- log_likelihood_elementwise(x_exp, y_exp, y_err, model_param)[source]
Calculate log_likelihood for array of points given, and return with array with same shape[0]
- log_likelisnp.ndarray
an array of length as shape[0] of the input evaluation points
class MyModel(BaseModel): def log_likelihood_elementwise( self, y_exp, y_err, model_params ): # Assuming a normal distribution for error y = self.evaluate(model_params) # If y_exp, y_err, y are numpy arrays of same length return np.exp(-(y - y_exp) **2 / (2 * y_err ** 2)) \ / np.sqrt(2 * np.pi * y_err ** 2))
- property prior
- class Taweret.models.coleman_models.coleman_model_2[source]
Bases:
BaseModel
- evaluate(input_values: array, model_param: array, full_corr=False) array [source]
Predict the mean and error for given input values
- Parameters
input_values (numpy 1darray) -- input parameter values
model_param (numpy 1darray) -- value of the model parameter
- log_likelihood_elementwise(x_exp, y_exp, y_err, model_param)[source]
Calculate log_likelihood for array of points given, and return with array with same shape[0]
- log_likelisnp.ndarray
an array of length as shape[0] of the input evaluation points
class MyModel(BaseModel): def log_likelihood_elementwise( self, y_exp, y_err, model_params ): # Assuming a normal distribution for error y = self.evaluate(model_params) # If y_exp, y_err, y are numpy arrays of same length return np.exp(-(y - y_exp) **2 / (2 * y_err ** 2)) \ / np.sqrt(2 * np.pi * y_err ** 2))
- property prior
- class Taweret.models.coleman_models.coleman_truth[source]
Bases:
BaseModel
- evaluate(input_values: array) array [source]
Predict the mean and error for given input values
- Parameters
input_values (numpy 1darray) -- input parameter values
- log_likelihood_elementwise(x_exp, y_exp, y_err, model_param)[source]
Calculate log_likelihood for array of points given, and return with array with same shape[0]
- log_likelisnp.ndarray
an array of length as shape[0] of the input evaluation points
class MyModel(BaseModel): def log_likelihood_elementwise( self, y_exp, y_err, model_params ): # Assuming a normal distribution for error y = self.evaluate(model_params) # If y_exp, y_err, y are numpy arrays of same length return np.exp(-(y - y_exp) **2 / (2 * y_err ** 2)) \ / np.sqrt(2 * np.pi * y_err ** 2))
- class Taweret.models.polynomial_models.cos_exp(k, x0)[source]
Bases:
BaseModel
Cosine Taylor series expansion model class.
- Parameters
k (int) -- the degree of the expansion.
x0 (float) -- the center of the expansion.
- evaluate(x)[source]
Evaluate the Taylor series at a grid of x's. The standard deviation output is set to 1 by default.
- Parameters
x (np.ndarray) -- design matrix.
- Returns
mean and standard deviation of the model at the x grid points.
- Return type
np.ndarray, np.ndarray
- Return values
mean predictions.
- Return values
standard deviation of the predictions.
- class Taweret.models.polynomial_models.polynomal_model(a=0, b=0, c=1, p=1)[source]
Bases:
BaseModel
Polynomial models class. Used to define a function of the form
\[f(x) = c(x-a)^p + b\]- Parameters
a (float) -- center parameter.
b (float) -- shift parameter.
c (float) -- scale parameter.
p (float) -- power parameter.
- evaluate(x)[source]
Evaluate the polynomial at a grid of x's. The standard deviation output is set to 1 by default.
- Parameters
x (np.ndarray) -- design matrix.
- Returns
mean and standard deviation of the model at the x grid points.
- Return type
np.ndarray, np.ndarray
- Return values
mean predictions.
- Return values
standard deviation of the predictions.
- class Taweret.models.polynomial_models.sin_cos_exp(ks, kc, xs, xc)[source]
Bases:
BaseModel
Taylor series expansion of
\[f(x) = \sin(x_1) + \cos(x_2)\]- Parameters
ks (int) -- the degree of the sine expansion.
kc (int) -- the degree of the cosine expansion.
xs (float) -- the center of the sine expansion.
xc (float) -- the center of the cosine expansion.
- evaluate(x)[source]
Evaluate the model at a grid of x's. The standard deviation output is set to 1 by default.
- Parameters
x (np.ndarray) -- design matrix.
- Returns
mean and standard deviation of the model at the x grid points.
- Return type
np.ndarray, np.ndarray
- Return values
mean predictions.
- Return values
standard deviation of the predictions.
- class Taweret.models.polynomial_models.sin_exp(k, x0)[source]
Bases:
BaseModel
Sine Taylor series expansion model class.
- Parameters
k (int) -- the degree of the expansion.
x0 (float) -- the center of the expansion.
- evaluate(x)[source]
Evaluate the Taylor Series at a grid of x's. The standard deviation output is set to 1 by default.
- Parameters
x (np.ndarray) -- design matrix.
- Returns
mean and standard deviation of the model at the x grid points.
- Return type
np.ndarray, np.ndarray
- Return values
mean predictions.
- Return values
standard deviation of the predictions.
- class Taweret.models.samba_models.Data[source]
Bases:
BaseModel
- evaluate(input_values: array, error=0.01) array [source]
Evaluate the data and error for given input values
- input_valuesnumpy 1darray
coupling strength (g) values for data generation
- errorfloat
defines the relative error as a fraction between (0,1)
- datanumpy 1darray
The array of data points
- sigmanumpy 1darray
The errors on each data point
- class Taweret.models.samba_models.Highorder(order, error_model='informative')[source]
Bases:
BaseModel
The SAMBA highorder series expansion function.
- Parameters
order (int) -- Truncation order of expansion
error_model (str) -- Error calculation method. Either 'informative' or 'uninformative'
- Raises
TypeError -- If the order is not an integer
- evaluate(input_values: array) array [source]
Evaluate the mean and standard deviation for given input values
- Parameters
input_values (numpy 1darray) -- coupling strength (g) values
Returns --
-------- --
mean (numpy 1darray) -- The mean of the model
np.sqrt(var) (numpy 1darray) -- The truncation error of the model
- log_likelihood_elementwise(x_exp, y_exp, y_err, model_param)[source]
Calculate log_likelihood for array of points given, and return with array with same shape[0]
- log_likelisnp.ndarray
an array of length as shape[0] of the input evaluation points
class MyModel(BaseModel): def log_likelihood_elementwise( self, y_exp, y_err, model_params ): # Assuming a normal distribution for error y = self.evaluate(model_params) # If y_exp, y_err, y are numpy arrays of same length return np.exp(-(y - y_exp) **2 / (2 * y_err ** 2)) \ / np.sqrt(2 * np.pi * y_err ** 2))
- class Taweret.models.samba_models.Loworder(order, error_model='informative')[source]
Bases:
BaseModel
The SAMBA loworder series expansion function. This model has been previously calibrated.
- Parameters
order (int) -- Truncation order of expansion
error_model (str) -- Error calculation method. Either 'informative' or 'uninformative'
- Raises
TypeError -- If the order is not an integer
- evaluate(input_values: array) array [source]
Evaluate the mean and standard deviation for given input values to the function
- Parameters
input_values (numpy 1darray) -- coupling strength (g) values
Returns --
-------- --
mean (numpy 1darray) -- The mean of the model
np.sqrt(var) (numpy 1darray) -- The truncation error of the model
- log_likelihood_elementwise(x_exp, y_exp, y_err, model_param)[source]
Calculate log_likelihood for array of points given, and return with array with same shape[0]
- log_likelisnp.ndarray
an array of length as shape[0] of the input evaluation points
class MyModel(BaseModel): def log_likelihood_elementwise( self, y_exp, y_err, model_params ): # Assuming a normal distribution for error y = self.evaluate(model_params) # If y_exp, y_err, y are numpy arrays of same length return np.exp(-(y - y_exp) **2 / (2 * y_err ** 2)) \ / np.sqrt(2 * np.pi * y_err ** 2))
- class Taweret.models.samba_models.TrueModel[source]
Bases:
BaseModel
- evaluate(input_values: array) array [source]
Evaluate the mean of the true model for given input values.
- input_valuesnumpy 1darray
coupling strength (g) values
- meannumpy 1darray
The true model evaluated at each point of the given input space
- np.sqrt(var)numpy 1darray
The standard deviation of the true model. This will obviously be an array of zeros.
- log_likelihood_elementwise(x_exp, y_exp, y_err)[source]
Calculate log_likelihood for array of points given, and return with array with same shape[0]
- log_likelisnp.ndarray
an array of length as shape[0] of the input evaluation points
class MyModel(BaseModel): def log_likelihood_elementwise( self, y_exp, y_err, model_params ): # Assuming a normal distribution for error y = self.evaluate(model_params) # If y_exp, y_err, y are numpy arrays of same length return np.exp(-(y - y_exp) **2 / (2 * y_err ** 2)) \ / np.sqrt(2 * np.pi * y_err ** 2))