-
Notifications
You must be signed in to change notification settings - Fork 234
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
Storing PLN formulas in the AtomSpace #2015
Conversation
Per discussion in opencog#2004 this should help PLN.
Fixes to the Reduct code needd to continue with the examples
That's cool! Though I'm not sure about the
Then your (cog-evaluate!
(Evaluation
; Compute TV = (1-sA*sB, cA*cB)
(PredicateLambda
(VariableList ; optional
(Variable "$X")
(Variable "$Y"))
(SimpleTruthValue
(Minus
(Number 1)
(Times
(StrengthOf (Variable "$X"))
(StrengthOf (Variable "$Y"))))
(Times
(ConfidenceOf (Variable "$X"))
(ConfidenceOf (Variable "$Y")))))
(List
(Concept "A")
(Concept "B")))) |
The (SimpleTruthValuePredicateScope
(VariableList ; optional
(Variable "$X")
(Variable "$Y"))
(Minus
(Number 1)
(Times
(StrengthOf (Variable "$X"))
(StrengthOf (Variable "$Y"))))
(Times
(ConfidenceOf (Variable "$X"))
(ConfidenceOf (Variable "$Y")))) I use the name
instead of
because It's the same idea as
which is syntactic sugar for
|
Hi @ngeiswei It is very late here, and time for me to go to bed. I just now pushed one more fix, and extended the demo slightly. Please take a look at the last part of the example. It works, but there is one kind-of annoying thing that I don't like very much: the formula "uses up all the space" that the PredicateNode would normally have. For example, you can either have this:
or you can have this
but you can't have both. I kind of want to have both. I am not sure how. Maybe this?
That should work, but it feels ugly to me. Not sure. Maybe. I dunno. Not entirely happy with that. Please think about it while I sleep. (Instead of DefineLink, maybe I will read your other comments tomorrow. But regrading Lambda and Scope -- you have this habit of obsessing about Lambda and Scope and I really do not understand why. They are handy for computing things, but actually putting them into everything, using them everywhere just seems to make everything complicated and verbose, and I don't see why they are needed. I don't understand why you want to use them so much. They seem like overkill for a simple problem. |
Also, I don't want to discuss here, but rather elsewhere --- I still do not understand ImplicationScope. It seems to be the exact opposite of every book I have ever read about logic. It just smells like a non-well-formed expression. Can you point at a PDF or a book or a wikipedia which explains what it is? |
OK, so What At this time, |
PLN strength formulas can be written using addition, subtraction,
multiplication and division ... so yeah they should work in this way
PLN heuristic confidence formulas are similar. Indefinite probability
based PLN confidence formulas require some MC or similar sampling and thus
need additional mechanisms. However, one beautiful implication of this new
approach is: The sampling involved in indefinite-probability estimation
could then be implemented as part of some general "OpenCoggy probabilistic
programming" toolset for doing sampling on Atomspace....
…-- Ben
On Mon, Jan 28, 2019 at 11:51 AM Linas Vepštas ***@***.***> wrote:
@ngeiswei <https://github.com/ngeiswei> the #1
<#1> most important question is:
can PLN rules be written with these formulas? Is this actually usable? If
not, what are the issues? I can't really tell if this is usable, in
practice.
—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub
<#2015 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AFolXA_bhsY1lfvXkv61l3zPU1jMkYsVks5vHnO7gaJpZM4aUcJw>
.
--
Ben Goertzel, PhD
http://goertzel.org
"The dewdrop world / Is the dewdrop world / And yet, and yet …" --
Kobayashi Issa
|
Hi @bgoertzel There does exist a |
@bgoertzel Here, this example: https://github.com/opencog/atomspace/blob/master/examples/atomspace/random-choice.scm It was written circa 2015 as a how-to-do probabilistic-programming demo for OpenCog. That was then .. now I would recommend using values instead of Atoms as the probability sources; this avoids the overhead of stuff random |
@@ -505,6 +507,29 @@ TruthValuePtr EvaluationLink::do_eval_scratch(AtomSpace* as, | |||
{ | |||
return evelnk->getTruthValue(); | |||
} | |||
else if (PREDICATE_FORMULA_LINK == t) | |||
{ | |||
std::vector<double> nums; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should this block of code also be replaced by do_formula()
call?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe. Let me look. I think it can be simpler, because it has no variables.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I want to keep as-is; to avoid passing in an empty list of arguments
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
- It is not clear for me why list of arguments is empty here? Is it correct that
do_eval_scratch
is called only after variables substitution? - What is wrong with passing empty list of arguments if this will reduce the code bloat?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
-
Yes,
do_eval_scratch
is called after argument substitution and reduction has been made. (There is a mostly-finished "lazy execution" code path that is unused because GPN/GSN's don't know how to be lazy. Hmm. I should look at that again. -
Yes, you are right. The two code paths are similar, one is longer and more complicated. The decision to merge them seems very close to being a coin-flip; there are benefits and disadvantages, they seem to cancel each out out.
The current PLN implementation encodes all formulas in scheme, and uses GPN's to apply those formulas. This is an experimental system to hold those formulas in the AtomSpace, instead. This has two benefits:
The formulas can be obtained from some learning system, e.g. MOSES, or pattern-mining, or neural nets, or whatever, without any need to convert them to scheme.
It's faster; this avoids the 50-microsecond overhead of getting into and out of the guile interpreter.
Take a look at the example "formulas.scm". It works.
This is a demo of one of the two ideas described in #2004