opennars / Narjure

A Clojure implementation of the Non-Axiomatic Reasoning System proposed by Pei Wang.
GNU General Public License v2.0
43 stars 11 forks source link

NAL3 Truth Function Inconsistent with Docs #62

Open automenta opened 8 years ago

automenta commented 8 years ago

https://github.com/opennars/opennars2/blob/2.0.0_postdev1/src/nal/deriver/truth.clj#L101

(t-and c1 c2)

https://github.com/opennars/opennars2/blob/2.0.0_postdev1/docs/NAL-spec/NAL-3.tex#L206

c &=& or(and(not(f_1), c_1), and(not(f_2), c_2)) + and(f_1, c_1, f_2, c_2)

the preceding paragraph in the NAL spec explains:

When T 1 and T 2 are either highly similar or opposite to each other, the compound terms produced by these rules may not have much practical value. However, even when it happens, it is an issue to be handled by inference control, not by logic. In the confidence functions, each case for the conclusion to reach its maximum is separately considered. The plus operator is used in place of an or operator, because the two cases involved are mutually exclusive, rather than independent of each other.

i had suspected a symmetric form of this function was missing for negated cases of certain truth functions. not only is the code missing the negated case, inconsistent for the positive case, but i see a possible mistake written for the unimplemented negated case. taking the intersection case as an example

c = or(and(not(f 1 ), c 1 ), and(not(f 2 ), c 2 )) + and(f 1 , c 1 , f 2 , c 2 )

the first component of this formula alone can produce confidence values higher than its conf inputs (ex: two 90% conf inputs producing a 98% conf output in one test case). no other truth functions compute a confidence combining freq and conf in an or( ) in this way.

my guess is that that '+' actually means max as the explanation seems to suggest, and that one of these variations will produce more reasonable confidence values for the various positive and negative combinations.

max(and(f1, f2, c1, c2), and( 1-f1, c1, 1-f2, c2 )) max(and(f1, f2, c1, c2), and( or(1-f1, 1-f2), c1, c2 ))

otherwise please clarify the documentation and/or why the code seems inconsistent for these functions (including opennars 1.x)

automenta commented 8 years ago

max(and(f1, f2, c1, c2), and( and(1-f1, 1-f2), c1, c2 ))

automenta commented 8 years ago

https://github.com/opennars/opennars_googlecode/blob/master/nars/inference/TruthFunctions.java#L303

automenta commented 8 years ago

https://github.com/opennars/opennars_googlecode/blob/master/open-nars/src/com/googlecode/opennars/inference/TruthFunctions.java#L313

automenta commented 8 years ago

or maybe the c = and(c1,c2) is best but to handle the negation x negation case the frequency needs to involve max: intersection: Math.max(and(f1, f2), and(1-f1, 1-f2)) union: Math.max(or(f1, f2), or(1-f1, 1-f2))

automenta commented 8 years ago

err intersection: Math.max(and(f1, f2), 1-and(1-f1, 1-f2)) union: Math.max(or(f1, f2), 1-or(1-f1, 1-f2)) etc

automenta commented 8 years ago

n/m that doesnt make sense either

pei2nars commented 8 years ago

The NAL spec function is a previous version that tried to handle all the cases together. The function in the new version in the NAL book (which is the current code) separate the two-premise case from the one-premise cases, and is conceptually simpler and practically equivalent -- when all the rules are used, the choice rule will prefer the more confident conclusion, so no additional max operator is needed.

On Mon, Aug 1, 2016 at 5:58 AM, automenta notifications@github.com wrote:

https://github.com/opennars/opennars2/blob/2.0.0_postdev1/src/nal/deriver/truth.clj#L101

(t-and c1 c2)

https://github.com/opennars/opennars2/blob/2.0.0_postdev1/docs/NAL-spec/NAL-3.tex#L206

c &=& or(and(not(f_1), c_1), and(not(f_2), c_2)) + and(f_1, c_1, f_2, c_2)

the preceding paragraph in the NAL spec explains:

When T 1 and T 2 are either highly similar or opposite to each other, the compound terms produced by these rules may not have much practical value. However, even when it happens, it is an issue to be handled by inference control, not by logic. In the confidence functions, each case for the conclusion to reach its maximum is separately considered. The plus operator is used in place of an or operator, because the two cases involved are mutually exclusive, rather than independent of each other.

i had suspected a symmetric form of this function was missing for negated cases of certain truth functions. not only is the code missing the negated case, inconsistent for the positive case, but i see a possible mistake written for the unimplemented negated case. taking the intersection case as an example

c = or(and(not(f 1 ), c 1 ), and(not(f 2 ), c 2 )) + and(f 1 , c 1 , f 2 , c 2 )

the first component of this formula alone can produce confidence values higher than its conf inputs (ex: two 90% conf inputs producing a 98% conf output in one test case). no other truth functions compute a confidence combining freq and conf in an or( ) in this way.

my guess is that that '+' actually means max as the explanation seems to suggest, and that one of these variations will produce more reasonable confidence values for the various positive and negative combinations.

max(and(f1, f2, c1, c2), and( 1-f1, c1, 1-f2, c2 )) max(and(f1, f2, c1, c2), and( or(1-f1, 1-f2), c1, c2 ))

otherwise please clarify the documentation and/or why the code seems inconsistent for these functions (including opennars 1.x)

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/opennars/opennars2/issues/62, or mute the thread https://github.com/notifications/unsubscribe-auth/AHxfsRXTlufHoNw9VWP10Li1mdtAp46dks5qbe2KgaJpZM4JZjnz .

automenta commented 8 years ago

ok, thanks