OverviewFilesCommitsIssuesDocsReleasesPeers

opencog-agents commits / 75e9992

Filter out the MI value
75e9992362595f082b1baf1ee9286f5b2e2ae7d4
by Linas Vepštas <linasvepstas@gmail.com> · 2024-05-14T05:01:18.000Z

Changed files (1) +32 -0

scm/pair-agent/generate-agent.scm +32 -0
……@@ -47,6 +47,38 @@
4747
4848(cog-value (car (cog-value->list next-edges)) (Predicate "*-Mutual Info Key-*"))
4949
50; Run the query, pull off the MI
51(define (make-mipr-list START)
52 (Filter
53 (Rule
54 (Variable "edge")
55 (Variable "edge")
56 (ValueOf (Variable "edge") (Predicate "*-Mutual Info Key-*")))
57 (make-next-edge-qry START)))
5058
59(define next-mi
60 (cog-execute! (make-mipr-list (Word "start"))))
61
62(length (cog-value->list next-mi))
63(car (cog-value->list next-mi))
64
65; The MI is the second item. Use Decimate to pull it out.
66(define (make-mi-list START)
67 (Filter
68 (Rule
69 ; Some pairs didn't have a valid MI on them! Why ???
70 (TypedVariable (Variable "mi-pair") (Type 'FloatValue))
71 (Variable "mi-pair")
72 (Decimate (Number 0 1) (Variable "mi-pair")))
73 (make-mipr-list START)))
74
75(define next-mi
76 (cog-execute! (make-mi-list (Word "start"))))
77
78(length (cog-value->list next-mi))
79(car (cog-value->list next-mi))
80
81; Fails due to typechecking
82(cog-execute! (Accumulate (make-mi-list (Word "start"))))
5183
5284