-
Notifications
You must be signed in to change notification settings - Fork 1
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Laplace approximation to posterior #20
Conversation
example/sfsi_toy_gaussian.py
Outdated
|
||
noise = prior.generate_parameter("noise") | ||
|
||
###################################################### |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
See comment above (multiple samples in the same file)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Modification made.
prior, | ||
d: np.array, | ||
U: MultiVector, | ||
createVecLeft=None, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also here:
createVecLeft
and createVecRight
are not needed
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Removed both.
if len(args) == 2: | ||
self._sample_given_prior(args[0], args[1]) | ||
if add_mean: | ||
temp_petsc_vec_arg1 = dlx.la.create_petsc_vector_wrap(args[1]) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
very confusing. Should it just be:
args[1].array[:] += self.mean.array
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This has been fixed here. Thanks for pointing this out:
hippylibx/hippylibX/modeling/laplaceApproximation.py
Lines 191 to 202 in b096580
if len(args) == 2: | |
self._sample_given_prior(args[0], args[1]) | |
if add_mean: | |
args[1].array[:] += self.mean.array | |
elif len(args) == 3: | |
self._sample_given_white_noise(args[0], args[1], args[2]) | |
if add_mean: | |
args[1].array[:] += self.prior.mean.array | |
args[2].array[:] += self.mean.array | |
else: | |
raise NameError("Invalid number of parameters in Posterior::sample") |
def createVecLeft(self) -> petsc4py.PETSc.Vec: | ||
return self.prior.R.createVecLeft() | ||
|
||
def sample(self, noise: dlx.la.Vector, s: dlx.la.Vector): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please rename as mult
.github/workflows/CI_testing.yml
Outdated
cd ./hippylibX/test && | ||
mpirun -n 2 python3 test_lowRankHessian.py | ||
|
||
- name: low rank Hessian precondtioner testing |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Spelling: preconditioner
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Spelling changed. Thanks for pointing it out.
Adding modeling/laplaceApproximation.py and algorithms/lowRankOperator.py