Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
ift
NIFTy
Commits
0f7d01b4
Commit
0f7d01b4
authored
Jun 12, 2020
by
Reimar Leike
Browse files
reduce variance of poisson test
parent
245e8528
Pipeline
#76504
passed with stages
in 12 minutes and 14 seconds
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
test/test_operators/test_fisher_metric.py
View file @
0f7d01b4
...
...
@@ -29,7 +29,7 @@ pmp = pytest.mark.parametrize
field
=
list2fixture
([
ift
.
from_random
(
sp
,
'normal'
)
for
sp
in
spaces
]
+
[
ift
.
from_random
(
sp
,
'normal'
,
dtype
=
np
.
complex128
)
for
sp
in
spaces
])
Nsamp
=
1
000
Nsamp
=
2
000
def
_to_array
(
d
):
if
isinstance
(
d
,
np
.
ndarray
):
...
...
@@ -52,7 +52,7 @@ def energy_tester(pos, get_noisy_data, energy_initializer):
energy
=
energy_initializer
(
data
)
lin
=
ift
.
Linearization
.
make_var
(
pos
,
want_metric
=
True
)
res2
=
_to_array
(
energy
(
lin
).
metric
(
test_vec
).
val
)
np
.
testing
.
assert_allclose
(
res
/
std
,
res2
/
std
,
atol
=
5
)
np
.
testing
.
assert_allclose
(
res
/
std
,
res2
/
std
,
atol
=
6
)
def
test_GaussianEnergy
(
field
):
dtype
=
field
.
dtype
...
...
@@ -71,7 +71,7 @@ def test_PoissonEnergy(field):
return
def
get_noisy_data
(
mean
):
return
ift
.
makeField
(
mean
.
domain
,
np
.
random
.
poisson
(
mean
.
val
))
lam
=
field
**
2
# make rate positive
lam
=
5
*
field
**
2
# make rate positive
E_init
=
lambda
mean
:
ift
.
PoissonianEnergy
(
mean
)
energy_tester
(
lam
,
get_noisy_data
,
E_init
)
Write
Preview
Supports
Markdown
0%
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!
Cancel
Please
register
or
sign in
to comment