Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unstable rule selection by the GHOST action selector #15

Open
joejnke opened this issue Oct 15, 2018 · 8 comments
Open

Unstable rule selection by the GHOST action selector #15

joejnke opened this issue Oct 15, 2018 · 8 comments

Comments

@joejnke
Copy link

joejnke commented Oct 15, 2018

The GHOST action selector makes unpredictable rule selection between two same rules but different in their goal strength (ghost-parse "#goal: (goal1=0.7) u: (hi) hello there ^keep") and (ghost-parse "#goal: (goal1=0.5) u: (hi) hi there ^keep"). Running the code (test-ghost "hi") gives sometimes ((WordNode "hi") (WordNode "there") ) and other times ((WordNode "hello") (WordNode "there") ).
The expected response was expected to be of the rule with the highest goal strength, that is ((WordNode "hello") (WordNode "there") )

@simonmekit
Copy link

There are also inconsistencies in output of rule goal strength with ghost-rule-tv command.

(FYI: tested without starting cog-server and without using ecan based rules)

scheme@(guile-user)> (ghost-parse "#goal: (goal1=0.4) u: lbl2(hi) hi there ^keep")
scheme@(guile-user)> (ghost-parse "#goal: (goal1=0.8) u: lbl2(hi) hello there ^keep")
scheme@(guile-user)> (test-ghost "hi")
[2018-10-31 09:43:29:500] [WARN] No configuration file was loaded! Param=STARTING_STI_FUNDS
[2018-10-31 09:43:29:500] [WARN] No configuration file was loaded! Param=STARTING_LTI_FUNDS
[2018-10-31 09:43:29:500] [WARN] No configuration file was loaded! Param=STI_FUNDS_BUFFER
[2018-10-31 09:43:29:500] [WARN] No configuration file was loaded! Param=LTI_FUNDS_BUFFER
[2018-10-31 09:43:29:500] [WARN] No configuration file was loaded! Param=TARGET_LTI_FUNDS
[2018-10-31 09:43:29:500] [WARN] No configuration file was loaded! Param=TARGET_STI_FUNDS
[2018-10-31 09:43:29:500] [WARN] No configuration file was loaded! Param=ECAN_STARTING_ATOM_STI_WAGE
[2018-10-31 09:43:29:500] [WARN] No configuration file was loaded! Param=ECAN_STARTING_ATOM_LTI_WAGE
[2018-10-31 09:43:29:500] [WARN] No configuration file was loaded! Param=ECAN_MAX_AF_SIZE
[2018-10-31 09:43:29:505] [INFO] [say] (hello there)
$1 = ((WordNode "hello")
(WordNode "there")
)
Action selection seems correct in this case, but running ghost-rule-tv "lbl2" returned the other value.
scheme@(guile-user)> (ghost-rule-tv "lbl2")
$2 = (stv 0.400000 0.900000)

The top level goal strength is not recognized by the same command:

scheme@(guile-user)> (ghost-parse "goal: (please_user=0.8)")
scheme@(guile-user)> (ghost-parse "u: lbl1 (hello) Hello wonderful human")
[2018-10-30 12:38:31:960] [WARN] [GHOST] Did you forget to link a goal to the rule?
scheme@(guile-user)> (ghost-rule-tv "lbl1")
$2 = (stv 0.900000 0.900000)

@leungmanhin
Copy link
Member

@joejnke Action selection is probabilistic, so not always choosing the one with the highest weight is the expected behavior here.

@leungmanhin
Copy link
Member

leungmanhin commented Oct 31, 2018

@simonmekit Again, put everything in a text file and use ghost-parse-files to parse rules. If you want to call ghost-parse repeatedly, don't forget to put all the related goals/rules etc in one call, i.e. (ghost-parse "#goal: (please_user=0.8) u: lbl1 (hello) Hello wonderful human") in this case.

See also: singnet/opencog#30

@simonmekit
Copy link

yes, indeed using ghost-parse-file makes stable action selection for same rule with different goal strength.
The Ghost tutorial could be updated with ghost-parse-file in addition to ghost-parse to align with subsequent test process.

@simonmekit
Copy link

@leungmanhin as you mentioned rule-level goal also works fine with ghost-parse-file and ghost-rule-tv commands. However, it seems the concept of top-level goal described in the tutorial is not properly working.

"ghostfile.ghost" contains these subsequent lines :
#goal: (goal1=0.4) u: lbl2(hi) hi there ^keep
#goal: (goal1=0.8) u: lbl2(hi) hello there ^keep
goal: (please_user=0.8)
u: lbl1(hello) Hello wonderful human
u: lbl3(Dr. Watson) hello everyone ^keep

scheme@(guile-user)> (ghost-rule-tv "lbl2")
$1 = (stv 0.800000 0.900000)
scheme@(guile-user)> (ghost-rule-tv "lbl1")
$2 = (stv 0.800000 0.900000)
scheme@(guile-user)> (ghost-rule-tv "lbl3")
$3 = (stv 0.800000 0.900000)

@leungmanhin
Copy link
Member

"ghostfile.ghost" contains these subsequent lines :
#goal: (goal1=0.4) u: lbl2(hi) hi there ^keep
#goal: (goal1=0.8) u: lbl2(hi) hello there ^keep
goal: (please_user=0.8)
u: lbl1(hello) Hello wonderful human
u: lbl3(Dr. Watson) hello everyone ^keep

scheme@(guile-user)> (ghost-rule-tv "lbl2")
$1 = (stv 0.800000 0.900000)
scheme@(guile-user)> (ghost-rule-tv "lbl1")
$2 = (stv 0.800000 0.900000)
scheme@(guile-user)> (ghost-rule-tv "lbl3")
$3 = (stv 0.800000 0.900000)

@simonmekit Sorry I don't see any problem in the above example... What is the expected result? Or are you just talking about the ones in the tutorial?

@simonmekit
Copy link

yes, I was running tests to make sure that the tutorial complies with current updates and prepare some test-suite. Top level goal works fine with ghost-parse-file, sorry @leungmanhin for confusion!

@leungmanhin
Copy link
Member

@simonmekit no problem, thanks for doing all these!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants