About Attention Values and Truth Values

180 views
Skip to first unread message

vishnu

unread,
Oct 11, 2016, 10:19:12 AM10/11/16
to opencog
Hello all,

Say, I have the following example sentences 

  • apple is rich in vitamins. 
  • apple makes the doctor away. 
  • apple is healthy. 
  • apple is red in color. 
  • eva eats apple.
  • Steve Jobs invented apple.
  • apple iphone is usually costly. 
  • headquaters of apple inc. is in california. 
  • apple products are robust.

i just parsed these sentences and got R2L outputs. Example of one such output is as follows (apple products are robust):

((ImplicationLink
   (PredicateNode "robust@a80f418c-0d57-477d-8d77-7077068e3033")
   (PredicateNode "robust" (stv 0.045454547 0.0012484394))
)
 (InheritanceLink
   (ConceptNode "products@c9f041f5-5583-4cb0-ab57-eec13624a28b")
   (ConceptNode "product" (stv 0.019607844 0.0012484394))
)
 (EvaluationLink
   (PredicateNode "robust@a80f418c-0d57-477d-8d77-7077068e3033")
   (ListLink
      (ConceptNode "products@c9f041f5-5583-4cb0-ab57-eec13624a28b")
   )
)
 (InheritanceLink
   (InterpretationNode "sentence@293aa7fb-891c-48a5-ab25-e5be24cbbf47_parse_0_interpretation_$X")
   (DefinedLinguisticConceptNode "DeclarativeSpeechAct")
)
 (InheritanceLink
   (ConceptNode "apple@7f6ace14-d5bf-4ffb-aa3b-dfc4bce59f7a")
   (ConceptNode "apple" (stv 0.17647059 0.011124846))
)
 (InheritanceLink
   (ConceptNode "products@c9f041f5-5583-4cb0-ab57-eec13624a28b")
   (ConceptNode "apple@7f6ace14-d5bf-4ffb-aa3b-dfc4bce59f7a")
)
)


1.  When you look at the example sentences, you will know that i have framed all sentences with the word "apple" that comes in two different contexts.  Apple as a fruit and and as a company. I think,  Atoms have multiple truth values depending upon the context. (I assume Atoms with the same Context will have similar Truth Values.?!) . Is it possible to filter atoms based on  some TV depending upon particular context? 

2.  Like STV, i am unable to see STI  in the  R2L output.  I assume the atom with the highest number of links gets  automatically high STI value. So is it possible to retrieve top most important atoms based on STI ? ( also may be top atom's related atoms in a similar context).  If so, how can i acheive that?

3. The process of forgetting and recovering from the disk is possible only when i save atoms in postgres. So everytime when i have huge text, i should parse each line using (nlp-parse ""), convert into R2L output  using (parse-get-r2l-outputs.....)  and in turn should store the obtained results in postgres.   Am i missing anything here?. 



Thanks in advance
Vishnu


Linas Vepstas

unread,
Oct 11, 2016, 1:16:36 PM10/11/16
to opencog
On Tue, Oct 11, 2016 at 9:19 AM, vishnu <vishnup...@gmail.com> wrote:
Hello all,

Say, I have the following example sentences 

  • apple is rich in vitamins. 
  • apple makes the doctor away. 
  • apple is healthy. 
  • apple is red in color. 
  • eva eats apple.
  • Steve Jobs invented apple.
  • apple iphone is usually costly. 
  • headquaters of apple inc. is in california. 
  • apple products are robust.

i just parsed these sentences and got R2L outputs.

Some of these sentences are not grammatical, and will fail to parse. or will parse incorrectly, or lead to other strange errors.  For example:

"The apple is rich in vitamins"
or
"Apples are rich in vitamins"
but 
*Apple is rich in vitamins.

where * is the standard convention in linguistics, meaning "this sentence is not grammatical"

The issue is that, for English, some of the meaning of a sentence is conveyed in the word-order, and thus, sentences with bad word order or bad syntax become hard to understand. The use has to think harder -- mybe they are not grammatical, because a joke is being said? Maybe one of the words is mis-spelled? Maybe one of teh words don't mean what I think it means?   Grammtical failure leads to mis-understanding and mis-comprehension.

For opencog, grammatical failure results in mis-comprehension at the parser level.  There is no second pass at a higher layer that attempts to fix such failures  (although Amir is kind-of working on this)

 


1.  When you look at the example sentences, you will know that i have framed all sentences with the word "apple" that comes in two different contexts.  Apple as a fruit and and as a company. I think,  Atoms have multiple truth values depending upon the context.

Only if you use the context link.
 
(I assume Atoms with the same Context will have similar Truth Values.?!) .

No, they can have any truth value at all.
 
Is it possible to filter atoms based on  some TV depending upon particular context? 

Sure, but you have to write your own code to filter as you wish. 

2.  Like STV, i am unable to see STI  in the  R2L output.

There is no concept of STI in R2L. STI is a concept used to control the inference engine. It is not used anywhere else.

R2L does set the STV, based on the difficulty of finding a correct parse for a sentence.  If the sentence was easy to parse, then the parse is given a high confidence.  If the sentences was hard to parse, or if one of the parses seems very unlikely or maybe wrong, then it is given a low confidence.

If ungrammatical sentences parse at all, then they are given low confidence.
  
 I assume the atom with the highest number of links gets  automatically high STI value.
No.

The STI assigned to an atom depends on the algorithm that is doing that assignment. Different algos .. are different.
 
So is it possible to retrieve top most important atoms based on STI ?
Yes.
 
( also may be top atom's related atoms in a similar context).  If so, how can i acheive that?

In C++, the "AttentionBank" stores atoms, ranked by importance. It provides some methods to ask for those.  I'm not sure what the scheme and python API's are for this.  I assume they're there, somewhere.


3. The process of forgetting and recovering from the disk is possible only when i save atoms in postgres. So everytime when i have huge text, i should parse each line using (nlp-parse ""), convert into R2L output  using (parse-get-r2l-outputs.....)  and in turn should store the obtained results in postgres.  

Yes.
 
Am i missing anything here?. 

No, not really, other than that the postgres interfaces remain hard to use.  Also, there currently is no way to delete an atom, once it has been put into the database.

Attention values are not stored in the database. Attention is used only during reasoning, and the code that does that remains experimental. Different algos for assigning attention are being explored; it is not clear what will work best. This remains a difficult task, so far.
 



Thanks in advance
Vishnu


--
You received this message because you are subscribed to the Google Groups "opencog" group.
To unsubscribe from this group and stop receiving emails from it, send an email to opencog+unsubscribe@googlegroups.com.
To post to this group, send email to ope...@googlegroups.com.
Visit this group at https://groups.google.com/group/opencog.
To view this discussion on the web visit https://groups.google.com/d/msgid/opencog/f641c4f3-0a91-40bb-bb65-1ca0daaf6689%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Misgana Bayetta

unread,
Oct 11, 2016, 11:21:43 PM10/11/16
to opencog
Inorder to get set STI values for the atoms, you need to start the ECAN system and you also you need to stimulate the atoms manually via the guile shell using the cog-stimulate guile function or you can write an agent which will stimulate the atoms based on some conditions. The code is found here  and is currently being maintained by me and Roman. Currently, I am testing the STI spreading behaviour on large atomspace by setting the various parameters defined in the system. Let us know if you have further questions and interest on this.

3. The process of forgetting and recovering from the disk is possible only when i save atoms in postgres. So everytime when i have huge text, i should parse each line using (nlp-parse ""), convert into R2L output  using (parse-get-r2l-outputs.....)  and in turn should store the obtained results in postgres.   Am i missing anything here?. 



Thanks in advance
Vishnu


--
You received this message because you are subscribed to the Google Groups "opencog" group.
To unsubscribe from this group and stop receiving emails from it, send an email to opencog+unsubscribe@googlegroups.com.
To post to this group, send email to ope...@googlegroups.com.
Visit this group at https://groups.google.com/group/opencog.
To view this discussion on the web visit https://groups.google.com/d/msgid/opencog/f641c4f3-0a91-40bb-bb65-1ca0daaf6689%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.



--
Belachew Misgana Bayetta
'For everyone who asks receives, and the one who seeks finds, and to the one who knocks it will be opened ' --Jesus

vishnu

unread,
Oct 12, 2016, 8:53:53 AM10/12/16
to opencog
Thanks Linas and Misgana for your time.

I read Attention Allocation.  Under  "Ideas of simple ECAN tests", it is written that special words won't get forgotten. 
But what do you call as special words?. Only the words that co-occur together? or the words which we give frequently to the atomspace  (like in human brain, when we hear certain things frequently, we will never forget those that easily). 

In general, how can i do simple ECAN tests.  It says, generate fake sentences --> feed atoms in atomspace --> Boost STI/LTI --> Set Memory Capacity and so on. But i don't know how to do this.  Do you have any wiki page for this with guidelines ? or could you provide a simple example. It would be very helpful and i can also see how the atoms are remembered and forgotten.  

"..set the memory capacity of the Atomspace at M Atoms (where M>>N). So we want to trigger forgetting when the Atomspace gets bigger than M...".
So according to this line, the process of "forgetting" can also be achieved. Is this has nothing to do with deleting atoms in the database?. Since Linas told, once atoms are into database,  there is no way to delete them.  Is there no connection between database and the process of remembering and forgetting. ?

 Say in real time, i may want to work with some atoms stored in DB --> Start ECAN  --> Simulate Atoms--> Store the atoms with high attentional values back in DB -->  Later retrieve them from DB based on  some condition.  But i cannot do this ?!, since according to Linas , "Attention values are not stored in the database". May be, if i am right, I can do the following, feed atoms in atomspace --> Start ECAN --> Stimulate Atoms --> Get STI/LTI.  Next time when i start cogserver, i can see and retrieve the the atoms in atomspace with STI and work with it ?! (i assume that atoms will be saved in the atomspace?). 


One more question...

 I can give only the sentences which are grammatically correct into NLP Pipeline?.  So giving incomplete sentences say, human chats or so will give strange errors and it is not possible to obtain fruitful results.




 


 





Roman Treutlein

unread,
Oct 12, 2016, 9:15:00 AM10/12/16
to opencog
Hey,

Short explanation first:
STI: This value indicates how relevant this atom is to the currently running process/context
LTI: This value indicates how relevant this atom might be in future processes/context (Atoms with low LTI have no future use and get delete if the AS gets to big)
VLTI: This is a simple boolean that indicates that this atom should never be deleted. (Useful for system components that are written in Atomese)

so STI values are only ever useful at the current point in time so storing them in a DB makes no sense. Now storing only those Atom which have a high STI/LTI in the DB that might be useful but there is no code that does that currently. In my opinion just storing the whole AS in a DB works just as well.

Now when you load the atoms back into the AS then it might make sense to give all those Atoms an LTI boost.

I am not sure what exactly you want to use the AttentionValues for but in general they are supposed to speed up other processes like the PLN System by restricting their search space to only Atoms with a high STI.

Misgana has a working but experimental implementation for this as far as I know.

In regards to using ECAN:
generate fake sentences --> feed atoms in atomspace --> Boost STI/LTI --> Set Memory Capacity

I assume you got that from on of the experiments. You obviously don't want to generate face sentences so we can ignore that. Feeding Atoms into the AtomSpace would be done by the NLP Pipeline. Boosting STI/LTI would be done when they become relevant i.e they just entered the AtomSpace or NLP found them to be useful. (again ask misgana about his implementation of this). Setting the Memory Capacity you probably don't have to do but it's just a value in the config file.

If you have some more specific question about how ECAN works (i.e. spreading of STI , rent collection , setting of the AFB) i can answer those.

regards
/Roman

vishnu

unread,
Oct 12, 2016, 10:48:46 AM10/12/16
to opencog
Hey Roman,

Thanks for the reply :-)

I am not sure what exactly you want to use the AttentionValues for

With attention values, i thought i could do the following:
I have 24x7 tweets coming. So i thought,  I can send them to NLP pipeline and get Atoms. Let's say most of the people tweet about Presidential Election.  I assumed that,  when feeding these atoms into atomspace, somehow atoms related to "Election" will get High STI?. Since they occur more often now-a-days. Say, there will be a lot of Trump and Hilary Clinton atoms. Somehow they get high STI  (?!!) and i can retrieve those top ranked atoms and its related atoms (since STI is also diffused to similar atoms). 

That was the idea. But i don't know, whether Attention values works like this for pursuing the above mentioned. :-(.  What am i missing??

Boosting STI/LTI would be done when they become relevant i.e they just entered the AtomSpace or NLP found them to be useful.
I could not figure out, on what basis stimulus is given to atom. In general, How atoms become important/relevant?





 
 

Roman Treutlein

unread,
Oct 12, 2016, 12:57:03 PM10/12/16
to opencog
Hey vishnu,

what you are suggesting does sound doable.

In your case, you would just want to stimulate atoms every time they have been parsed by the NLP pipeline. Something like this might already exist not sure ask misgana.

More generally there would be many Mind-Agents that are running in the cogserver. And everytime any of those agents deem it useful they can stimulate an atom, the actual STI value given to an Atom is dynamic based on other variables but you can provide a factor to indicate stimulate this Atom a lot or only a little. Examples of this would be that the PLN system successfully used an Atom for a deduction it is trying to make so it stimulates it so similar atoms come into focus and help the continued process. Or some Agents related to perception have just seen X which corresponds to one or more Atoms so they stimulated them as they will likely be of interest in the moment.

Now for retrieving these values you will probably have to write an Cogserver Module that implements a command that gives you the top ranking atoms.
If you want this to be done automatically you need to have an Agent. (Which are alway part of a Module)

hope that helps.

Vishnu Priya

unread,
Oct 13, 2016, 3:52:15 AM10/13/16
to opencog

Hey Roman,

Thanks, that helped a lot to get more insight. :-)  I shall ask Misgana about stimulating atoms. 

