OverviewFilesCommitsIssuesDocsReleasesPeers

opencog-matrix commits / 83758fd

Start adding notes
83758fdb4e8edf9a5ffdb499f4a57d85cb5909d8
by Linas Vepštas <linasvepstas@gmail.com> · 2025-02-01T18:10:05.000Z

Changed files (2) +42 -12

design/Design-similarity.md +41 -11
……@@ -10,7 +10,7 @@ The current matrix API provides an extensive set of objects and
1010functions for working with sparse vector embeddings. The vast selection
1111is characteristic of what human programmers wnt and expect when
1212attempting to write code to solve some problem. However, that same
13richness and variety impedes automatition and automatic construction.
13richness and variety impedes automation and automatic construction.
1414
1515Almost all of the matrix API was developed to support one generic
1616problem: obtaining the similarity between two things. Thus, the task at
……@@ -24,9 +24,9 @@ and related to them. They have properties, aspects, relationships to
2424other nearby things. This embedding can be (mathematically) abstracted
2525in several ways:
2626
27* The "thing" is a vertex in a graph, and (labelled) graph edges connect
28 it to other "things". This automatically defines the local
29 neighborhood: anything that is only on edge away is necessarily local.
27* The "thing" is a vertex in a graph, and (labelled) graph edges
28 connect it to other "things". This automatically defines the local
29 neighborhood: anything that is only one edge away is necessarily local.
3030
3131* Edges may be assigned a real number (floating point) weight, giving a
3232 more refined sense of distance.
……@@ -46,10 +46,40 @@ marked, the embedding vectors are already implicit in the graph, and
4646all that was needed was an API to work with these (sparse) vectors.
4747Given a vector API, a cornucopia of similarity measures can be created.
4848
49Conventional Atomese
50--------------------
51Conventional Atomese has C++ classes underneath many of most Atoms;
52those classes provide code that "does stuff". The
53[Design-object-atomese](Design-object-atomese.md) file describes a
54conventioal Atomese approach that can provide a conventional object
55oriented API for working with embedding vectors.
49Queries as Tensors
50------------------
51The original matrix API was invented to work with word-pairs. Each word
52is a vertex; the edge between them forms a word-pair. Given a collection
53of edges, one could think of this as forming an adjacency matrix, with
54the edges being the non-zero entries in the matrix. The edges are
55directed, so the matrix is not symmetric. Any given row or column in the
56matrix is a sparse vector. Given a collection of vectors, there is a
57rich set of mathematical operations that can be applied to them: dot
58products, mutual information, Jacquard and Hamming distances, etc.
59
60To implement the above, the original matrix API used an OO design style
61called "parametric polymorphism", defining a base class API, that all
62higher analysis layers could be stacked on top of. The base class
63consisted of these parts:
64
65 1) Get the types of the left and reight vertexes, and the edge.
66 2) Given an edge, get the left and right vertexes.
67 3) Given the matrix, get left and right marginals (edges with the
68 left or right vertexes replaced by wild-cards).
69 4) A list of all edges.
70 5) Ability to get all edges from a StorageNode
71 6) Delete all edges (and the correspodning entries in a StorageNode)
72
73This API is documented in `object-api.scm` and a concrete example
74appears in `edge-pairs.scm`. The file `object-api.scm` also defines
75the `add-pair-stars` API, which, given the above, adds decorations
76that almost all otherlayers above need. These are:
77
78 7) Lists of the left and right basis elements. The left basis is the
79 set. `{x | (x,y) exists in the atomspace for some y}`
80 8) Size of the left and right basis
81 9) True/false membership predicates: does an Atom appear in the left
82 or right basis set?
83 10) List of the left and right duals to a given Atom. The left dual
84 for a given Atom Y is `{x | (x,Y) given fixed Y}`
85
design/README.md +1 -1
……@@ -1,7 +1,7 @@
11Design Notes
22------------
33This directory contains ideas for ***future design points***, and not
4the current design. The current design is sold, stable, mature and well
4the current design. The current design is solid, stable, mature and well
55debugged, but does not fit into a proper agent framework. The notes
66here attempt to find the appropriate design framework for an agent
77system.