Commit 0aee04a4 authored by Tiago Peixoto's avatar Tiago Peixoto
Browse files

inference: fix potential issue with get_move_prob()

parent 952d299b
......@@ -890,11 +890,7 @@ public:
size_t ew = _eweight[e];
w += ew;
int mts;
if (t == r && s == size_t(_b[u]))
mts = _mrs[_emat.get_bedge(e)];
else
mts = get_mrs(t, s, _mrs, _emat);
int mts = get_mrs(t, s, _mrs, _emat);
int mtp = _mrp[t];
int mst = mts;
int mtm = mtp;
......@@ -947,6 +943,9 @@ public:
double get_move_prob(size_t v, size_t r, size_t s, double c, bool reverse)
{
_m_entries.clear();
move_entries(v, (reverse) ? r : s, _b, _eweight, _mrs,
_emat.get_bedge_map(), _g, _bg, _m_entries);
return get_move_prob(v, r, s, c, reverse, _m_entries);
}
......
......@@ -679,7 +679,10 @@ class BlockState(object):
``reverse == True``, the reverse probability of moving the node back
from block ``s`` to its current one is obtained.
"""
return self._state.get_move_prob(int(v), self.b[v], s, c, reverse)
if not reverse:
return self._state.get_move_prob(int(v), self.b[v], s, c, False)
else:
return self._state.get_move_prob(int(v), s, self.b[v], c, True)
def get_edges_prob(self, edge_list, missing=True, entropy_args={}):
"""Compute the log-probability of the missing (or spurious if ``missing=False``)
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment