opencog / miner

Frequent and surprising subhypergraph pattern miner for the AtomSpace.
Other
8 stars 15 forks source link

Signal6 issue with pattern miner #7

Closed DaddyWesker closed 5 years ago

DaddyWesker commented 6 years ago

Today i've tried to launch firstly simple example from the site (https://wiki.opencog.org/w/Pattern_miner) and on the line "opencog> loadmodule opencog/learning/PatternMiner/libPatternMinerAgent.so" i've received following output in server's terminal window:

"Listening on port 17001 ;;; note: auto-compilation is enabled, set GUILE_AUTO_COMPILE=0 ;;; or pass the --no-auto-compile argument to disable. ;;; compiling /home/cics/OpenCog/opencog/build/../opencog/learning/PatternMiner/ugly_male_soda-drinker_corpus.scm ;;; compiled /home/cics/.cache/guile/ccache/2.0-LE-8-2.0/home/cics/OpenCog/opencog/opencog/learning/PatternMiner/ugly_male_soda-drinker_corpus.scm.go terminate called after throwing an instance of 'opencog::AssertionException' what(): (/home/cics/OpenCog/opencog/opencog/learning/PatternMiner/Parameters.cc:47) [2018-01-18 10:37:35:266] [ERROR] Caught signal 6 (Aborted) on thread 139683083409472 Stack Trace: 2: basic_string.h:539 ~basic_string() 3: CogServerMain.cc:81 _Z7sighandi() 4: [0x36cb0] ??() ??:0 5: raise.c:56 GI_raise() 6: abort.c:91 GI_abort() 7: [0x60535] ??() ??:0 8: [0x5e6d6] ??() ??:0 9: [0x5e703] ??() ??:0 10: [0x5e922] ??() ??:0 11: oc_assert.cc:59 opencog::cassert(char const*, bool) 12: Parameters.cc:47 opencog::PatternMining::Parameters::reSetAllSettingsFromConfig() 13: PatternMiner.cc:2682 opencog::PatternMining::PatternMiner::PatternMiner(opencog::AtomSpace&) 14: PatternMinerAgent.cc:66 opencog::PatternMinerAgent::PatternMinerAgent(opencog::CogServer&) 15: Factory.h:71 opencog::Factory<opencog::PatternMinerAgent, opencog::Agent>::create(opencog::CogServer&) const 16: Registry.h:104 opencog::Registry::create(opencog::CogServer&, std::string const&) 17: shared_ptr_base.h:448 shared_count<opencog::Agent*>() 18: shared_ptr_base.h:545 ~shared_count() 19: CogServer.cc:481 opencog::CogServer::loadModule(std::string const&) 20: LoadModuleRequest.cc:55 opencog::LoadModuleRequest::execute() 21: CogServer.cc:261 opencog::CogServer::processRequests() 22: CogServer.cc:224 opencog::CogServer::runLoopStep() 23: CogServer.cc:199 opencog::CogServer::serverLoop() 24: CogServerMain.cc:139 main() 25: libc-start.c:321 __libc_start_main() 26: [0x4070fc] ??() ??:0"

Also tried to do similar thing using python's scheme_eval. Like this:

"from opencog.atomspace import AtomSpace, TruthValue from opencog.atomspace import types from opencog.type_constructors import * from opencog.bindlink import satisfying_set, bindlink from opencog.utilities import initialize_opencog from opencog.scheme_wrapper import load_scm, scheme_eval, scheme_eval_h

a = AtomSpace() initialize_opencog(a) set_type_ctor_atomspace(a) TV = TruthValue(1, 1) data = ["opencog/atomspace/core_types.scm", "opencog/scm/utilities.scm"] for item in data: load_scm(a, item) scheme_eval(a, "(add-to-load-path \"/usr/local/share/opencog/scm\")") scheme_eval(a,"(use-modules (opencog) (opencog nlp) (opencog nlp chatbot) (opencog nlp relex2logic) (opencog atom-types))") scheme_eval(a,"(use-modules (opencog patternminer))") scheme_eval(a, "(clear)") scheme_eval (a,'(load "../opencog/learning/PatternMiner/testdatasmall.scm")')"

and got same signal 6 problem on "scheme_eval(a,"(use-modules (opencog patternminer))")" line. "Process finished with exit code 134 (interrupted by signal 6: SIGABRT)"

If anyone could help with that i would really appreciate that. Have a nice day!

linas commented 6 years ago

I think @ngeiswei can help with the miner; however, some pre-comments:

initialize_opencog(a) set_type_ctor_atomspace(a) TV = TruthValue(1, 1)

Above are not needed.

data = ["opencog/atomspace/core_types.scm", "opencog/scm/utilities.scm"] for item in data: load_scm(a, item)

Above are probably harmful, and should not be done.

scheme_eval(a, "(clear)")

Above is definitely harmful, it erases the contents of the atomspace! Various subsystems have carefully poked data into the atompsace, erasing it just scrambles the config.

It looks like you cut-n-pasted these from some instructions, somewhere.... where? Those instructions are wrong and need to be fixed.

DaddyWesker commented 6 years ago

Hello, thanks for your reply.

WE've tried to use this (https://wiki.opencog.org/w/Pattern_Miner_Scheme_Functions) example (step 3-4) and put it into Python's scheme_eval. Like we've done that before.

"Above are not needed." But these lines are required in Python, dont they?

"data = ["opencog/atomspace/core_types.scm", "opencog/scm/utilities.scm"] for item in data: load_scm(a, item)" These too are necessary to run scheme wrapper in python. Or there are better way?

linas commented 6 years ago

"Above are not needed." But these lines are required in Python, dont they?

Python is already initialized. You do not need a second initialzation.

These too are necessary to run scheme wrapper in python

No they aren't. They (and much much more) are loaded when you say scheme_eval(a,"(use-modules (opencog))") At best, they are just a pointless extra step. At worst, it causes conflicts, duplicate defines, and various hard-to-debug hangs and crashes resulting from such duplication.

Also this should not be needed, either:

scheme_eval(a, "(add-to-load-path "/usr/local/share/opencog/scm")")

ngeiswei commented 6 years ago

@DaddyWesker The pattern miner is being complete reworked, unless you're anxious you should probably wait for 1-2 weeks. Otherwise I can give you the steps to use it, just know that it's WIP, let me know.

DaddyWesker commented 6 years ago

@linas That's strange since i've used these lines from one of the examples. Alright, thanks for the tip!

@ngeiswei Oh, that's what's going on. I see. Thanks for the reply. If it is possible, i'm really could use some tips to get it work now. I'm afraid it is anxious.

ngeiswei commented 6 years ago

@DaddyWesker the new pattern miner is more powerful but it's also slower, due to lack of tuning its heuristics at this stage. As of right now you have 2 options

  1. Use its C++ implementation https://github.com/opencog/opencog/tree/master/opencog/learning/xpattern-miner/c%2B%2B-based you can find multiple examples of its usage here https://github.com/opencog/opencog/blob/master/tests/learning/xpattern-miner/c%2B%2B-based/XPatternMinerUTest.cxxtest in fact you could directly hack this file to add yours, even why not commit it as an addition unit test, as long as it doesn't take more than a couple minutes to run.

  2. Use its URE implementation https://github.com/opencog/opencog/tree/master/opencog/learning/xpattern-miner/ure-based that one is too embryonic to be used I think, and it will be even less efficient, though I'm working on it right now, this will improve within the next few days and weeks.

I would recommend that you go with 1. If you'd rather not fiddle with C++ I could add scheme bindings to it, but since the URE-based implementation (that doesn't require scheme bindings) will likely replace it in the long-run I'm not especially motivated to do so. If you ask kindly and I've got a bit of time maybe I'll do it, but no guaranty. ;-)

If you go with 1, I'll probably have to explain to you some of its parameters in order to be tractable, they are also well explained in the code and you can get some ideas by looking at the unit tests.

ngeiswei commented 5 years ago

@DaddyWesker if you still need the pattern miner, I believe the new pattern miner might be mature enough to tackle it, see https://github.com/opencog/opencog/blob/master/opencog/learning/miner/README.md for more info. Otherwise please close that issue as the old pattern miner will very likely never be fixed (in fact I intend to remove it as soon as the new pattern miner support surprisingness).

ngeiswei commented 5 years ago

I'm closing, should recreate an issue for the new pattern miner if the problem exists for it.