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
0b01305b
Commit
0b01305b
authored
Jun 19, 2019
by
Tiago Peixoto
Browse files
latent_multigraph(): Add `verbose` parameter
parent
36d81582
Changes
3
Hide whitespace changes
Inline
Side-by-side
src/graph/inference/graph_latent_multigraph.cc
View file @
0b01305b
...
...
@@ -25,7 +25,8 @@ using namespace boost;
using
namespace
graph_tool
;
void
latent_multigraph
(
GraphInterface
&
gi
,
boost
::
any
aw
,
boost
::
any
atheta_out
,
boost
::
any
atheta_in
,
double
epsilon
,
size_t
max_niter
)
boost
::
any
atheta_in
,
double
epsilon
,
size_t
max_niter
,
bool
verbose
)
{
typedef
eprop_map_t
<
double
>::
type
emap_t
;
typedef
vprop_map_t
<
double
>::
type
vmap_t
;
...
...
@@ -35,7 +36,7 @@ void latent_multigraph(GraphInterface& gi, boost::any aw, boost::any atheta_out,
run_action
<>
()
(
gi
,
[
&
](
auto
&
g
){
get_latent_multigraph
(
g
,
w
,
theta_out
,
theta_in
,
epsilon
,
max_niter
);
})();
epsilon
,
max_niter
,
verbose
);
})();
}
using
namespace
boost
::
python
;
...
...
src/graph/inference/graph_latent_multigraph.hh
View file @
0b01305b
...
...
@@ -34,7 +34,7 @@ using namespace boost;
template
<
class
Graph
,
class
WMap
,
class
TMap
>
void
get_latent_multigraph
(
Graph
&
g
,
WMap
w
,
TMap
theta_out
,
TMap
theta_in
,
double
epsilon
,
size_t
max_niter
)
double
epsilon
,
size_t
max_niter
,
bool
verbose
)
{
auto
wc
=
w
.
get_checked
();
for
(
auto
v
:
vertices_range
(
g
))
...
...
@@ -101,6 +101,8 @@ void get_latent_multigraph(Graph& g, WMap w, TMap theta_out, TMap theta_in,
}
});
niter
++
;
if
(
verbose
)
cout
<<
delta
<<
endl
;
}
};
...
...
src/graph_tool/inference/latent_multigraph.py
View file @
0b01305b
...
...
@@ -25,7 +25,7 @@ dl_import("from . import libgraph_tool_inference as libinference")
from
numpy
import
sqrt
def
latent_multigraph
(
g
,
epsilon
=
1e-8
,
max_niter
=
0
):
def
latent_multigraph
(
g
,
epsilon
=
1e-8
,
max_niter
=
0
,
verbose
=
False
):
r
"""Infer latent Poisson multigraph model given an "erased" simple graph.
Parameters
...
...
@@ -36,6 +36,8 @@ def latent_multigraph(g, epsilon=1e-8, max_niter=0):
Convergence criterion.
max_niter : ``int`` (optional, default: ``0``)
Maximum number of iterations allowed (if ``0``, no maximum is assumed).
verbose : ``boolean`` (optional, default: ``False``)
If ``True``, display verbose information.
Returns
-------
...
...
@@ -69,6 +71,5 @@ def latent_multigraph(g, epsilon=1e-8, max_niter=0):
_prop
(
"e"
,
g
,
w
),
_prop
(
"v"
,
g
,
theta_out
),
_prop
(
"v"
,
g
,
theta_in
),
epsilon
,
max_niter
)
epsilon
,
max_niter
,
verbose
)
return
g
,
w
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