opcode81 / ProbCog

A toolbox for statistical relational learning and reasoning.
GNU General Public License v3.0
101 stars 26 forks source link

compound queries don't seem to work #18

Closed tpacker closed 5 years ago

tpacker commented 5 years ago

I recently set up ProbCod on a MacBook using Anaconda in order to run it in an environment with Python 2.7 (I usually use Python 3).

When I run the MLN Query Tool and give it a query containing ^ or v such as Smokes(Ann) ^ Smokes(Bob) while running through the tutorial at https://github.com/opcode81/ProbCog/wiki/MLN-Tutorial, I always get no results and a message: "Warning: None of the queries could be matched to a variable." This doesn't seem to be expected behavior, given the tutorial. I would like to try queries with conjunctions.

Also, adding parameter "debug=True" doesn't seem to do anything.

I can get some output for compound queries if I issue the query in the Python script python pymlns_example.py. In this case, I wonder why, when I issue a query with variables inside predicates (instead of ground formulas), it only seems to return the first results. If I turn on Verbose output results = mrf.inferMCSAT(queries, verbose=True) I can see that it has calculated all the values I was looking for.

tpacker commented 5 years ago

I should have mentioned that the compound queries didn't work when I used J-MLNs engine. It does seem to work when I use PyMLNs engine.

opcode81 commented 5 years ago

That's the expected behaviour. Formula queries and parameters like "debug=True" will only work with PyMLNs. I have updated the tutorial page to name the engine to apply.

opcode81 commented 5 years ago

As far as pymlns_example.py is concerned, the way the inference results were read could not generalise to queries that require grounding. With commit e807e0777e452dcfa083dcd65562b1db7ebac893 , I have now changed it to use a different mechanism that does generalise.

tpacker commented 5 years ago

Thanks