Commit 1c48aec8 authored by Tiago Peixoto's avatar Tiago Peixoto
Browse files

inference: Return number of attempted moves for mcmc sweeps

parent 1c155fb7
......@@ -144,8 +144,8 @@ for directed in [True, False]:
continue
except TypeError:
pass
Ss1 = array(list(zip(*hists[c1]))[0])
Ss2 = array(list(zip(*hists[c2]))[0])
Ss1 = array(list(zip(*hists[c1]))[2])
Ss2 = array(list(zip(*hists[c2]))[2])
# add very small normal noise, to solve discreteness issue
Ss1 += numpy.random.normal(0, 1e-2, len(Ss1))
Ss2 += numpy.random.normal(0, 1e-2, len(Ss2))
......
......@@ -49,8 +49,7 @@ python::object do_gibbs_sweep(python::object ogibbs_state,
[&](auto& s)
{
auto ret_ = gibbs_sweep(s, rng);
ret = python::make_tuple(get<0>(ret_), get<1>(ret_),
get<2>(ret_));
ret = tuple_apply([&](auto&... args){ return python::make_tuple(args...); }, ret_);
});
};
block_state::dispatch(oblock_state, dispatch);
......
......@@ -51,12 +51,12 @@ python::object do_mcmc_sweep(python::object omcmc_state,
if (s._parallel)
{
auto ret_ = mcmc_sweep_parallel(s, rng);
ret = python::make_tuple(ret_.first, ret_.second);
ret = tuple_apply([&](auto&... args){ return python::make_tuple(args...); }, ret_);
}
else
{
auto ret_ = mcmc_sweep(s, rng);
ret = python::make_tuple(ret_.first, ret_.second);
ret = tuple_apply([&](auto&... args){ return python::make_tuple(args...); }, ret_);
}
});
};
......
......@@ -49,7 +49,7 @@ python::object do_merge_sweep(python::object omerge_state,
[&](auto& s)
{
auto ret_ = merge_sweep(s, rng);
ret = python::make_tuple(ret_.first, ret_.second);
ret = tuple_apply([&](auto&... args){ return python::make_tuple(args...); }, ret_);
});
};
block_state::dispatch(oblock_state, dispatch);
......
......@@ -64,7 +64,7 @@ python::object do_multicanonical_sweep(python::object omulticanonical_state,
[&](auto& mc_state)
{
auto ret_ = mcmc_sweep(mc_state, rng);
ret = python::make_tuple(ret_.first, ret_.second);
ret = tuple_apply([&](auto&... args){ return python::make_tuple(args...); }, ret_);
});
});
};
......
......@@ -64,7 +64,7 @@ python::object do_multicanonical_multiflip_sweep(python::object omulticanonical_
[&](auto& mc_state)
{
auto ret_ = mcmc_sweep(mc_state, rng);
ret = python::make_tuple(ret_.first, ret_.second);
ret = tuple_apply([&](auto&... args){ return python::make_tuple(args...); }, ret_);
});
});
};
......
......@@ -49,7 +49,7 @@ python::object do_multiflip_mcmc_sweep(python::object omcmc_state,
[&](auto& s)
{
auto ret_ = mcmc_sweep(s, rng);
ret = python::make_tuple(ret_.first, ret_.second);
ret = tuple_apply([&](auto&... args){ return python::make_tuple(args...); }, ret_);
});
};
block_state::dispatch(oblock_state, dispatch);
......
......@@ -74,9 +74,7 @@ struct MCMC
_vpos(get(vertex_index_t(), _state._g),
num_vertices(_state._g)),
_rpos(get(vertex_index_t(), _state._bg),
num_vertices(_state._bg)),
_sequential(false),
_deterministic(false)
num_vertices(_state._bg))
{
_state.init_mcmc(_c,
(_entropy_args.partition_dl ||
......@@ -102,8 +100,7 @@ struct MCMC
std::vector<size_t> _vlist;
std::vector<size_t> _vs;
bool _sequential;
bool _deterministic;
size_t _null_move = null_group;
size_t node_state(size_t r)
{
......@@ -267,12 +264,12 @@ struct MCMC
bool is_deterministic()
{
return _deterministic;
return false;
}
bool is_sequential()
{
return _sequential;
return false;
}
auto& get_vlist()
......
......@@ -62,8 +62,7 @@ python::object gibbs_layered_sweep(python::object ogibbs_state,
[&](auto& s)
{
auto ret_ = gibbs_sweep(s, rng);
ret = python::make_tuple(get<0>(ret_), get<1>(ret_),
get<2>(ret_));
ret = tuple_apply([&](auto&... args){ return python::make_tuple(args...); }, ret_);
});
},
false);
......
......@@ -64,12 +64,12 @@ python::object mcmc_layered_sweep(python::object omcmc_state,
if (s._parallel)
{
auto ret_ = mcmc_sweep_parallel(s, rng);
ret = python::make_tuple(ret_.first, ret_.second);
ret = tuple_apply([&](auto&... args){ return python::make_tuple(args...); }, ret_);
}
else
{
auto ret_ = mcmc_sweep(s, rng);
ret = python::make_tuple(ret_.first, ret_.second);
ret = tuple_apply([&](auto&... args){ return python::make_tuple(args...); }, ret_);
}
});
},
......
......@@ -62,7 +62,7 @@ python::object merge_layered_sweep(python::object omerge_state,
[&](auto& s)
{
auto ret_ = merge_sweep(s, rng);
ret = python::make_tuple(ret_.first, ret_.second);
ret = tuple_apply([&](auto&... args){ return python::make_tuple(args...); }, ret_);
});
},
false);
......
......@@ -78,7 +78,7 @@ python::object multicanonical_layered_sweep(python::object omulticanonical_state
[&](auto& mc_state)
{
auto ret_ = mcmc_sweep(mc_state, rng);
ret = python::make_tuple(ret_.first, ret_.second);
ret = tuple_apply([&](auto&... args){ return python::make_tuple(args...); }, ret_);
});
});
},
......
......@@ -78,7 +78,7 @@ python::object multicanonical_layered_multiflip_sweep(python::object omulticanon
[&](auto& mc_state)
{
auto ret_ = mcmc_sweep(mc_state, rng);
ret = python::make_tuple(ret_.first, ret_.second);
ret = tuple_apply([&](auto&... args){ return python::make_tuple(args...); }, ret_);
});
});
},
......
......@@ -62,7 +62,7 @@ python::object multiflip_mcmc_layered_sweep(python::object omcmc_state,
[&](auto& s)
{
auto ret_ = mcmc_sweep(s, rng);
ret = python::make_tuple(ret_.first, ret_.second);
ret = tuple_apply([&](auto&... args){ return python::make_tuple(args...); }, ret_);
});
},
false);
......
......@@ -62,8 +62,7 @@ python::object gibbs_layered_overlap_sweep(python::object ogibbs_state,
[&](auto& s)
{
auto ret_ = gibbs_sweep(s, rng);
ret = python::make_tuple(get<0>(ret_), get<1>(ret_),
get<2>(ret_));
ret = tuple_apply([&](auto&... args){ return python::make_tuple(args...); }, ret_);
});
},
false);
......
......@@ -64,12 +64,12 @@ python::object mcmc_layered_overlap_sweep(python::object omcmc_state,
if (s._parallel)
{
auto ret_ = mcmc_sweep_parallel(s, rng);
ret = python::make_tuple(ret_.first, ret_.second);
ret = tuple_apply([&](auto&... args){ return python::make_tuple(args...); }, ret_);
}
else
{
auto ret_ = mcmc_sweep(s, rng);
ret = python::make_tuple(ret_.first, ret_.second);
ret = tuple_apply([&](auto&... args){ return python::make_tuple(args...); }, ret_);
}
});
},
......
......@@ -63,7 +63,7 @@ python::object mcmc_layered_overlap_bundled_sweep(python::object omcmc_state,
[&](auto& s)
{
auto ret_ = mcmc_sweep(s, rng);
ret = python::make_tuple(ret_.first, ret_.second);
ret = tuple_apply([&](auto&... args){ return python::make_tuple(args...); }, ret_);
});
},
false);
......
......@@ -78,7 +78,7 @@ multicanonical_layered_overlap_sweep(python::object omulticanonical_state,
[&](auto& mc_state)
{
auto ret_ = mcmc_sweep(mc_state, rng);
ret = python::make_tuple(ret_.first, ret_.second);
ret = tuple_apply([&](auto&... args){ return python::make_tuple(args...); }, ret_);
});
});
},
......
......@@ -78,7 +78,7 @@ multicanonical_layered_overlap_multiflip_sweep(python::object omulticanonical_st
[&](auto& mc_state)
{
auto ret_ = mcmc_sweep(mc_state, rng);
ret = python::make_tuple(ret_.first, ret_.second);
ret = tuple_apply([&](auto&... args){ return python::make_tuple(args...); }, ret_);
});
});
},
......
......@@ -62,7 +62,7 @@ python::object multiflip_mcmc_layered_overlap_sweep(python::object omcmc_state,
[&](auto& s)
{
auto ret_ = mcmc_sweep(s, rng);
ret = python::make_tuple(ret_.first, ret_.second);
ret = tuple_apply([&](auto&... args){ return python::make_tuple(args...); }, ret_);
});
},
false);
......
Supports Markdown
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