On Fri, Jul 18, 2008 at 8:49 PM, cdrick <
cdri...@gmail.com> wrote:
>
> Hi Pei,
>
> Late answer, but I needed to try to put things together (and read).
> Whereas I thing I understand relations between different entities,
> this is not always easy to figure out all the whole thing work... So I
> had another look at chapter 3 of your book, and quickly 4 and 5 and
> again the one on the control processing. I've started a document, a
> kind of memo based on your overview, plus I added some comprehension
> picture.
>
> You'll find it here:
http://www.squeakside.com/seaside/pier/OpenNARS/Big+Pictures+NARS
> (especially the pics)
> feel free to add comment.
Looks good. I'm sorry for the insufficient documentation of NARS,
which is partly caused by the lack of time, and partly by the
immaturity of the code. I'll do my best to improve the situation
gradually.
> Next step for the port is having Statement, and the main relations
> Inheritance, implications and so on. I will of course need to port
> CompoundTerm but this will be done by commenting all parts that are
> relevant more compound used in higher inference rules.
One possible shortcut is to skip CompoundTerm, and only implement Term
ans Statement. You can even merge the two into one. Most of the
complexity of CompoundTerm comes from the various types of internal
structures of compound term. Since you don't have the time, it is
better to start on the functions that is absolutely necessary ---
basic syllogistic rules.
> Now with me fresher vision of the system :), I still need some
> explanations on how rules are coded.
> For instance let's take dedExe(...) the first method of the class
> SyllogisticRules.
>
> It's not clear to me how the comment is related to the method (this is
> probably due to my non-logic background :) ). So I'll proceed step by
> step to find how
> {<S ==> M>, <M ==> P>} |- {<S ==> P>, <P ==> S>} is linked to
> dedExe(Term term1, Term term2, Sentence sentence, Judgment belief)
Fine. Just remember: each basic syllogistic rule takes two premises
(one on S-M, another on M-P), and derives one or more (up to 3, if you
only do basic syllogistic rules) conclusion between S and P. Then, for
each conclusion, there is a truth value function that corresponding to
an inference type (ded, abd, ind, exe, ana, com, res).
> premisses: {<S ==> M>, <M ==> P>}
> conclusion: {<S ==> P>, <P ==> S>}
>
> Both premisses are statements, and surely sentence (statem+ truth
> +stamp). I guess they are taken out from two tasks (only?).
One is a "task" (active knowledge) and the other is a "belief"
(passive knowledge) --- see section 6.1.1 of the book.
> Then conclusion is infered by the given rules. Having picked a
> concept, then a task on this concept... how the reasonner apply the
> dedEx rule... what's created... In other word I need a little help
> here or pointers in the book if you have because I think it's not
> clear to me the relations between different tasks ...
The work cycle of the system is specified in Section 6.3.1 of the book.
> /**
> * {<S ==> M>, <M ==> P>} |- {<S ==> P>, <P ==> S>}
> @param term1 Subject of the first new task
> IS IT S ?
> @param term2 Predicate of the first new task
> IS IT M or P?
> @param taskSentence The first premise
> IS IT something like: <S ==> M> %0.9 ; 0.54% ?
> @param belief The second
> premise IS IT <M ==> P>, if yes
> why call it belief instead of just sentence ?
> */
> static void dedExe(Term term1, Term term2, Sentence sentence,
> Judgment belief)
> -> side effect, create two new tasks ? that are register in Memory...
In the current code there is no class for "belief". A belief is just a
judgment (sentence with truth-value) stored to be used for various
purpose. On the other hand, a "task" is a sentence (judgment,
question, or goal) that the system is actively processing.
> One difficulty I have is to see clearly the difference between a
> belief, a task, a judgment and I'm particularly often confused when
> you employ the term belief... I also can't understand why you need
> term1 and term2, to me taskSentence and belief should be enough. Is it
> to have the conclusion ?
It is the urgly part of the current design. :-(
Though each (syllogistic) rule has exactly two premises, it often
takes four (or more) input, because of the different role they play.
Take your previous example,
{<S ==> M>, <M ==> P>} |- {<S ==> P>, <P ==> S>}
This rule can be used for several different task-belief combination:
*. <S ==> M> is new belief, and <M ==> P> is previous belief;
*. <S ==> M> is a question, and <M ==> P> is previous belief;
*. <S ==> M> is previous belief, and <M ==> P> is goal;
... ...
One solution is to provide a rule for each case, but what I decided is
to let them to share the same rule. Consequently, just to give the
rule <S ==> M> and <M ==> P> (with truth value) is not enough --- it
is also necessary to distinguish the task from the belief, which
cannot be decided from the content of the premises.
> My understanding so far is belief = Judgment (majority of sentences).
Yes, all beliefs are judgments, but judgments can also be the content
of tasks (see the book section I mentioned).
> Concept is like a container of all tasks in relation with a given
> term, beliefs related to a certain term.
Yes. In an imaged "knowledge network", concepts are the nodes.
> But then I don't understand
> why the have an associated budget value...
Read Section 6.1.2 of the book.
> TermLinks and TaskLinks are
> not clear either actually for the same reason (why do they have budget
> values ...).
> So naive question, is it possible to have only budget value on tasks ?
No. also see the above section. Roughly speaking, whereever
traditional AI systems make a choice (among paths, rules, ...), NARS
makes a resource allocation, so that all possibilities are processed
in parallel, but at very different speeds.
>> The current file/class design is chosen, to a large extent, to make
>> conceptual design easy, rather than to make the implementation clean
>> or efficient. For example, certain function is only used in one class,
>> so it is more natural to define it there. In the current code, I put
>> all functions together, so it will be easier to compare them and to
>> get the whole picture for this aspect of the system. Since you have
>> different considerations, it is fine to move things around to make the
>> system structure more natural to you.
>
> ok. I think this was particularly true for TruthFunctions.
It can be.
>> >>> -Variable.java
>> >>> -CompoundTerm.java and Sentence.java (probably not complete) and all
>> >>> subclasses (empty, just stubs (interface + comments))
>>
>> >>Variable and CompoundTerm are two of the most complicated classes,
>> >>conceptually speaking. You should make sure you understand the current
>> >>design before trying to port them.
>>
>> > I've looked at them and I'll probably wait a bit before porting them.
>> > I have two remarks though:
>> > - Implementing a visitor is probably the way to go.
>>
>> Not sure what you mean by a "visitor".
>
>
http://en.wikipedia.org/wiki/Visitor_pattern
>
> Visitor allow to implement treatment independly of the structure. It's
> often coupled with a tree structure, and a composite one (like for
> compound).
Yes, it makes sense.
> One important thing I guess is at least to implement a better dispatch
> mechanism to avoid succession of tests. It will also help extend/
> modify... I tend to avoid all isInstanceOf: orIsKindOf:
Agree. The current dispatch mechanism is too messy.
>> Anyway, variable is a messy issue, and I'm not happy with the current
>> design, so feel free to try different ways. However, given your time
>> constraint, you may want to leave it to the end of the project, if
>> there is still time left.
>
> I think, I'm gonna leave variables for now :)
Good idea!
> Maybe if you have any thought concerning the direction variable
> implementation should take, I'll be interested to know.
One possibility is to simply call a module coded in a Prolog-like language.
> I find something that could help would be to have a rule abstraction
> that takes 1 or 2 premises as parameters and return the conclusion.
But if these cases need to be processed in very different ways, what
will that abstraction provide?
> What I'd like is an abstraction for rules and a mechanism to fire
> rules.
Then it will be like the current "RuleTables.reason" method, right?
> I may stick close to your implementation for now though. But I will
> think and discuss to see if it's easily possible to use non static
> method most of the time. If someone has a right abstraction idea ;)
I'm sure there are better solutions, if enough time is spent on it.
The problem is we all have insufficient time. ;-)
> Some thoughts on that:
> I've looked a bit a Jena, but it seems to be a different objective.
> Plugging different kind of reasoner.
> In NARS, I find there is a full set of possible inference rules that
> are competing. This competition act upons budget values and there's a
> kind of reasonning controller that manage the selection of tasks,
> questions answering etc... by adjusting budget values of each item
> (that encapsulaters, term logic and relative importance).
>
> Memory seems to play that role (controller) and contains also all the
> different bags that is to me the state of the working memory.
> I wonder if it would be useful to use a proper reasoningcontroller
> (separate actual Memory classes in two classes ?)
>
> I hope this is not too... fuzzy.
Interesting. I'd need to hear and think more to make meaningful comments here.
Pei