Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
N
NIFTy
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container registry
Model registry
Monitor
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
ift
NIFTy
Commits
9b2959f7
There was a problem fetching the pipeline summary.
Commit
9b2959f7
authored
6 years ago
by
Philipp Arras
Browse files
Options
Downloads
Patches
Plain Diff
Add poisson likelihood
parent
178ca953
Branches
Branches containing commit
Tags
Tags containing commit
1 merge request
!270
Add poisson likelihood
Pipeline
#
Changes
2
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
nifty4/library/__init__.py
+1
-0
1 addition, 0 deletions
nifty4/library/__init__.py
nifty4/library/poisson_log_likelihood.py
+44
-0
44 additions, 0 deletions
nifty4/library/poisson_log_likelihood.py
with
45 additions
and
0 deletions
nifty4/library/__init__.py
+
1
−
0
View file @
9b2959f7
...
@@ -5,5 +5,6 @@ from .nonlinear_wiener_filter_energy import NonlinearWienerFilterEnergy
...
@@ -5,5 +5,6 @@ from .nonlinear_wiener_filter_energy import NonlinearWienerFilterEnergy
from
.nonlinearities
import
Exponential
,
Linear
,
PositiveTanh
,
Tanh
from
.nonlinearities
import
Exponential
,
Linear
,
PositiveTanh
,
Tanh
from
.poisson_energy
import
PoissonEnergy
from
.poisson_energy
import
PoissonEnergy
from
.unit_log_gauss
import
UnitLogGauss
from
.unit_log_gauss
import
UnitLogGauss
from
.poisson_log_likelihood
import
PoissonLogLikelihood
from
.wiener_filter_curvature
import
WienerFilterCurvature
from
.wiener_filter_curvature
import
WienerFilterCurvature
from
.wiener_filter_energy
import
WienerFilterEnergy
from
.wiener_filter_energy
import
WienerFilterEnergy
This diff is collapsed.
Click to expand it.
nifty4/library/poisson_log_likelihood.py
0 → 100644
+
44
−
0
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
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment