-
Notifications
You must be signed in to change notification settings - Fork 234
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
Eager Execution in PutLink #2546
Comments
Let me look at this over the next few days. A lot of work went into removing eager execution everywhere, it would be a shame to put it back in. |
actually, after a quick look, why do you need the put link at all? It appears to serve no purpose whatsoever. Just manually plug the CondLink into the $args (for which you used a glob node for some reason -- glob nodes don't really make sense with put links anyway. (well, they sort-of do, but I don't think that's been implemented at all). ) Again, just perform the reduction by hand, so that you have a lambda link, and that's it, nothing more to do .. ... |
Thanks @linas.
The reason is as you know the
Similarly I used
I dont understand that one could you explain it a bit? |
There's some misunderstanding.
That is impossible -- atoms are immutable, and once they've been created, they can never be changed again. They can only be deleted. So everything inside of that PutLink is 100% static, and can never change. Ever. Its frozen, once and for all.
Beta reduction is algorithmic, mechanical. Just perform those steps with pencil and paper. You only need to do it once, because the Atoms are immutable, so you can never get any result other than that one result. From what I can tell, the Lambda that you wrote is equivalent to this (although, in this form, there seem to be problems... its not well-formed)
|
... I see what you are doing there. I think there are some minor typos in the expression, I think what you actually wanted was this:
Now it's clear -- there are two knobs. Each knob either repeats, or negates the expression. |
That is correct. let me rephrase. It is not changed it is recreated. Based on whether a new knob could result in higher|equal complexity value after reduction is applied, we recreate a new atomese with the new knob.
that is correct. |
So, is the last thing that I wrote -- is that what you wanted, or did you want something else? |
Let me have another look and I will get back. In general this is what I am working on if we have We start from the
finally we recurse through the out going set of the |
@linas, so I thought about the above solution. As of my current understanding I can't use that at least with c++, since it requires some kind of meta-programing (because I will need more of that |
OK, well, you are missing one important step: actually using the resulting tree. That is, picking some knob values, and running the tree over a table of inputs. There are two ways to do this. One way:
The other way:
These have different performance profiles. Fist one has:
The second has
It is always the case that CPU(run knobby-tree over data) > CPU(run knobless tree over data) and it is always the case that CPU(create knob-less tree)==large. So the first way is much slower if your data tables are small. But if the data is huge, then the cost of building the knob-less tree is worth it. If I remember correctly, moses does the first. Not sure. The first way is more complicated - requires more code to write. ... |
Yes, that is the last and the important part. As you said moses uses the first. On the new atomese representation though we can use the second way. Since the representation is a program that takes knob settings, for now to get the candidate program(with out the knobs) what we do is just execute it with the knob settings(instance). And in asmoses to evaluate programs with the input tables first we populate the input table in the atomspace as Values[actually this is done once just after the moses problem type is identified], Then we just call the atomese interpreter on the candidate program. So if we can move the as-moses atomese interpreter to atomspace(gracefully) we can perform both processes in just one execution step. |
OK, so: The lambda I gave you. it creates the simplified tree. Try it.
Ooops -- looks like there's a bug in CondLink: (I'll try to fix shortly after posting this) I get:
so just take that, execute it a second time (for now, till bug is fixed) and that is now your simplified tree. So simplification is .. not that hard. After the second simplification I get:
|
OK, Just fixed the CondLink so that the double-execute is not needed. Pull req shortly. Can you describe how/where the table is stored? Were you planning to use |
CondLink was incomplete in reducing things.
@linas, With a few changes on my representation code and your fix on the condlink I managed to remove the PutLink. I now have a fully working representation. Thanks for the help!
For table based problems in so what So at the time of fitness evaluation we add the program to the atomspace and call the as-moses interpreter. So this has also enabled as to memoize the interpretation. A program or a subprogram won't get interpreted twice.
We didn't thought of using |
I didn't quite get it...
I guess it adds a
Well, :-) you don't need to do that, any more. The whole point of
which should return a column of 0's and 1's, whenever A>B+C row by row. The PlusLink, etc were designed to replace the moses interpreter. They mostly work. Even reduct works .. so for example
should correctly reduce to exactly just |
Closing, see #66 |
I am working on an atomese representation for asmoses. The representation I have is an atomese program when executed with knob settings as an argument it gives the candidate program.
Here is an atomese representation equivalent to the combo representation
[and !and]($a [$b !$b])
.Now the problem is if I execute the above the program I get is not fully reduced.
What is going on is
ExecutionOutPutLink
executes it til it doesn't get executable atom, which in this case is satisfied with theAndLink
. So in order to get that CondLink executed we need to add eager execution to PutLink.Adding something like this in PutLink:do_reduce should fix it.
If you approve the above fix or if you have other suggestion let me know, I will work on it.
If you have thoughts on the whole representation I will be happy to hear it. here is the link for the code in progress https://github.com/kasimebrahim/asmoses/tree/atomese-representation it has some useless UTests for now.
And of course, since the real representation if far more complected than the above example in order to simplify the construction I had to introduce two types to represent knobs that wrap PutLink and CondLink. The above representation will be this
The text was updated successfully, but these errors were encountered: