rutgersdm / dkgr Goto Github PK
View Code? Open in Web Editor NEWLearning to Walk with Dual Agents for Knowledge Graph Reasoning (AAAI'22)
Learning to Walk with Dual Agents for Knowledge Graph Reasoning (AAAI'22)
Hi,
Regarding the code between line 265-303 in 'trainer.py', are entity-agent and cluster-agent walking independently on the graph?
When I look through this part, I didn't see any synchronization between two agents.
If I'm not correct, could you please tell me which variable is for synchronization?
Otherwise, may I know the rationale behind it? And how do we ensure entities in each step are in the correct corresponding cluster?
Thank you so much in advance!
Below is the code between line 265-303 in 'trainer.py':
for i in range(self.path_length):
loss, cluster_state_emb, logits, idx, chosen_relation, scores = self.c_agent.cluster_step(
prev_possible_clusters, next_possible_clusters,
cluster_state_emb, prev_cluster, end_cluster,
current_clusters_t, range_arr,
first_step_of_test, entity_state_emb
)
c_all_losses.append(loss)
c_all_logits.append(logits)
c_all_action_id.append(idx)
cluster_scores.append(scores)
cluster_state = cluster_episode.next_action(idx) ## important !! switch to next state with new cluster
prev_possible_clusters = next_possible_clusters.clone()
next_possible_clusters = torch.tensor(cluster_state['next_clusters']).long().to(self.device)
current_clusters_t = torch.tensor(cluster_state['current_clusters']).long().to(self.device)
prev_cluster = chosen_relation.to(self.device)
loss, entity_state_emb, logits, idx, chosen_relation = self.e_agent.step(
next_possible_relations,
next_possible_entities, entity_state_emb,
prev_relation, query_relation,
current_entities_t, range_arr,
first_step_of_test, cluster_state_emb
)
entity_state, whether_e_agent_follows_c_agent = entity_episode(idx, prev_cluster.cpu(), i) ## important !! switch to next state with new entity and new relation
next_possible_relations = torch.tensor(entity_state['next_relations']).long().to(self.device)
next_possible_entities = torch.tensor(entity_state['next_entities']).long().to(self.device)
current_entities_t = torch.tensor(entity_state['current_entities']).long().to(self.device)
prev_relation = chosen_relation.to(self.device)
entity_episode.get_stepwise_approximated_reward(current_entities_t, current_clusters_t, prev_entities) ## estimate the reward by taking each step
prev_entities = current_entities_t.clone()
e_all_losses.append(loss)
e_all_logits.append(logits)
e_all_action_id.append(idx)
Hello, could you clarify the clustering process of the dataset? I was testing with the graph.txt of nell trying to extract the rest of the files (training and the embeddings and the JSON files) and couldn't get the same results as running on the existing nell folder, I used TransE and ComplEX for the KG embedding and to get the clusters but it didn't workπ .
I m working on an end-to-end framework and wanted to include your approach.
Thanks in advance.
Hello,
Could you please tell me if I want to get a prediction of a certain fact whether it's valid or not, or a link prediction what methods should I call? I am a bit lost with all the entities and cluster episodes π
Thanks in advance β¨β¨
Hello;
Could you clarify what preprocessing is applied to reach that final processed data?
If I want to use it on a different knowledge graph for example, what do I need?
TIA
Thanks for releasing the codes.
Here are some details I'm wondering. Would you please make me some explanation?
Firstly, the pretrained embeddings are not used by the two agents. So does it mean that there is no association between cluster embeddings and entity embeddings?
Secondly, the reward mechanism shown in the code is not implemented as the paper said. Could you please tell me what the correct implementation looks like?
Thirdly, MRR and MAP are not given by the code. Does the auc output actually mean MAP?
I'd appreciate it if you can solve my puzzles or you can offer a piece of correct version of that project. Thank you very much in advance.
Hi, there,
Could you please share the code which be used for checking the positive reward rate between the CURL and MINERVA? We are intereseted in the reward function, thank you.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
π Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. πππ
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google β€οΈ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.