OverviewFilesCommitsIssuesDocsReleasesPeers

opencog-agents commits / 713e481

Rename file to design notes
713e48148b44fe54009b9759813c297d97240ac5
by Linas Vepštas <linasvepstas@gmail.com> · 2024-05-14T02:21:32.000Z

Changed files (2) +75 -69

scm/pair-agent/Design-Generate.md +75 -0
……@@ -0,0 +1,75 @@
1Generating output
2=================
3Design notes for generating output text. Two ideas: use LG and use dorky
4pairs.
5
6## LG generation
7Generate text with Link Grammar. This is the correct long-term solution,
8but requires some fair amount of work on the LG side and on the
9`lg-atomese` modules, and here. So for proof-of-concept, just skip this
10for now.
11```
12link-generator -c 4 -k 4 -l en
13link-generator -l en -s 0
14This is * test
15echo 'This \* a te\* of \*.a sentence generation' | time link-generator -l en -s 0 --verbosity=2
16echo 'This is a \*' | time link-generator -l en -s 0 --verbosity=2
17```
18Early versions would take prior string and just add one more star.
19Or maybe two stars. Keep it short.
20
21General issues:
22* Allow link-parser app to special case wild-cards for generation.
23* Loading of entire dict is unfeasible, so...
24 Load only possible links?
25
26Ideas:
27* Parse given word seq containing blanks, use unknown word for
28 blanks, then lookup all words with matching disjuncts. This
29 requires:
30* Allow dict lookup of words according to desired disjuncts.
31
32
33OK, screw that. The diary part ten is exploring this, here are the best
34ideas in summary form:
35
361) Starting with a word A, use incoming set to randomly select some
37subset of all possible edges. This will be called the "focus set" or the
38"attentional focus". Because it is small, it can be exhaustively
39iterated and sorted into high-to-low MI order. This provides a weighted
40distribution, from which a rescaled uniform-random choice can be made.
41
422) Random sample N out of full incoming set.
43
44Lets steam-process this: Query returns list of edges
45 (Query (Variable "next") ; vardecl
46 (EdgeLink (Predicate "ANY")
47 (List (Word "start") (Variable "next"))))
48
49This returns a list (a short list? where do we plug in N to cap the size?)
50The list is actually a QueueValue.
51
523) Out of this queue Value, select one, with the proper weighting.
53 Treating this as a collection of priors requires a sum over all elts
54 in the queue, to obtain a total norm, and then making a second pass
55 to choose one for this weighted distribution. This requires a
56 "non-local" RAM-walking sum.
57
58A local way of doing this is to pick a min-MI cutoff, and selecting the
59first elt that is above the cutoff.
60
61A quasi-local way is to take the average of the first three elts,
62the first K elts, and then accept the first that is above this average.
63So the first K are always discarded, until the moving average is arrived
64at.
65
66This needs:
674) Atomese to fish out/Filter the MI from the correct location
68 and or compute it on the fly.
69
70 Atomese to compute a moving average.
71
72What is the minimal way to do this?
73Can it be done so that MOSES can be applied to tune it?
74
75Ugh.
scm/pair-agent/generate-agent.scm +0 -69
……@@ -1,69 +0,0 @@
1;
2; generate-agent.scm
3; Generate text
4;
5; link-generator -c 4 -k 4 -l en
6; link-generator -l en -s 0
7; This is * test
8; echo 'This \* a te\* of \*.a sentence generation' | time link-generator -l en -s 0 --verbosity=2
9; echo 'This is a \*' | time link-generator -l en -s 0 --verbosity=2
10;
11; Early versions would take prior string and just add one more star.
12; Or maybe two.
13;
14; General issues:
15; * Allow link-parser app to special case wild-cards for generation.
16; * Loading of entire dict is unfeasible, so...
17; Load only possible links?
18;
19; Ideas:
20; -- Parse given word seq containing blanks, use unknown word for
21; blanks, then lookup all words with matching disjuncts. This
22; requires:
23; * Allow dict lookup of words according to desired disjuncts.
24;
25;
26OK, screw that. The diary part ten is exploring this, here are the best
27ideas in summary form:
28
291) Starting with a word A, use incoming set to randomly select some
30subset of all possible edges. This will be called the "focus set" or the
31"attentional focus". Because it is small, it can be exhaustively
32iterated and sorted into high-to-low MI order. This provides a weighted
33distribution, from which a rescaled uniform-random choice can be made.
34
352) Random sample N out of full incoming set.
36
37
38Lets steam-process this: Query returns list of edges
39 (Query (Variable "next") ; vardecl
40 (EdgeLink (Predicate "ANY")
41 (List (Word "start") (Variable "next"))))
42
43This returns a list (a short list? where do we plug in N to cap the size?)
44The list is actually a QueueValue.
45
463) Out of this queue Value, select one, with the proper weighting.
47 Treating this as a collection of priors requires a sum over all elts
48 in the queue, to obtain a total norm, and then making a second pass
49 to choose one for this weighted distribution. This requires a
50 "non-local" RAM-walking sum.
51
52A local way of doing this is to pick a min-MI cutoff, and selecting the
53first elt that is above the cutoff.
54
55A quasi-local way is to take the average of the first three elts,
56the first K elts, and then accept the first that is above this average.
57So the first K are always discarded, until the moving average is arrived
58at.
59
60This needs:
614) Atomese to fish out/Filter the MI from the correct location
62 and or compute it on the fly.
63
64 Atomese to compute a moving average.
65
66What is the minimal way to do this?
67Can it be done so that MOSES can be applied to tune it?
68
69Ugh.