Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
N
NIFTy
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
13
Issues
13
List
Boards
Labels
Service Desk
Milestones
Merge Requests
10
Merge Requests
10
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Incidents
Environments
Packages & Registries
Packages & Registries
Container Registry
Analytics
Analytics
CI / CD
Repository
Value Stream
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
ift
NIFTy
Commits
9b2959f7
Commit
9b2959f7
authored
Jun 18, 2018
by
Philipp Arras
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add poisson likelihood
parent
178ca953
Pipeline
#31247
passed with stages
in 1 minute and 27 seconds
Changes
2
Pipelines
1
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
45 additions
and
0 deletions
+45
-0
nifty4/library/__init__.py
nifty4/library/__init__.py
+1
-0
nifty4/library/poisson_log_likelihood.py
nifty4/library/poisson_log_likelihood.py
+44
-0
No files found.
nifty4/library/__init__.py
View file @
9b2959f7
...
...
@@ -5,5 +5,6 @@ from .nonlinear_wiener_filter_energy import NonlinearWienerFilterEnergy
from
.nonlinearities
import
Exponential
,
Linear
,
PositiveTanh
,
Tanh
from
.poisson_energy
import
PoissonEnergy
from
.unit_log_gauss
import
UnitLogGauss
from
.poisson_log_likelihood
import
PoissonLogLikelihood
from
.wiener_filter_curvature
import
WienerFilterCurvature
from
.wiener_filter_energy
import
WienerFilterEnergy
nifty4/library/poisson_log_likelihood.py
0 → 100644
View file @
9b2959f7
from
numpy
import
inf
,
isnan
from
..minimization
import
Energy
from
..operators
import
SandwichOperator
from
..sugar
import
log
,
makeOp
class
PoissonLogLikelihood
(
Energy
):
def
__init__
(
self
,
position
,
lamb
,
d
):
"""
s: Sky model object
value = 0.5 * s.vdot(s), i.e. a log-Gauss distribution with unit
covariance
"""
super
(
PoissonLogLikelihood
,
self
).
__init__
(
position
)
self
.
_lamb
=
lamb
.
at
(
position
)
self
.
_d
=
d
lamb_val
=
self
.
_lamb
.
value
self
.
_value
=
lamb_val
.
sum
()
-
d
.
vdot
(
log
(
lamb_val
))
if
isnan
(
self
.
_value
):
self
.
_value
=
inf
self
.
_gradient
=
self
.
_lamb
.
gradient
.
adjoint_times
(
1
-
d
/
lamb_val
)
# metric = makeOp(d/lamb_val/lamb_val)
metric
=
makeOp
(
1.
/
lamb_val
)
self
.
_curvature
=
SandwichOperator
.
make
(
self
.
_lamb
.
gradient
,
metric
)
def
at
(
self
,
position
):
return
self
.
__class__
(
position
,
self
.
_lamb
,
self
.
_d
)
@
property
def
value
(
self
):
return
self
.
_value
@
property
def
gradient
(
self
):
return
self
.
_gradient
@
property
def
curvature
(
self
):
return
self
.
_curvature
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment