Skip to content
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

some rules may content rule head triplet #77

Open
meloncolie opened this issue Jan 31, 2023 · 11 comments
Open

some rules may content rule head triplet #77

meloncolie opened this issue Jan 31, 2023 · 11 comments

Comments

@meloncolie
Copy link

@lajus
There are some notable rules may content rule head triplet when setting max length of rule to 4 and running on the dataset YAGO15K (may could be recurrented on any YAGO data with wasBornIn/diedIn). For instance,

?m  hasNeighbor  ?b  ?g  wasBornIn  ?a  ?g  wasBornIn  ?m   => ?a  hasNeighbor  ?b      0.14893617      1.0     1.0     77      77      77      ?b

Since any head of wasBornIn only has a single tail (nobody is born in two place at same time, and also be check on YAGO15K), ?a must be identical to ?m. Thus, the ?m hasNeighbor ?b term in rule body can be rewrite as ?a hasNeighbor ?b, which is literally the rule head. It should not be considered as a rule, in other word, this rule should be deleted.

By the way, is it possible to save the predict instances (including nodes in each predict) of each rule? Therefore, anyone can check the correctness of rules.

@lgalarra
Copy link
Collaborator

lgalarra commented Feb 4, 2023

Hi,

I almost certain that in such cases AMIE includes a differentFrom condition on those variables, i.e., differentFrom(?m, ?a), see line 351 in the default mining assistant: https://github.com/dig-team/amie/blob/master/mining/src/main/java/amie/mining/assistant/DefaultMiningAssistant.java

However the display method for rules omits those atoms as we can see here:

public String getRuleString() {

Best,
Luis

@meloncolie
Copy link
Author

I have tried my best to unterstand those code, but it's pretty hard for me to read these complex classes and java language. Could you please show me how to print the the support/predict instances.

Thank you,
Bin

@lgalarra
Copy link
Collaborator

Hi Bin,

I am intrigued. Could you please verify that there are not reflexive triples X hasNeighbor X? Otherwise, could you send me the YAGO15K file to test what is going on?

Best,
Luis

@meloncolie
Copy link
Author

Hi Luis,

I have verified that there's no relfexive relationships with the codes in below. Glad to send you the tsv file as an attachment. The wired rules are appeared when run program with the argument -maxad 4 yago15k_edges.tsv .

In [7]: df = pd.read_csv('yago15k_edges.tsv', sep='\t', names=['s', 'p', 'o'])

In [8]: df[df['s']==df['o']]
Out[8]: 
Empty DataFrame
Columns: [s, p, o]
Index: []

yago15k_edges.zip

Best,
Bin

@meloncolie
Copy link
Author

Hi Luis,

Have you reproduced or fixed the problem?

Best,
Bin

@lgalarra
Copy link
Collaborator

Hi,

I am overwhelmed at this moment. I may have some time to look at it next week. If you do not hear from me, feel free to send me a reminder please. Sorry for the delay!

Best,
Luis

@meloncolie
Copy link
Author

Hi,

I am overwhelmed at this moment. I may have some time to look at it next week. If you do not hear from me, feel free to send me a reminder please. Sorry for the delay!

Best, Luis

Thanks for your response! OK, I am looking for your good news next week.

Best,
Bin

@lgalarra
Copy link
Collaborator

Hi Bin,

Question, which version of AMIE did you use? I ran

$ java -jar amie-milestone-intKB.jar -maxad 4 yago15k_edges.tsv

but could not find the rule you reported. The jar file is among the release files provided in this repository.

Best,
Luis

@meloncolie
Copy link
Author

Hi Bin,

Question, which version of AMIE did you use? I ran

$ java -jar amie-milestone-intKB.jar -maxad 4 yago15k_edges.tsv

but could not find the rule you reported. The jar file is among the release files provided in this repository.

Best, Luis

Hi Luis,

I used the master branch and have run your command, the result is correct. I noticed that the problem only occurs when man runs amie-dev.jar in the root directory. What is the different between amie-dev.jar and amie-milestone-intKB.jar?

Best,
Bin

@lgalarra
Copy link
Collaborator

lgalarra commented Jun 6, 2023

The amie-milestone-intKB.jar is the version that was used for the experiments of the AMIE3 paper.. so it is sort of a stable version. I checked all the changes that came afterwards: milestone-intKB...master, so it seems we are facing a bug introduced by our improvements.

@meloncolie
Copy link
Author

The amie-milestone-intKB.jar is the version that was used for the experiments of the AMIE3 paper.. so it is sort of a stable version. I checked all the changes that came afterwards: milestone-intKB...master, so it seems we are facing a bug introduced by our improvements.

OK, btw, could you implement recording all instances(including all nodes on each path) of each rules to a file. Thanks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants