Commit 84f08755 authored by josd's avatar josd

refresh

parent 4a9452a6
============================
Case Control Data processing
============================
The tests are at http://josd.github.io/eye/reasoning/ccd/test
#!/bin/bash
eye --nope --turtle http://josd.github.io/eye/reasoning/ccd/train_data.n3 --n3 http://josd.github.io/eye/reasoning/ccd/train_rules.n3 --query http://josd.github.io/eye/reasoning/ccd/train_query.n3 > train_model.n3
eye --nope --turtle http://josd.github.io/eye/reasoning/ccd/test_data.n3 --turtle http://josd.github.io/eye/reasoning/ccd/train_model.n3 --query http://josd.github.io/eye/reasoning/ccd/test_query.n3 > test_answer.n3
#Processed by EYE v18.1130.1238 josd #Processed by EYE v18.1130.1238 josd
#eye --nope --turtle http://josd.github.io/eye/reasoning/pop/test_data.n3 --turtle http://josd.github.io/eye/reasoning/pop/train_model.n3 --query http://josd.github.io/eye/reasoning/pop/test_query.n3 #eye --nope --turtle test_data.n3 --turtle train_model.n3 --query test_query.n3
PREFIX list: <http://www.w3.org/2000/10/swap/list#> PREFIX list: <http://www.w3.org/2000/10/swap/list#>
PREFIX math: <http://www.w3.org/2000/10/swap/math#> PREFIX math: <http://www.w3.org/2000/10/swap/math#>
...@@ -7,11 +7,11 @@ PREFIX log: <http://www.w3.org/2000/10/swap/log#> ...@@ -7,11 +7,11 @@ PREFIX log: <http://www.w3.org/2000/10/swap/log#>
PREFIX e: <http://eulersharp.sourceforge.net/2003/03swap/log-rules#> PREFIX e: <http://eulersharp.sourceforge.net/2003/03swap/log-rules#>
PREFIX : <http://josd.github.io/eye/reasoning#> PREFIX : <http://josd.github.io/eye/reasoning#>
(_:t_0 ((:input1 "xyz" 2) (:input3 (0 1) 1) (:input4 :v4 1) (:input5 "a" 1))) :answer (:output1 1 :expected 1 :belief 0.639065476705968 _:t_0). (_:t_0 ((:input1 "xyz" 1.9999999999999996) (:input3 (0 1) 1.0) (:input4 :v4 0.9999999999999998) (:input5 "a" 0.9999999999999998))) :answer (:output1 1 :expected 1 :belief 0.6390654767059678).
(_:t_1 ((:input1 "abc" 0.6666666666666666) (:input2 60 0.5) (:input4 :v3 0.5) (:input5 "a" 1))) :answer (:output1 0 :expected 0 :belief 0.8714226345299032 _:t_1). (_:t_1 ((:input1 "abc" 0.6666666666666666) (:input2 60 0.5) (:input4 :v3 0.5) (:input5 "a" 0.9999999999999998))) :answer (:output1 0 :expected 0 :belief 0.8714226345299032).
(_:t_2 ((:input1 "xyz" 2) (:input5 "a" 1))) :answer (:output1 1 :expected 1 :belief 0.6529946561177041 _:t_2). (_:t_2 ((:input1 "xyz" 1.9999999999999996) (:input2 40 1.3510798882111488e+16) (:input5 "a" 0.9999999999999998))) :answer (:output1 1 :expected 1 :belief 1.0).
(_:t_3 ((:input3 (0 1) 1) (:input4 :v3 0.5))) :answer (:output1 0 :expected 0 :belief 0.6800639260090449 _:t_3). (_:t_3 ((:input3 (0 1) 1.0) (:input4 :v3 0.5))) :answer (:output1 0 :expected 0 :belief 0.6800639260090449).
#2018-12-05T21:45:17.961Z in=47 out=4 ent=0 step=0 brake=1 inf=22963 sec=0.037 inf/sec=620622 #2018-12-06T22:11:03.987Z in=53 out=4 ent=0 step=0 brake=1 inf=24811 sec=0.081 inf/sec=306309
#ENDS #ENDS
...@@ -5,11 +5,11 @@ PREFIX e: <http://eulersharp.sourceforge.net/2003/03swap/log-rules#> ...@@ -5,11 +5,11 @@ PREFIX e: <http://eulersharp.sourceforge.net/2003/03swap/log-rules#>
PREFIX : <http://josd.github.io/eye/reasoning#> PREFIX : <http://josd.github.io/eye/reasoning#>
{ {
(?S ?IL) :answer (:output1 ?OV :expected ?U :belief ?B ?S). (?S ?IL) :answer (:output1 ?OV :expected ?U :belief ?B).
} <= { } <= {
?S :output1 ?U. ?S :output1 ?U.
?SCOPE e:findall ( ?SCOPE e:findall (
(?P ?O ?X) (?P ?O ?D)
{ {
( (
:input1 :input1
...@@ -19,13 +19,15 @@ PREFIX : <http://josd.github.io/eye/reasoning#> ...@@ -19,13 +19,15 @@ PREFIX : <http://josd.github.io/eye/reasoning#>
:input5 :input5
) list:member ?P. ) list:member ?P.
?S ?P ?O. ?S ?P ?O.
(?P ?O) :odds ?X. (?P ?O) :model (?C ?N).
(?N e:epsilon) math:sum ?M.
(?C ?M) math:quotient ?D.
} }
?IL ?IL
). ).
?SCOPE e:findall ((?X 0.97) {?IL list:member (?P ?O ?X)} ?XL). ?SCOPE e:findall ((?D 0.97) {?IL list:member (?P ?O ?D)} ?DL).
?XL list:append ?XA. ?DL list:append ?DA.
?XA math:product ?BN. ?DA math:product ?BN.
(?BN 1) math:sum ?BD. (?BN 1) math:sum ?BD.
(?BN ?BD) math:quotient ?Q. (?BN ?BD) math:quotient ?Q.
?SCOPE e:optional {?Q math:greaterThan 0.5. (?OV ?B) log:equalTo (1 ?Q)}. ?SCOPE e:optional {?Q math:greaterThan 0.5. (?OV ?B) log:equalTo (1 ?Q)}.
......
#Processed by EYE v18.1130.1238 josd #Processed by EYE v18.1130.1238 josd
#eye --nope --turtle http://josd.github.io/eye/reasoning/pop/train_data.n3 --turtle http://josd.github.io/eye/reasoning/pop/train_ground.n3 --query http://josd.github.io/eye/reasoning/pop/train_model_query.n3 #eye --nope --turtle train_data.n3 --n3 train_rules.n3 --query train_query.n3
PREFIX list: <http://www.w3.org/2000/10/swap/list#> PREFIX list: <http://www.w3.org/2000/10/swap/list#>
PREFIX math: <http://www.w3.org/2000/10/swap/math#> PREFIX math: <http://www.w3.org/2000/10/swap/math#>
PREFIX e: <http://eulersharp.sourceforge.net/2003/03swap/log-rules#> PREFIX e: <http://eulersharp.sourceforge.net/2003/03swap/log-rules#>
PREFIX : <http://josd.github.io/eye/reasoning#> PREFIX : <http://josd.github.io/eye/reasoning#>
(:input1 "abc") :odds 0.6666666666666666 . (:input1 "abc") :model (2 3).
(:input1 "xyz") :odds 2 . (:input1 "xyz") :model (2 1).
(:input2 60) :odds 0.5 . (:input2 40) :model (3 0).
(:input3 (0 1)) :odds 1 . (:input2 60) :model (2 4).
(:input3 (2 3)) :odds 0.3333333333333333 . (:input3 (0 1)) :model (2 2).
(:input4 :v2) :odds 1 . (:input3 (2 3)) :model (1 3).
(:input4 :v4) :odds 1 . (:input4 :v1) :model (2 0).
(:input4 :v3) :odds 0.5 . (:input4 :v2) :model (1 1).
(:input5 "a") :odds 1 . (:input4 :v4) :model (1 1).
(:input4 :v3) :model (1 2).
(:input5 "b") :model (2 0).
(:input5 "c") :model (0 3).
(:input5 "a") :model (1 1).
#2018-12-05T21:45:17.495Z in=78 out=9 ent=9 step=9 brake=2 inf=24849 sec=0.038 inf/sec=653921 #2018-12-06T22:11:03.864Z in=66 out=13 ent=13 step=82 brake=2 inf=27679 sec=0.086 inf/sec=321849
#ENDS #ENDS
PREFIX math: <http://www.w3.org/2000/10/swap/math#>
PREFIX e: <http://eulersharp.sourceforge.net/2003/03swap/log-rules#>
PREFIX : <http://josd.github.io/eye/reasoning#>
{
(?IN ?IV) :model (?C ?N).
} <= {
(?IN ?IV) a :Input.
?SCOPE e:findall (1 {?CASE ?IN ?IV; :output1 1} ?CL).
?SCOPE e:findall (1 {?CASE ?IN ?IV; :output1 0} ?NL).
?CL math:sum ?C.
?NL math:sum ?N.
}.
...@@ -11,5 +11,5 @@ PREFIX : <http://josd.github.io/eye/reasoning#> ...@@ -11,5 +11,5 @@ PREFIX : <http://josd.github.io/eye/reasoning#>
) list:member ?IN. ) list:member ?IN.
?S ?IN ?IV. ?S ?IN ?IV.
} => { } => {
?IN :ground ?IV. (?IN ?IV) a :Input.
}. }.
==========================
Predictive Odds Processing
==========================
The tests are at http://josd.github.io/eye/reasoning/pop/test
#!/bin/bash
eye --nope --turtle http://josd.github.io/eye/reasoning/pop/train_data.n3 --query http://josd.github.io/eye/reasoning/pop/train_ground_query.n3 > train_ground.n3
eye --nope --turtle http://josd.github.io/eye/reasoning/pop/train_data.n3 --turtle http://josd.github.io/eye/reasoning/pop/train_ground.n3 --query http://josd.github.io/eye/reasoning/pop/train_model_query.n3 > train_model.n3
eye --nope --turtle http://josd.github.io/eye/reasoning/pop/test_data.n3 --turtle http://josd.github.io/eye/reasoning/pop/train_model.n3 --query http://josd.github.io/eye/reasoning/pop/test_query.n3 > test_answer.n3
#Processed by EYE v18.1130.1238 josd
#eye --nope --turtle http://josd.github.io/eye/reasoning/pop/train_data.n3 --query http://josd.github.io/eye/reasoning/pop/train_ground_query.n3
PREFIX list: <http://www.w3.org/2000/10/swap/list#>
PREFIX : <http://josd.github.io/eye/reasoning#>
:input1 :ground "abc".
:input1 :ground "xyz".
:input2 :ground 40 .
:input2 :ground 60 .
:input3 :ground (0 1).
:input3 :ground (2 3).
:input4 :ground :v1.
:input4 :ground :v2.
:input4 :ground :v4.
:input4 :ground :v3.
:input5 :ground "b".
:input5 :ground "c".
:input5 :ground "a".
#2018-12-05T21:45:17.111Z in=55 out=13 ent=13 step=41 brake=1 inf=21870 sec=0.030 inf/sec=729000
#ENDS
PREFIX math: <http://www.w3.org/2000/10/swap/math#>
PREFIX e: <http://eulersharp.sourceforge.net/2003/03swap/log-rules#>
PREFIX : <http://josd.github.io/eye/reasoning#>
# inputs I whereby all i are mutually independent
# output O whereby sum(O) = sum(not(O))
# odds(i, O) = sum(and(i, O))/sum(and(i, not(O)))
{
?IN :ground ?IV.
?SCOPE e:findall (1 {?CASE ?IN ?IV; :output1 1} ?XNL).
?SCOPE e:findall (1 {?CASE ?IN ?IV; :output1 0} ?XDL).
?XNL math:sum ?XN.
?XDL math:sum ?XD.
?XN math:greaterThan 0.
?XD math:greaterThan 0.
(?XN ?XD) math:quotient ?X.
} => {
(?IN ?IV) :odds ?X.
}.
...@@ -5,6 +5,7 @@ function reasoning { ...@@ -5,6 +5,7 @@ function reasoning {
pushd bi; ./test "$@"; git diff -U0 . | grep -E -v '^diff|^index|^Binary|^--|^\+-|\+\+|^@@|#Processed by|#DONE|in=|#ENDS' >> ../reasoning.diff; popd pushd bi; ./test "$@"; git diff -U0 . | grep -E -v '^diff|^index|^Binary|^--|^\+-|\+\+|^@@|#Processed by|#DONE|in=|#ENDS' >> ../reasoning.diff; popd
pushd bmi; ./test "$@"; git diff -U0 . | grep -E -v '^diff|^index|^Binary|^--|^\+-|\+\+|^@@|#Processed by|#DONE|in=|#ENDS' >> ../reasoning.diff; popd pushd bmi; ./test "$@"; git diff -U0 . | grep -E -v '^diff|^index|^Binary|^--|^\+-|\+\+|^@@|#Processed by|#DONE|in=|#ENDS' >> ../reasoning.diff; popd
pushd bmt; ./test "$@"; git diff -U0 . | grep -E -v '^diff|^index|^Binary|^--|^\+-|\+\+|^@@|#Processed by|#DONE|in=|#ENDS' >> ../reasoning.diff; popd pushd bmt; ./test "$@"; git diff -U0 . | grep -E -v '^diff|^index|^Binary|^--|^\+-|\+\+|^@@|#Processed by|#DONE|in=|#ENDS' >> ../reasoning.diff; popd
pushd ccd; ./test "$@"; git diff -U0 . | grep -E -v '^diff|^index|^Binary|^--|^\+-|\+\+|^@@|#Processed by|#DONE|in=|#ENDS' >> ../reasoning.diff; popd
pushd crypto; ./test "$@"; git diff -U0 . | grep -E -v '^diff|^index|^Binary|^--|^\+-|\+\+|^@@|#Processed by|#DONE|in=|#ENDS' >> ../reasoning.diff; popd pushd crypto; ./test "$@"; git diff -U0 . | grep -E -v '^diff|^index|^Binary|^--|^\+-|\+\+|^@@|#Processed by|#DONE|in=|#ENDS' >> ../reasoning.diff; popd
pushd cs; ./test "$@"; git diff -U0 . | grep -E -v '^diff|^index|^Binary|^--|^\+-|\+\+|^@@|#Processed by|#DONE|in=|#ENDS' >> ../reasoning.diff; popd pushd cs; ./test "$@"; git diff -U0 . | grep -E -v '^diff|^index|^Binary|^--|^\+-|\+\+|^@@|#Processed by|#DONE|in=|#ENDS' >> ../reasoning.diff; popd
pushd csv; ./test "$@"; git diff -U0 . | grep -E -v '^diff|^index|^Binary|^--|^\+-|\+\+|^@@|#Processed by|#DONE|in=|#ENDS' >> ../reasoning.diff; popd pushd csv; ./test "$@"; git diff -U0 . | grep -E -v '^diff|^index|^Binary|^--|^\+-|\+\+|^@@|#Processed by|#DONE|in=|#ENDS' >> ../reasoning.diff; popd
...@@ -37,7 +38,6 @@ function reasoning { ...@@ -37,7 +38,6 @@ function reasoning {
pushd nbbn; ./test "$@"; git diff -U0 . | grep -E -v '^diff|^index|^Binary|^--|^\+-|\+\+|^@@|#Processed by|#DONE|in=|#ENDS' >> ../reasoning.diff; popd pushd nbbn; ./test "$@"; git diff -U0 . | grep -E -v '^diff|^index|^Binary|^--|^\+-|\+\+|^@@|#Processed by|#DONE|in=|#ENDS' >> ../reasoning.diff; popd
pushd numeral; ./test "$@"; git diff -U0 . | grep -E -v '^diff|^index|^Binary|^--|^\+-|\+\+|^@@|#Processed by|#DONE|in=|#ENDS' >> ../reasoning.diff; popd pushd numeral; ./test "$@"; git diff -U0 . | grep -E -v '^diff|^index|^Binary|^--|^\+-|\+\+|^@@|#Processed by|#DONE|in=|#ENDS' >> ../reasoning.diff; popd
pushd pi; ./test "$@"; git diff -U0 . | grep -E -v '^diff|^index|^Binary|^--|^\+-|\+\+|^@@|#Processed by|#DONE|in=|#ENDS' >> ../reasoning.diff; popd pushd pi; ./test "$@"; git diff -U0 . | grep -E -v '^diff|^index|^Binary|^--|^\+-|\+\+|^@@|#Processed by|#DONE|in=|#ENDS' >> ../reasoning.diff; popd
pushd pop; ./test "$@"; git diff -U0 . | grep -E -v '^diff|^index|^Binary|^--|^\+-|\+\+|^@@|#Processed by|#DONE|in=|#ENDS' >> ../reasoning.diff; popd
pushd pptbank; ./test "$@"; git diff -U0 . | grep -E -v '^diff|^index|^Binary|^--|^\+-|\+\+|^@@|#Processed by|#DONE|in=|#ENDS' >> ../reasoning.diff; popd pushd pptbank; ./test "$@"; git diff -U0 . | grep -E -v '^diff|^index|^Binary|^--|^\+-|\+\+|^@@|#Processed by|#DONE|in=|#ENDS' >> ../reasoning.diff; popd
pushd preduction; ./test "$@"; git diff -U0 . | grep -E -v '^diff|^index|^Binary|^--|^\+-|\+\+|^@@|#Processed by|#DONE|in=|#ENDS' >> ../reasoning.diff; popd pushd preduction; ./test "$@"; git diff -U0 . | grep -E -v '^diff|^index|^Binary|^--|^\+-|\+\+|^@@|#Processed by|#DONE|in=|#ENDS' >> ../reasoning.diff; popd
pushd restpath; ./test "$@"; git diff -U0 . | grep -E -v '^diff|^index|^Binary|^--|^\+-|\+\+|^@@|#Processed by|#DONE|in=|#ENDS' >> ../reasoning.diff; popd pushd restpath; ./test "$@"; git diff -U0 . | grep -E -v '^diff|^index|^Binary|^--|^\+-|\+\+|^@@|#Processed by|#DONE|in=|#ENDS' >> ../reasoning.diff; popd
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment