How to use the @Min[] operator

35 views
Skip to first unread message

TzahiJ

unread,
May 23, 2019, 6:36:43 PM5/23/19
to PSL Users
Hi All,
I have the following rule:
100: base_similarity(A) + infered_name_similarity(A) <= infered_similarity(A)^2
It works OK, but when the sum of the two atoms (The body) is larger than 1, it will reduce the open predicate on the body.

I tried using the @Min operator:
100: @Min[base_similarity(A) + infered_name_similarity(A),1] <= infered_similarity(A)^2

But this rule will not compile.
What am I doing wrong?
Thanks, Tzahi


Eriq Augustine

unread,
May 24, 2019, 7:32:21 PM5/24/19
to TzahiJ, PSL Users
Hey Tzahi,

I believe that @Min/@Max are operators on coefficients, not full atoms.

Have you tried a logical rule instead?
100: base_similarity(A) & infered_name_similarity(A) -> infered_similarity(A) ^2

-eriq

--
You received this message because you are subscribed to the Google Groups "PSL Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to psl-users+...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/psl-users/a86e4b38-baf4-4ae2-96b4-c903aa3bb1f1%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

TzahiJ

unread,
May 25, 2019, 9:32:56 AM5/25/19
to PSL Users
This was my first attempt.
The business logic of this rule is that  if there is any similarity on names, the inferred similarity must be more than the base similarity.
lets say base_similarity is 0.6, and name similarity is 0.6
the result of the rule is 0.6 + 0.6 - 1 = 0.2. since it it is raised  to the power of 2, it still is 0.44 - less than what we started with.
So inferred similarity is less then base similarity.
Regards,Tzahi
(there is another rule - "base_similarity(A) -> inferred_similarity(A)", which keeps the inferred_similarity at least as high as the base_similarity)


On Saturday, May 25, 2019 at 2:32:21 AM UTC+3, Eriq Augustine wrote:
Hey Tzahi,

I believe that @Min/@Max are operators on coefficients, not full atoms.

Have you tried a logical rule instead?
100: base_similarity(A) & infered_name_similarity(A) -> infered_similarity(A) ^2

-eriq

On Thu, May 23, 2019 at 3:36 PM TzahiJ <tza...@hotmail.com> wrote:
Hi All,
I have the following rule:
100: base_similarity(A) + infered_name_similarity(A) <= infered_similarity(A)^2
It works OK, but when the sum of the two atoms (The body) is larger than 1, it will reduce the open predicate on the body.

I tried using the @Min operator:
100: @Min[base_similarity(A) + infered_name_similarity(A),1] <= infered_similarity(A)^2

But this rule will not compile.
What am I doing wrong?
Thanks, Tzahi


--
You received this message because you are subscribed to the Google Groups "PSL Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to psl-...@googlegroups.com.
Message has been deleted

TzahiJ

unread,
May 25, 2019, 11:35:09 AM5/25/19
to PSL Users
I tried another approach:
base_similarity(A) & inferred_name_similarity(A) -> inferred_similarity(A)^4

but this does not compile :-(. only ^2 and ^1 are excepted.
That is a pity. It seems to me a consistent way of saying that if conditions match - the "truthiness" of the head is increased.

Is there a way to get the value of an atom so that I can use math operations on it? something like atom(A).value?
Message has been deleted

Eriq Augustine

unread,
May 28, 2019, 12:36:51 PM5/28/19
to TzahiJ, PSL Users
In a rule, you cannot get the value of an atom.

Is base_similarity closed and infered_name_similarity open?

-eriq

--
You received this message because you are subscribed to the Google Groups "PSL Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to psl-users+...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/psl-users/56151f38-7e5e-4f4b-9d0f-6e4022744877%40googlegroups.com.

TzahiJ

unread,
May 28, 2019, 12:50:45 PM5/28/19
to PSL Users
yes - base_similarity is closed and infered_name_similarity is open.


On Tuesday, May 28, 2019 at 7:36:51 PM UTC+3, Eriq Augustine wrote:
In a rule, you cannot get the value of an atom.

Is base_similarity closed and infered_name_similarity open?

-eriq

On Sat, May 25, 2019 at 8:35 AM TzahiJ <tza...@hotmail.com> wrote:
I tried another approach:
base_similarity(A) & inferred_name_similarity(A) -> inferred_similarity(A)^4

but this does not compile :-(. only ^2 and ^1 are excepted.
That is a pity. It seems to me a consistent way of saying that if conditions match - the "truthiness" of the head is increased.

Is there a way to get the value of an atom so that I can use math operations on it? something like atom(A).value?

--
You received this message because you are subscribed to the Google Groups "PSL Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to psl-...@googlegroups.com.

Eriq Augustine

unread,
May 28, 2019, 2:11:12 PM5/28/19
to PSL Users
I don't know if you will be able to get it all in one rule.
What about two rules like:
base_similarity(A) <= inferred_similarity(A)
infered_name_similarity(A) <= inferred_similarity(A)

-eriq

To unsubscribe from this group and stop receiving emails from it, send an email to psl-users+...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/psl-users/72affc69-17a8-432c-b678-304ee9fec720%40googlegroups.com.

TzahiJ

unread,
May 28, 2019, 4:54:26 PM5/28/19
to PSL Users

Thanks Eriq,

AFAIU, This will only guarantee that inferred_similarity will be the maximum the other two atoms. I am afraid this does not help.

 

My situation is as follows:

All entities in a network are linked to a source entity. Their base_similarity to the source is computed by a separate algorithm.

If an entity name is similar to the source entity name – Then it has a inferred_name_similarity that should increase the inferred_similarity.

Similarity is transferred to other entities by the rule:

Inferred_name_similarity(A) & Linked(A,B) -> inferred_name_similarity(B)

 

My understanding is that Atom values in PSL can not increase in a rule.

 

Is there any way around this ?

 

Thanks again, Tzahi

Eriq Augustine

unread,
May 28, 2019, 5:39:22 PM5/28/19
to PSL Users
My understanding is that Atom values in PSL can not increase in a rule.

What do you mean here?
Observed/closed atoms cannot change their value, and random variable atoms can have their value increased and decreased.

The inferred_name_similarity predicate confuses me a bit.
It seems like it should be closed and computed outside of PSL.
If that is true, then I would just model this situation with two rules:
base_similarity(A) -> inferred_similarity(A)
infered_name_similarity(A) -> inferred_similarity(A)


I would't use a greater than because it may be possible foe the external similarity computations to give noisy answers.

-eriq

To unsubscribe from this group and stop receiving emails from it, send an email to psl-users+...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/psl-users/dfc5edb5-8235-486b-810d-5b317bfa832c%40googlegroups.com.

TzahiJ

unread,
May 28, 2019, 6:09:17 PM5/28/19
to PSL Users
The full rule set is:
1: !infered_similarity(A)^2
1: !infered_name_similarity(A)^2
100: base_similarity(A) -> infered_similarity(A)^2
100: base_name_similarity(A) -> infered_name_similarity(A)^2
100: infered_name_similarity(A) & linked(A,B) -> infered_name_similarity(B)^2 # linked entity gets name similarity
Reply all
Reply to author
Forward
0 new messages