fix the bug of MHSampler.#302
Conversation
|
@chrisgioia64 |
|
Looks good. |
There was a problem hiding this comment.
can you add type parameter to Iterator? Or you can use
for (Var var : ...getInstantiatedVars()) {
....
}
There was a problem hiding this comment.
@lileicc
I don't think we need to add the type since you could see that we didn't add type parameter to Iterator everywhere else in the whole project.
There was a problem hiding this comment.
Chris will soon add type parameter to everywhere.
So you may start here.
If you use eclipse, you will see warnings. It is generally not a good idea
to keep the warnings.
On Fri, Aug 22, 2014 at 10:21 AM, Da Tang notifications@github.com wrote:
In src/main/java/blog/sample/GenericProposer.java:
- PartialWorldDiff tmpWorld = new PartialWorldDiff(world);
- for (Iterator iter = evidenceAndQueries.iterator(); iter.hasNext();) {
BasicVar var = (BasicVar) iter.next();if (!tmpWorld.isInstantiated(var)) {return false;}TraceParentRecEvalContext context = new TraceParentRecEvalContext(tmpWorld);if (var instanceof VarWithDistrib) {((VarWithDistrib) var).getDistrib(context);if (context.getNumCalculateNewVars() > 0) {return false;}}- }
- for (Iterator iter = tmpWorld.getInstantiatedVars().iterator(); iter
@lileicc https://github.com/lileicc
I don't think we need to add the type since you could see that we didn't
add type parameter to Iterator everywhere else in the whole project.—
Reply to this email directly or view it on GitHub
https://github.com/BayesianLogic/blog/pull/302/files#r16609606.
…o fix-bug-MHSampler
@lileicc @cberzan @chrisgioia64
As discussed in #301 , the current version of MHSampler is incorrect. The reason is that this implementation doesn't remove the unnecessary variables correctly when they try to build a new instantiation from an old one (some times it will delete less variables, and sometimes it will delete too much variables so that the evidences and queries are not supported).
In this modified version, this problem was fixed. Though this version has not been tested formally.