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

Performance comparison over different item groups #265

Closed
ksh960910 opened this issue May 30, 2023 · 3 comments
Closed

Performance comparison over different item groups #265

ksh960910 opened this issue May 30, 2023 · 3 comments

Comments

@ksh960910
Copy link

Hi,
Thanks for the great work with SimGCL.
I'm trying to replicate the results of Figure 7 from SimGCL
image
Is there any source code that I can refer to?
I would appreciate your reply.

Best,
Joe

@Coder-Yu
Copy link
Owner

I just have the code for this part in another paper of mine https://arxiv.org/abs/2209.02544

For your reference

def group_evaluation(self,recList,top):
     popularity = {}
     for item in self.data.training_set_i:
         popularity[item] = len(self.data.training_set_i[item])
     testset = []
     for user in self.data.test_set:
         for item in self.data.test_set[user]:
             if item in popularity:
                 testset.append((user,item,popularity[item]))
     testset = sorted(testset,key=lambda d:d[2])
     p_idx = np.linspace(0,len(testset),11)
     p_idx = [round(n) for n in p_idx]
     groups = []
     for i in range(10):
         group = {}
         for user in recList:
             group[user]={}
         for k in testset[p_idx[i]:p_idx[i + 1]]:
             group[k[0]][k[1]] = 1
         groups.append(group)
     measures=[]
     for group in groups:
         ms = ranking_evaluation_group(group, recList, self.data.test_set,top)
         measures.append(ms)

@ksh960910
Copy link
Author

Thanks for the reference, however can I also get the code for 'ranking_evaluation_group' function?
I'm also having trouble getting recall scores from each groups.
I would really appreciate it. Thanks

Best,
Joe

@Coder-Yu
Copy link
Owner

The core code has been provided. Do it yourself

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