# Direct Evaluation of Intensional Links

This page gives a simple heuristic approach to directly evaluating the truth values of (IntensionalInheritance A B) and (IntensionalSimilarity A B) based on other links already in the Atomspace

For instance, if there are Atoms "cat" and "dog" in the AtomSpace, it tells how to make a command

cog-create-intensional-links x y

so that

cog-create-intensional-links cat dog

would create in the AtomSpace the links

IntensionalInheritanceLink cat dog

IntensionalInheritanceLink dog cat

IntensionalSimilarityLInk cat dog

with appropriately (heuristically) defined truth value strengths...

These links could then be reasoned on by various other processes...

Intuitively, e.g.

IntensionalInheritanceLink cat dog

measures the percentage of cat's properties that are also properties of dog; and

IntensionalSimilarityLink cat dog

measures the percentage of cat's and dog's properties that are shared, i.e. that are properties of each other...

The PLN book says a lot more about these link types...

# Basic Idea

Given Atoms A and B, the values II(A,b) and IS(A,B) are defined as

II(A,B) = strength of the true value of

IntensionalInheritance A B

IS(A,B) = strength of the true value of

IntensionalSimilarity A B

These values are calculated using fuzzy sets

ASSOC(A)

ASSOC(B)

that are defined in terms of A and B (I will say how below)

We can define

II(A,B) = Sum_L[ ASSOC(A,L) AND ASSOC(B,L) ] / Sum_L [ ASSOC(A,L)]

IS(A,B) = Sum_L[ ASSOC(A,L) AND ASSOC(B,L) ] / Sum_L [ ASSOC(A,L) OR ASSOC(B,L) ]

where Sum_L is summation over all possible links L.

There are many ways to define fuzzy AND and OR.. for simplicity we can start with the max and min, according to which, where

deg(x,A) = the membership degree of x in fuzzy set A,

we have

deg(x, A OR B) = max( deg(x,A), deg(x,B) )

deg(x, A AND B) = min( deg(x,A), deg(x,B) )

Thus,

ASSOC(A,L) OR ASSOC(B,L) = max( ASSOC(A,L), ASSOC(B,L) )

ASSOC(A,L) AND ASSOC(B,L) = min( ASSOC(A,L), ASSOC(B,L) )

# Building the Association Sets

Next, how do we define ASSOC(A)?

For each link L of the form

L = SubsetLink A C

define

L1 = SubsetLink (NOT A) C

and

tvL = L.truthValue.strength

tvL1 = L1.truthValue.strength

In case tvL1 is not known (because L1 does not exist in the Atomspace), use the approximation

tvL1 = 1 - A.truthValue.strength

Then set

ASSOC(A,L) = (tvL - tvL1)^+

where

x^+ = x if x>0, and = 0 if x<=0 [this is called the "positive part"]

WARNING: the following contains typos, read at your own risks

Next if we have a link of the form

L = EvaluationLink A Z

we can initially set

tvL = L.truthValue.strength

tvL1 = A.truthValue.strength

and

ASSOC(A,L) = (tvL - tvL1)^1

If we have a link of the form

L = EvaluationLink Z (A, B)

we can initially set

tvL = L.truthValue.strength

tvL1 = average over all links of the form [ L1 = EvaluationLink Z (X, B) ] in the AtomTable, for which X is not A, of L1.tv.strength

and

ASSOC(A,L) = (tvL - tvL1)^1

If we have a link of the form

L = EvaluationLink Z (B, A)

we can initially set

tvL = L.truthValue.strength

tvL1 = average over all links of the form [ L1 = EvaluationLink Z (B, X) ] in the AtomTable, for which X is not A, of L1.tv.strength

and

ASSOC(A,L) = (tvL - tvL1)^1

…

# Summary of the Process

So… to calculate

II(A,B)

and

IS(A,B)

one can follow the process:

- Find all the links L connecting to A and B, matching the patterns specified above in the section "Building the Association Sets"

- calculate ASSOC(A,L) and ASSOC(B,L) corresponding to those links L

- calculate the link strengths via the formulas given above,

II(A,B) = Sum_L[ ASSOC(A,L) AND ASSOC(B,L) ] / Sum_L [ ASSOC(A,L)]

IS(A,B) = Sum_L[ ASSOC(A,L) AND ASSOC(B,L) ] / Sum_L [ ASSOC(A,L)]

# Wrapping

This should be wrapped in a (newly created) Scheme shell

http://wiki.opencog.org/w/Scheme

command such as

(cog-create-intensional-links x y)

which builds the links

IntensionalSimilarity A B

IntensionalInheritance A B

IntensionalInheritance A

and calculates their truth values...