Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
Tiago Peixoto
graph-tool
Commits
d0fc4754
Commit
d0fc4754
authored
Jul 20, 2016
by
Tiago Peixoto
Browse files
test_inference_mcmc: Simplify statistics
parent
9566e946
Pipeline
#206
failed with stage
in 4651 minutes and 40 seconds
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
doc/test_inference_mcmc.py
View file @
d0fc4754
...
@@ -116,7 +116,7 @@ for directed in [True, False]:
...
@@ -116,7 +116,7 @@ for directed in [True, False]:
for
i
,
c
in
enumerate
(
cs
):
for
i
,
c
in
enumerate
(
cs
):
if
c
!=
"gibbs"
:
if
c
!=
"gibbs"
:
mcmc_args
=
dict
(
beta
=
1
,
c
=
c
,
niter
=
20
if
c
!=
numpy
.
inf
else
200
)
mcmc_args
=
dict
(
beta
=
1
,
c
=
c
,
niter
=
20
)
else
:
else
:
mcmc_args
=
dict
(
beta
=
1
,
niter
=
20
)
mcmc_args
=
dict
(
beta
=
1
,
niter
=
20
)
if
i
==
0
:
if
i
==
0
:
...
@@ -129,8 +129,8 @@ for directed in [True, False]:
...
@@ -129,8 +129,8 @@ for directed in [True, False]:
hists
[
c
]
=
mcmc_equilibrate
(
state
,
hists
[
c
]
=
mcmc_equilibrate
(
state
,
mcmc_args
=
mcmc_args
,
mcmc_args
=
mcmc_args
,
gibbs
=
c
==
"gibbs"
,
gibbs
=
c
==
"gibbs"
,
wait
=
10
000
,
wait
=
4
000
,
nbreaks
=
40
,
nbreaks
=
5
,
verbose
=
(
1
,
"c = %s "
%
str
(
c
))
if
verbose
else
False
,
verbose
=
(
1
,
"c = %s "
%
str
(
c
))
if
verbose
else
False
,
history
=
True
)
history
=
True
)
...
@@ -143,14 +143,15 @@ for directed in [True, False]:
...
@@ -143,14 +143,15 @@ for directed in [True, False]:
pass
pass
Ss1
=
array
(
list
(
zip
(
*
hists
[
c1
]))[
0
])
Ss1
=
array
(
list
(
zip
(
*
hists
[
c1
]))[
0
])
Ss2
=
array
(
list
(
zip
(
*
hists
[
c2
]))[
0
])
Ss2
=
array
(
list
(
zip
(
*
hists
[
c2
]))[
0
])
# add very small normal noise, to solve discre
e
tness issue
# add very small normal noise, to solve discret
e
ness issue
Ss1
+=
numpy
.
random
.
normal
(
0
,
1e-6
,
len
(
Ss1
))
Ss1
+=
numpy
.
random
.
normal
(
0
,
1e-6
,
len
(
Ss1
))
Ss2
+=
numpy
.
random
.
normal
(
0
,
1e-6
,
len
(
Ss2
))
Ss2
+=
numpy
.
random
.
normal
(
0
,
1e-6
,
len
(
Ss2
))
D
,
p
=
scipy
.
stats
.
ks_2samp
(
Ss1
,
Ss2
)
D
,
p
=
scipy
.
stats
.
ks_2samp
(
Ss1
,
Ss2
)
D_c
=
1.63
*
sqrt
((
len
(
Ss1
)
+
len
(
Ss2
))
/
(
len
(
Ss1
)
*
len
(
Ss2
)))
if
verbose
:
if
verbose
:
print
(
"directed:"
,
directed
,
"c1:"
,
c1
,
"c2:"
,
c2
,
print
(
"directed:"
,
directed
,
"c1:"
,
c1
,
"c2:"
,
c2
,
"D"
,
D
,
"p-value:"
,
p
)
"D
:
"
,
D
,
"D_c:"
,
D_c
,
"p-value:"
,
p
)
if
p
<
.
0
01
:
if
p
<
.
01
:
print
((
"Warning, distributions for directed=%s (c1, c2) = "
+
print
((
"Warning, distributions for directed=%s (c1, c2) = "
+
"(%s, %s) are not the same, with a p-value: %g (D=%g)"
)
%
"(%s, %s) are not the same, with a p-value: %g (D=%g)"
)
%
(
str
(
directed
),
str
(
c1
),
str
(
c2
),
p
,
D
))
(
str
(
directed
),
str
(
c1
),
str
(
c2
),
p
,
D
))
...
...
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