Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
T
tutorial_nifty_resolve
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
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
tutorial_nifty_resolve
Commits
72627e42
Commit
72627e42
authored
2 years ago
by
Philipp Frank
Browse files
Options
Downloads
Patches
Plain Diff
fixup
parent
873e5a29
No related branches found
No related tags found
No related merge requests found
Pipeline
#148620
passed
2 years ago
Stage: test
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
demo_poisson.ipynb
+1
-1
1 addition, 1 deletion
demo_poisson.ipynb
with
1 addition
and
1 deletion
demo_poisson.ipynb
+
1
−
1
View file @
72627e42
...
...
@@ -98,7 +98,7 @@
"outputs": [],
"source": [
"# Compare evidence\n",
"print(evidences)"
"print(evidences
[:2]
)"
]
},
{
...
...
%% Cell type:markdown id: tags:
Nifty tutorial for Poisson count data
=====================================
%% Cell type:markdown id: tags:
Setup
-----
%% Cell type:code id: tags:
```
python
import
numpy
as
np
import
matplotlib.pyplot
as
plt
import
nifty8
as
ift
from
utils
import
plot_2D
,
load_psf
,
geovi_sampling
,
plot_posterior
ift
.
random
.
push_sseq_from_seed
(
42
)
evidences
=
np
.
zeros
(
3
)
```
%% Cell type:code id: tags:
```
python
# Load data and visualize
data
=
np
.
load
(
'
data/poisson.npz
'
)
```
%% Cell type:code id: tags:
```
python
position_space
=
ift
.
RGSpace
([
128
,
128
])
# Homogeneous poisson process
print
(
model1
)
```
%% Cell type:code id: tags:
```
python
# Set up likelihood & PSF
```
%% Cell type:code id: tags:
```
python
# Inference model 1
print
(
evidence
)
evidences
[
0
]
=
evidence
```
%% Cell type:code id: tags:
```
python
# Independent poisson process
# Inference model 2
evidences
[
1
]
=
evidence
```
%% Cell type:code id: tags:
```
python
# Compare evidence
print
(
evidences
)
print
(
evidences
[:
2
]
)
```
%% Cell type:code id: tags:
```
python
# Diffuse poisson process
args
=
{
'
offset_mean
'
:
.
5
,
'
offset_std
'
:
(
1.
,
1E-5
),
# Amplitude of field fluctuations
'
fluctuations
'
:
(
1.5
,
0.5
),
# 1.0, 1e-2
# Exponent of power law power spectrum component
'
loglogavgslope
'
:
(
-
4.
,
1
),
# -6.0, 1
# Amplitude of integrated Wiener process power spectrum component
'
flexibility
'
:
(
1.
,
0.2
),
# 2.0, 1.0
# How ragged the integrated Wiener process component is
'
asperity
'
:
(
0.1
,
0.01
),
# 0.1, 0.5
# Name of the input keys
'
prefix
'
:
'
diffuse
'
}
correlated_field
=
ift
.
SimpleCorrelatedField
(
position_space
,
**
args
)
pspec
=
correlated_field
.
power_spectrum
```
%% Cell type:code id: tags:
```
python
# Prior samples
```
%% Cell type:code id: tags:
```
python
# Inference model 3
evidences
[
2
]
=
evidence
```
%% Cell type:code id: tags:
```
python
# Compare evidence
print
(
evidences
)
print
(
evidences
-
evidences
[
-
1
])
```
%% Cell type:markdown id: tags:
Posterior visualization
-----------------------
%% Cell type:code id: tags:
```
python
plot_posterior
(
samples
,
data
,
model3
,
diffuse
,
model2
,
pspec
)
```
...
...
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