| … | … | @@ -10,7 +10,7 @@ The current matrix API provides an extensive set of objects and |
| 10 | 10 | functions for working with sparse vector embeddings. The vast selection |
| 11 | 11 | is characteristic of what human programmers wnt and expect when |
| 12 | 12 | attempting to write code to solve some problem. However, that same |
| 13 | | richness and variety impedes automatition and automatic construction. |
| 13 | richness and variety impedes automation and automatic construction. |
| 14 | 14 | |
| 15 | 15 | Almost all of the matrix API was developed to support one generic |
| 16 | 16 | problem: obtaining the similarity between two things. Thus, the task at |
| … | … | @@ -24,9 +24,9 @@ and related to them. They have properties, aspects, relationships to |
| 24 | 24 | other nearby things. This embedding can be (mathematically) abstracted |
| 25 | 25 | in several ways: |
| 26 | 26 | |
| 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. |
| 30 | 30 | |
| 31 | 31 | * Edges may be assigned a real number (floating point) weight, giving a |
| 32 | 32 | more refined sense of distance. |
| … | … | @@ -46,10 +46,40 @@ marked, the embedding vectors are already implicit in the graph, and |
| 46 | 46 | all that was needed was an API to work with these (sparse) vectors. |
| 47 | 47 | Given a vector API, a cornucopia of similarity measures can be created. |
| 48 | 48 | |
| 49 | | Conventional Atomese |
| 50 | | -------------------- |
| 51 | | Conventional Atomese has C++ classes underneath many of most Atoms; |
| 52 | | those classes provide code that "does stuff". The |
| 53 | | [Design-object-atomese](Design-object-atomese.md) file describes a |
| 54 | | conventioal Atomese approach that can provide a conventional object |
| 55 | | oriented API for working with embedding vectors. |
| 49 | Queries as Tensors |
| 50 | ------------------ |
| 51 | The original matrix API was invented to work with word-pairs. Each word |
| 52 | is a vertex; the edge between them forms a word-pair. Given a collection |
| 53 | of edges, one could think of this as forming an adjacency matrix, with |
| 54 | the edges being the non-zero entries in the matrix. The edges are |
| 55 | directed, so the matrix is not symmetric. Any given row or column in the |
| 56 | matrix is a sparse vector. Given a collection of vectors, there is a |
| 57 | rich set of mathematical operations that can be applied to them: dot |
| 58 | products, mutual information, Jacquard and Hamming distances, etc. |
| 59 | |
| 60 | To implement the above, the original matrix API used an OO design style |
| 61 | called "parametric polymorphism", defining a base class API, that all |
| 62 | higher analysis layers could be stacked on top of. The base class |
| 63 | consisted 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 | |
| 73 | This API is documented in `object-api.scm` and a concrete example |
| 74 | appears in `edge-pairs.scm`. The file `object-api.scm` also defines |
| 75 | the `add-pair-stars` API, which, given the above, adds decorations |
| 76 | that 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 | |