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
db22b670
Commit
db22b670
authored
Jul 18, 2016
by
Tiago Peixoto
Browse files
graph_blockmodel_util.hh: Fix bug with 'waiting times'
parent
410e8232
Changes
1
Hide whitespace changes
Inline
Side-by-side
src/graph/inference/graph_blockmodel_util.hh
View file @
db22b670
...
...
@@ -342,14 +342,9 @@ public:
{
double
S
=
0
;
if
(
_allow_empty
)
{
S
+=
lbinom
(
_total_B
+
_N
-
1
,
_N
);
}
else
{
//S += lbinom(std::min(_total_B, _N), _actual_B);
S
+=
lbinom
(
_N
-
1
,
_actual_B
-
1
);
}
S
+=
lgamma_fast
(
_N
+
1
);
for
(
auto
nr
:
_total
)
S
-=
lgamma_fast
(
nr
+
1
);
...
...
@@ -361,12 +356,13 @@ public:
double
S
=
0
;
for
(
size_t
r
=
0
;
r
<
_ep
.
size
();
++
r
)
{
auto
nr
=
_total
[
r
];
if
(
nr
==
0
)
continue
;
S
+=
xlogx
(
nr
);
size_t
total
=
0
;
for
(
auto
&
k_c
:
_hist
[
r
])
{
S
-=
xlogx
(
k_c
.
second
);
total
+=
k_c
.
second
;
}
S
+=
xlogx
(
total
);
}
return
S
;
}
...
...
@@ -390,9 +386,13 @@ public:
S
+=
log_q
(
_ep
[
r
],
_total
[
r
]);
S
+=
log_q
(
_em
[
r
],
_total
[
r
]);
S
+=
lgamma_fast
(
_total
[
r
]
+
1
)
;
size_t
total
=
0
;
for
(
auto
&
k_c
:
_hist
[
r
])
{
S
-=
lgamma_fast
(
k_c
.
second
+
1
);
total
+=
k_c
.
second
;
}
S
+=
lgamma_fast
(
total
+
1
);
}
return
S
;
}
...
...
Write
Preview
Supports
Markdown
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