singnet / asmoses

Port of MOSES (https://github.com/opencog/moses) for the AtomSpace (https://github.com/opencog/atomspace)
Other
6 stars 5 forks source link

Deme representation in atomese #103

Open ngeiswei opened 5 years ago

ngeiswei commented 5 years ago

Overview

The idea is to represent the deme in Atomese. In other words the result from calling build_knobs from representation should create an atomese program representation the exemplar decorated with knobs. Then running this atomese program with the right arguments (i.e. knob settings) should instantiate a candidate.

Why

Deme representation is a crucial part of MOSES, it is not done randomly and must have properties such as maximizing candidate expressiveness and density, etc. By having the representation in atomese it is a first step towards being able to improve upon that step via meta-learning, or automate the process of building a representation for new operators, etc.

Initial Suggestion of Representation

Here is an example of representation, not necessarily the final one but I think it could look like that this.

Textual representation:

(And [P (Not P)] [Q (Not Q)])

this prototype (aka representation) has 2 knobs, the first one can be set to P or (Not P), and the second one can be set to Q or (Not Q). The suggested Atomese representation would be

(Lambda
  (VariableList
    (TypedVariable
      (Variable "$kb1-pos")
      (Type "NumberNode"))
    (TypedVariable
      (Variable "$kb2-pos")
      (Type "NumberNode")))
  (Put
    (VariableList
      (Variable "$kb1")
      (Variable "$kb2"))
    (And
      (Variable "$kb1")
      (Variable "$kb2"))
    (List
      (Cond
        (Equal (Variable "$kb1-pos" (Number 0)) (Predicate "P")
        (Equal (Variable "$kb1-pos" (Number 1)) (Not (Predicate "P")))
      (Cond
        (Equal (Variable "$kb2-pos" (Number 0)) (Predicate "Q")
        (Equal (Variable "$kb2-pos" (Number 1)) (Not (Predicate "Q"))))))

Side note: I wonder if we don't want to introduce a plain switch-case link, that would simplify the representation a bit. But that can be done later on, once we settle on the correct representation.

Task

The first task is gonna be to test and refine such representation. I suggest to run asmoses on some demo problem such as pa and build at hand the atomese representations of the first few prototypes to see if that representation holds up in practice. Then run these atomese representation (given knob settings in arguments) to see if they indeed produce the desired candidates.

Then, once this testing phase results in a correct representation, then port build_knobs accordingly.

ngeiswei commented 5 years ago

There's a case operator in scheme https://www.gnu.org/software/mit-scheme/documentation/mit-scheme-ref/Conditionals.html, looks like having a CaseLink would make sense.