Cheers,
Vishnu




Linas Vepstas

unread,
Oct 15, 2016, 11:28:00 PM10/15/16
to opencog
On Wed, Oct 12, 2016 at 9:48 AM, vishnu <vishnup...@gmail.com> wrote:

With attention values, i thought i could do the following:
I have 24x7 tweets coming. So i thought,  I can send them to NLP pipeline and get Atoms. Let's say most of the people tweet about Presidential Election.  I assumed that,  when feeding these atoms into atomspace, somehow atoms related to "Election" will get High STI?. Since they occur more often now-a-days. Say, there will be a lot of Trump and Hilary Clinton atoms. Somehow they get high STI  (?!!) and i can retrieve those top ranked atoms and its related atoms (since STI is also diffused to similar atoms). 

Well, a very olde-fshioned idea (olde in "internet time") is to PageRank algorithm -- https://en.wikipedia.org/wiki/PageRank -- and so you would take something like STI, and diffuse it to other atoms, based on how many incoming and outgoing links there are. 

ECAN does something like PageRank, but different, I don't recall what the differences are.  If you don't like how it distributes the STI, you could create a different variant-- e.g. a PageRankImportanceDiffussionAgent and it would use the pagerank algo, instead of the ECAN algo.  I don't know which would give better results for you.

--linas

Vishnu Priya

unread,
Oct 17, 2016, 6:46:24 AM10/17/16
to opencog, linasv...@gmail.com

Thnaks Linas for the reply. 
 
I would like to know some more info about Truth values.

How is atom's truth value is updated based on new observations?  
How can truth values of certain atoms in a particular context change a lot?  ( i came across this line in the book, "if truth values of a certain sort of atom in certain context change a lot, then confidence decay rate of the atoms of that sort should be increased.")
Could you please explain with few example sentences. 

 Is ConfidenceDecay Mind Agent already implemented?

 If so, then i assume that confidence-decaying predicates which are important Atoms but are unconfident, are given STI, so as to make it likely that they may be used for inference and this is how atoms become important. 

regards,
--Vishnu

 

Linas Vepstas

unread,
Oct 18, 2016, 12:49:59 AM10/18/16
to Vishnu Priya, opencog
On Mon, Oct 17, 2016 at 5:46 AM, Vishnu Priya <vishnup...@gmail.com> wrote:

Thnaks Linas for the reply. 
 
I would like to know some more info about Truth values.

How is atom's truth value is updated based on new observations?  

They are not.  Only PLN updates TV's and some other specialized subsystems that you are not using.

Currently, TV update is up to the user to do as they please.  That's mostly because we don't know of or have any one-size-fits-all algos for this.
 
How can truth values of certain atoms in a particular context change a lot?  ( i came across this line in the book, "if truth values of a certain sort of atom in certain context change a lot, then confidence decay rate of the atoms of that sort should be increased.")
Could you please explain with few example sentences. 

 Is ConfidenceDecay Mind Agent already implemented?
No
 

 If so, then i assume that confidence-decaying predicates which are important Atoms but are unconfident, are given STI, so as to make it likely that they may be used for inference and this is how atoms become important. 

We will find out. Nil is working on inference right now. .. PLN inference.

You are welcome to create your own inference rules that do something completely different -- the rule engine doesn't care about what rules you create.  It will just apply the rules, and twiddle the TV's according to your desires.

--linas 

regards,
--Vishnu

 

Vishnu Priya

unread,
Oct 21, 2016, 11:27:09 AM10/21/16
to opencog, vishnup...@gmail.com, linasv...@gmail.com
    Hey Linas,

I would like to know how to use ContextLink. 
  • The Apple is red in color.   
  • The Headquarters of apple is in California.  
Each and every sentence of mine has certain context word.
I want the former sentence to be parsed along with  ContextLink fruit and the later as company.  So that later, i can identify which atom belongs to which context. 
Should i make changes at the parser level? What should i do? 

Cheers,
Vishnu

Linas Vepstas

