Skip to content
Snippets Groups Projects
Commit 964e86b8 authored by MoritzThomasHuebner's avatar MoritzThomasHuebner
Browse files

Refactored code some more in GaussianLikelihood

parent 2be27fac
No related branches found
No related tags found
1 merge request!152Simplifies some of the analytic 1D likelihoods
......@@ -118,14 +118,14 @@ class GaussianLikelihood(Analytical1DLikelihood):
# that if sigma is not in parameters the attribute is used which was
# given at init (i.e. the known sigma as either a float or array).
sigma = self.parameters.get('sigma', self.sigma)
res = self.__calculate_residual()
return self.summed_log_likelihood(res, sigma)
residual = self.__calculate_residual()
return self.__summed_log_likelihood(residual=residual, sigma=sigma)
def __calculate_residual(self):
return self.y - self.func(self.x, **self.model_parameters)
def summed_log_likelihood(self, res, sigma):
return -0.5 * (np.sum((res / sigma) ** 2)
def __summed_log_likelihood(self, residual, sigma):
return -0.5 * (np.sum((residual / sigma) ** 2)
+ self.n * np.log(2 * np.pi * sigma ** 2))
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment