-
Notifications
You must be signed in to change notification settings - Fork 31
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Some equivalent Atomese program representations for manipulation and evaluation #11
Comments
; get the node containing the row name from the row 'R' [(car row)] (define (rowname R) ....) ; this yields a list containing the values of each features ; for a given row 'R' [(cdr row)] (define (row R) ....) ; get all the features as List of Variable Nodes from the problem data (define (featureVariables problemData) ....) ; this is the program over all the features (DefineLink (DefinedSchemaNode "programOne") (Lambda (VariableList (ExecutionOutputLink (GroundedSchemaNode "featureVariables") (Node "ProblemData"))) (Plus (VariableNode "$f1") (VariableNode "$f2")))) ; get Domain (DefineLink (DefinedSchemaNode "domain") (SetLink (ListLink (Node "r1") (ListLink (Number 1) (Number 0))) (ListLink (Node "r2") (ListLink (Number 0) (Number 1))))) ; this is the unfolding of the program (PutLink (VariableNode "$R") (ListLink (ExecutionOutputLink (GroundedSchemaNode "rowname") (VariableNode "$R")) (ExecutionOutputLink (DefinedSchemaNode "programOne") (ExecutionOutputLink (GroundedSchemaNode "row") (VariableNode "$R")))) (DefinedSchemaNode "domain")) This could be an alternative for the second unfolding, but as you can see it has some problems already. For instance in order to have a generic program that works on a generic domain I needed to have a procedure to declare the variable names "featureVariables" and that wont work because VariableList can't be created from List containing VariableNodes and it may not be a good way to do this in general hopefully you will have better ideas. |
That's a possible alternative. A few comments
|
Overview
This issue contains some considerations regarding various ways Atomese
programs could be represented, manipulated and evaluated.
Warning: it is not a plan for immediate actions, just some considerations.
Motivation
As suggested by @Bitseat in order to avoid hacking too much the
atomese interpreter
https://github.com/opencog/atomspace/blob/master/opencog/atoms/execution/Instantiator.h#L141
an option would be to unfold an Atomese program to be readily
interpretable by
Instantiator::execute
.For instance given the data set represented as
and the combo program
It could be unfolded into
which passed to the Atomese interpreter would return the desired
result
However I'm thinking we can probably take a middle ground approach
where the unfolding would be much lighter and wouldn't involve hacking
the interpreter so that
Plus
, etc would support higher level inputs(which ultimately is probably fine and desired, but since we are in an
exploratory stage we want to avoid too much potentially unnecessary
and complicated hacking). Also, I suspect that this sort of
lightweight unfolding will be beneficial for subsequent Atomese
program processing, such as finding patterns in a population of
programs and evaluating them on new inputs.
Proposal
So here it goes, for instance given
(Plus (Schema "i1") (Schema "i2"))
, the first level of unfolding could be (using unimplementedFunMapLink
)where
FunMap
is to be distinguished fromhttp://wiki.opencog.org/w/MapLink as it doesn't assume that its first
argument is a pattern but rather a function, and thus has the same
semantics as
https://hackage.haskell.org/package/base-4.11.1.0/docs/Prelude.html#v:map
or in scheme
https://srfi.schemers.org/srfi-1/srfi-1.html#FoldUnfoldMap
And
Domain
is just something that retrieves the row names,r1
tor3
, and should probably be writtenbut is just written
(Domain)
here for simplicity.So written in a more casual functional program style it would be
Alternatively, as suggested by @kasimebrahim, one could use
PutLink
The next unfolding, which is probably the most interesting is
because it exposes the heart of the program
then links it to the inputs
i1
andi2
, via usingPut
, thenapplies to the domain
r1
tor3
. The good thing about thisrepresentation is that it allows to abstract away the features (which
can be better to reason about some patterns), and it also makes it
easier to evaluate it on new inputs, because you only need to change
one place
(Domain)
by say(NewDomain)
to express that simply.The text was updated successfully, but these errors were encountered: