MOSES for Noobs - Logic Gates

From OpenCog
Jump to: navigation, search

Description

This page will attempt to explain how to use MOSES in an even simpler way than described on the MOSES Tutorial page. If you feel this tutorial is too simple for you, please check that page.

Before you start, you may want to take a look at the MOSES terminology, and maybe browse through the MOSES man page.

Prerequisites

This page has the following prerequisites:

Contents

This tutorial expands on the previous MOSES for Noobs tutorial by letting MOSES learn logic gates (AND, OR, XOR, etc.).

Running MOSES

The files you can use are available below

To let MOSES process a file, put the file somewhere you can let MOSES find it, and then include it in the command line. Assuming you put it in a subfolder called Logic, it would be

moses -i Logic/AND.txt -w1

The w1 parameter tells MOSES to use the column names found in the file in the generation of output, rather than just assigning indexes to all the input and output variables.

Understanding the output

The output should be something like

0 and($foo $bar) 
-1 $foo 
-1 $bar 
-2 and(!$foo !$bar) 
-2 and(!$foo $bar) 
-2 and($foo !$bar) 
-2 or(!$foo $bar) 
-2 or($foo !$bar) 
-2 or($foo $bar) 
-3 true 

Each line first gives a score for how well the generated program approximates the target feature (0 is perfect, anything lower is worse). Behind the score it will output the COMBO program it used to achieve the score.

The highest scoring program is on the first line. The 0 indicates there is 0 distance between the target feature we wanted the program to approximate and the actual output of this program. As we can see it takes both input parameters, applies the AND operator, and achieves a perfect score for every case in our input file.

Next Steps

Feel free to run MOSES on all the files provided above to see how smart it is. When you're done with that, you could move on to MOSES for Noobs - Flowers.

Q&A

Any questions?

Then please leave them here.