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
2fd39e7b
Commit
2fd39e7b
authored
Jun 25, 2016
by
Tiago Peixoto
Browse files
Update inference tests
parent
131553a4
Pipeline
#189
failed with stage
in 468 minutes and 8 seconds
Changes
2
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
doc/test_inference.py
View file @
2fd39e7b
...
...
@@ -75,6 +75,9 @@ for pvals in iter_ranges(pranges):
if
not
deg_corr
and
degree_dl_kind
!=
"uniform"
:
continue
if
overlap
and
degree_dl_kind
!=
"distributed"
:
continue
if
(
rec
is
not
None
or
layered
!=
False
)
and
not
exact
:
continue
...
...
@@ -197,6 +200,9 @@ for pvals in iter_ranges(pranges):
if
not
deg_corr
and
degree_dl_kind
!=
"uniform"
:
continue
if
overlap
and
degree_dl_kind
!=
"distributed"
:
continue
print
(
params
,
file
=
out
)
rec_
=
None
...
...
doc/test_inference_mcmc.py
View file @
2fd39e7b
...
...
@@ -110,20 +110,21 @@ for directed in [True, False]:
for
i
,
c
in
enumerate
(
cs
):
if
c
!=
"gibbs"
:
mcmc_args
=
dict
(
beta
=
1
,
c
=
c
,
niter
=
1
00
,
allow_vacate
=
True
)
mcmc_args
=
dict
(
beta
=
1
,
c
=
c
,
niter
=
2
00
,
allow_vacate
=
True
)
else
:
mcmc_args
=
dict
(
beta
=
1
,
niter
=
1
00
,
allow_vacate
=
True
)
mcmc_args
=
dict
(
beta
=
1
,
niter
=
2
00
,
allow_vacate
=
True
)
if
i
==
0
:
mcmc_equilibrate
(
state
,
mcmc_args
=
mcmc_args
,
gibbs
=
c
==
"gibbs"
,
wait
=
100
,
nbreaks
=
25
,
wait
=
1000
,
verbose
=
(
1
,
"c = %s (t) "
%
str
(
c
))
if
verbose
else
False
)
hists
[
c
]
=
mcmc_equilibrate
(
state
,
mcmc_args
=
mcmc_args
,
gibbs
=
c
==
"gibbs"
,
wait
=
2000
,
nbreaks
=
1
2
,
nbreaks
=
2
5
,
verbose
=
(
1
,
"c = %s "
%
str
(
c
))
if
verbose
else
False
,
history
=
True
)
...
...
@@ -155,16 +156,20 @@ for directed in [True, False]:
hist
=
hists
[
c
]
if
cum
:
h
=
histogram
(
list
(
zip
(
*
hist
))[
0
],
1000000
,
density
=
True
)
plot
(
h
[
-
1
][:
-
1
],
numpy
.
cumsum
(
h
[
0
]),
"-"
,
label
=
"c=%s"
%
str
(
c
))
y
=
numpy
.
cumsum
(
h
[
0
])
y
/=
y
[
-
1
]
plot
(
h
[
-
1
][:
-
1
],
y
,
"-"
,
label
=
"c=%s"
%
str
(
c
))
if
c
!=
numpy
.
inf
:
hist
=
hists
[
numpy
.
inf
]
h2
=
histogram
(
list
(
zip
(
*
hist
))[
0
],
bins
=
h
[
-
1
],
density
=
True
)
res
=
abs
(
numpy
.
cumsum
(
h2
[
0
])
-
numpy
.
cumsum
(
h
[
0
]))
y2
=
numpy
.
cumsum
(
h2
[
0
])
y2
/=
y2
[
-
1
]
res
=
abs
(
y
-
y2
)
i
=
res
.
argmax
()
axvline
(
h
[
-
1
][
i
],
color
=
"grey"
)
else
:
h
=
histogram
(
list
(
zip
(
*
hist
))[
0
],
40
)
h
=
histogram
(
list
(
zip
(
*
hist
))[
0
],
40
,
density
=
True
)
plot
(
h
[
-
1
][:
-
1
],
h
[
0
],
"s-"
,
label
=
"c=%s"
%
str
(
c
))
gca
().
set_yscale
(
"log"
)
...
...
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