unread,
Nov 10, 2016, 8:30:44 PM11/10/16
to Vishnu Priya, opencog
Hi,

sorry just now recovering from system outages and an email overload. 

ContextLink and how to use it is documented on the wiki.

Currently it it not used very much, or at all. 

ContextLinks only make sense once you know how to asssign meaning to things -- syntax parsing of sentences is far too low-level for this, because you don't yet know what the word "apple" is.

--linas


Vishnu Priya

unread,
Nov 14, 2016, 10:34:19 AM11/14/16
to opencog, vishnup...@gmail.com, linasv...@gmail.com
Hey Linas!

Thanks for the reply. It's ok. Totally understandable.!!

Yeah just read about ContextLink on wiki. 

I have a scenario, where i have sentences that i want to give to NLP Pipeline.  Along with sentences, i also have an attribute called id. Like a reference for sentence.
Each sentence is associated with an identifier. For me, it would be useful when i have the sentences parsed along with their id. 
Later, say i stimulate and get STI, whatever i do, finally i should be knowing, to what id the atom belongs to.  

So i thought, with something like below, i might achieve that. 
apple is fruit in the context of id1.
(EvaluationLink                                                     
  (ContextLink id1
   (PredicateNode "is")
   (ListLink
      (ConceptNode "apple")
      (ConceptNode "fruit")
   ) 
)



But i don't know, how to input my sentences along with their identifiers. Is it possible somehow to do such a thing of incorporating identifiers ?
or is it totally not doable?


--vishnu

Linas Vepstas

unread,
Nov 14, 2016, 3:53:56 PM11/14/16
to Vishnu Priya, opencog

A better design would be to explicitly acknowledge that words have meanings.  The way that this is currently done looks roughly like this:

(EvaluationLink  
    (PredicateNode "is")
   (ListLink
      (ConceptNode "apple@meaning-42")
      (ConceptNode "fruit@meanning-66")
   ) 
)

I hope the above is "obvious": the 42nd kind of meaning of the word "apple" is a kind of "fruit", where by "fruit", we mean the 66th entry in Webster's dictionary.

(ReferenceLink
      (ConceptNode "apple@meaning-42")
      (WordNode "apple")
)

That tells you the actual word that gets used for meaning-42. This is a lexical function https://en.wikipedia.org/wiki/Lexical_function

(WordInstanceLink
    (SentencNode "id1")
    (WordInstanceNode "apple@bf71826c-487e-42df-a941-0ecd3c942a76")
)

This tells you that the the word apple occurred in sentence id1

(ReferenceLink
   (WordInstanceNode "apple@bf71826c-487e-42df-a941-0ecd3c942a76")
   (ConceptNode "apple@meaning-42")
)

This tells you that the word apple in sentence id1 actually corresponds to meaning 42.

See?  No context link at all.

The above oversimplifies things a little bit.  Some of the reference links should probably be EvaluationLinks. The lexical functions need to be improved, a lot.  The current output is documented here: http://wiki.opencog.org/w/RelEx_OpenCog_format but it could be over-hauled and improved, its not perfect.

I believe that the above should work well with PLN, but that remains to be seen: again Nil is working on this now.

--linas

Vishnu Priya

unread,
Nov 19, 2016, 7:06:02 AM11/19/16
to opencog, vishnup...@gmail.com, linasv...@gmail.com

I also had an another idea of coupling the sentences along with their id. Ex. Why can't i give sentences like  "Apples are sweet, said by id1". "Farmers are starving, said by id2" .So that i would know which sentence has which id.  what do you say? 

Thanks,
Vishnu

Linas Vepstas

unread,
Nov 19, 2016, 7:32:40 AM11/19/16
to Vishnu Priya, opencog
That makes the problem harder. You still have to somehow deal with different word-senses for "apple", and in addition, you also need to create a a model of the mental state of id1.  So, if id1 is a child, the word-sense for "apple" and "sweet" is probably different than if id1 is an iphone fanboi.   This opens a can of worms: what are id1's beliefs and world-view?

(and context dependent: did id1 say that while standing in front of a store-front selling Apple computer products? or while standing  in front of a grocery display?)

I think this is "solvable", but its at/past the cutting-edge of what anyone else is doing with opencog.   I've been trying to work on "mental models" but it's currently hard.

--linas

Vishnu Priya

unread,
Nov 21, 2016, 4:17:13 AM11/21/16
to opencog, vishnup...@gmail.com, linasv...@gmail.com
Hmm! yes. i am getting it now.

Thanks and regards,
Vishnu.
Reply all
Reply to author
Forward
0 new messages