Skip to content

Commit

Permalink
Merge pull request #57 from opennars/pr_automl1_08022018
Browse files Browse the repository at this point in the history
Auto ML codegen
  • Loading branch information
PtrMan authored Sep 3, 2018
2 parents bd29af9 + b27ee5b commit 0203821
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions src/main/java/org/opennars/lab/codegen/codegenML1.nal
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
' weighted sum of all elements - used all over the place for NN's
' with a compact vector representation because the (NARS-term)complexity is a issue here
<<(*,$1,$2,$3) --> [maddv]> =|> <(*,$1,$2,$3) --> [weighted]>>.

' multiply add $1 = $1 + $2 * $3
< (^pick, {SELF}, madd, $1, $2, $3) =/> <(*, $1, $2, $3) --> [madd]> >.

' multiply add vector, result is $1, vectors are $2 and $3
< (^pick, {SELF}, maddv, $1, $2, $3) =/> <(*, $1, $2, $3) --> [maddv]> >.


' old more simpler example
'<(*, v0, v1, v1) --> [madd]>!
'<(*, v2, v1, v1) --> [madd]>!

' request to generate the code for a weighted sum
<(*, res0, a0, b0) --> [weighted]>!

0 comments on commit 0203821

Please sign in to comment.