-
Notifications
You must be signed in to change notification settings - Fork 54
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
Discussion: Stable and unique identifier / label for each Grounded Atom #427
Comments
I think the first type can be best thought of as "symbols with an algebra on top". The "conceptual hash" can be acheived in a vareity of ways, like flag bits of integers (like Haskell) (or a temporary less messy approach), prefix trees with integer leaves for strings, but the real issue is user-defined types. So even though we may like two types to be distinct, it may not be easy to rely upon for arbitrary grounded atoms. For networked systems, we may also want to look at longer identifiers, like OpenCog classic's UUIDs. There's also the option of being explicit: have a MeTTa function |
That's a very good point! Rather than trying to shoe-horn two conceptually different types of object into |
Yes, though the "functional programming interpretation" would lay the responsibility on the functions. I.e. instead of symbols overwriting (OOP term) it'd be implementing support for symbols. Ultimately the two ways of looking at the problem are equivalent, "extending functions to support" is the MeTTa way, but I wouldn't mind a performant backend diverging from it and just dispatching the right methods. It's worth it to ponder how both options scale to pre-compiled libraries, network stuff, JIT, and more future directions. |
I don't like the idea to mix up symbols and grounded atoms in a hard-coded way. Symbols should be fully interpretable in MeTTa. If you want an algebra over symbols, don't implement it in an opaque way in some imperative language. Implement it in MeTTa. Of course, there are always intermediate cases, when we want both symbol-like behavior and efficient computations. But this can be done in other ways without introducing substructures to symbols. Once again, we already have expressions for describing symbolic structures. |
Based on the above, I go down the following chain of logic. Please correct me if I've made some leaps that don't logically follow. 1.) A Space is fundamentally responsible for keeping track of its atoms Therefore: But a big class of GroundedAtoms should be efficiently indexable in the default Space implementation. So we're back to an optional interface, as was proposed initially. |
I'd say, yes. I'd say, definitely yes, if we consider specific grounded atom types as a part of some space (atm, it is not precisely technically true, but still conceptually true).
I'd say, yes. At best, we can ho have a global ID for all atoms for some concrete default or broadly used type of space (say, DAS, but not necessarily), if this is a particular feature of this space. But I'd say that this should not be the case for the in-RAM space of the interpreter.
Linearly calling it is definitely not scalable. There is a benchmark for a not hashed
Kind of yes. Words are a little bit vague, so it depends on precise meaning of "space is aware".
yes
Yes, but the question is in details. The interface should be optional. Big classes of GroundedAtoms can be responsible for indexing and retrieval. The indexing and retrieval mechanism for such big classes should not be hardcoded in the default Space implementation. It should be kept modular and customarily extensible. Is an index built by a custom GroundedAtom type a part of a Space -- this is where the wordings become a little vague. In any case, there can be a default indexing / querying implementation, which requires only hashes from those GroundedAtom types, which are ok with it. Thus, one can implement just a hash function and be happy. However, the Space querying mechanism should not rely on these hashes. Instead, it should delegate querying to GroundedAtom types. The tricky thing is that adding / removing atoms should also require calling corresponding methods of such GroundedAtom type implementations. One may propose to go further and create another more basic implementation of such a generic class without indexing. In this case, all grounded atom types will have the same (obligatory, but with two default simplified implementations) interface. I'm not sure what are computational overheads and inconveniences in this approach, so I'm not insisting on it. |
Actually this is vague for me. What does "keeping track" specifically means here?
I agree with Alexey's answers above.
It is a question to what degree atomspace should be aware of a structure. I see few different degrees of awareness here:
In the first case we have more universal space implementations and move grounded atoms indexing into a separate abstraction "grounded atom type", but any space can work with any kind of grounded atom. In the second case we have more specific space implementations and handling grounded atoms with different indexing logic under a single space becomes tricky and requires making space implementation more and more complex. Thinking about using DAS in the first case DAS implementation need somehow keep index with unknown structure inside and keep it in a distributed manner which is not possible without additional knowledge about internal index structure. In a second case DAS should implement many indexes for the grounded atoms in a distributed manner. |
adding @andre-senna in the thread |
I am seeing a common theme connecting this thread with #408 , Basically they all come down to names for certain grounded atoms, and when a grounded atom is mixed up with a symbol. This might be controversial, but how about letting grounded atoms have an Optional string name? Spaces resolve symbols matching the name (in the appropriate context) as references to the grounded atom. |
Assigning some name to the atom can be done implementing #134 (and I was going to implement it). Another question is how to construct and add |
Yes
Please, see my comment. While grounded atoms with optional names is a possible partial solution, I believe that we need to take other aspects into consideration. From the AGI-ish / cognitive architecture perspective, both symbols can be built on top of subsymbolic patterns and subsymbolic data / functions can originate from "compiling" symbolic declarative knowledge. Thus, I'd prefer to have a more flexible and rich mechanisms (possibly partly describable in MeTTa itself) for associating symbols and grounded atoms than having string names or hash-like identifiers optionally attached to grounded atoms. |
For indexing within a Space, having a unique identifier for each atom is desirable. However there are a number of additional considerations assigning these identifiers for grounded atoms.
In a discussion between myself and @vsbogd, we uncovered a tension about what this identifier fundamentally represents; and I believe that tension is rooted in a deeper split between two different conceptual kinds of grounded atom types.
1.) Some grounded atoms represent simple values. For example wrappers around primitive types in the host language. These are like the OpenCog Classic atoms; they're conceptually immutable and changing them is functionally equivalent to replacing them with a different atom of the same type but with a different value.
2.) Other grounded atoms represent complex mutable data structures. For example atom types that wrap Spaces. We may wish to expose monads to mutate these atoms so MeTTa will be a more "functional" language (see #390) but that's aside from this discussion. Irrespective of how we track and integrate updates, I don't think we want a change to a complex atom to cause a change its identifier, because this will create considerable bookkeeping complexity and cost.
I believe therefore that the desiderata for the identifiers for the different atom types are different.
For type 1. grounded atoms:
For type 2. atoms:
One option is to conceptually separate these types of identifiers in two, by adding a new interface to the
Grounded
trait, along the lines of:Therefore, grounded atoms that return a value here can be assumed to be of type 1, and atoms that return
None
will be assumed to be volatile data structures.What do you think, @Necr0x0Der and @Adam-Vandervorst?
The text was updated successfully, but these errors were encountered: