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

Question about IF-BPR: parameter batch_size is invalid! #142

Closed
rcuu opened this issue Dec 28, 2018 · 4 comments
Closed

Question about IF-BPR: parameter batch_size is invalid! #142

rcuu opened this issue Dec 28, 2018 · 4 comments

Comments

@rcuu
Copy link

rcuu commented Dec 28, 2018

I downloaded the ratings_data.txt and trust_data.txt from HERE, deleted the first line and placed it in dir dataset.

Run a4(IF-BPR) with this configuration file:

ratings=../dataset/epinions/ratings_data.txt
social=../dataset/epinions/trust_data.txt
ratings.setup=-columns 0 1 2
social.setup=-columns 0 1 2
recommender=IF_BPR
evaluation.setup=-cv 5 -b 1
item.ranking=on -topN 10
num.factors=20
num.max.iter=30
IF_BPR=-T 2 -L 20 -l 20 -w 5 -k 150 -a 0.2 -ep 5 -neg 5 -r 0.03
learnRate=-init 0.05 -max 1
reg.lambda=-u 0.01 -i 0.01 -b 0.01 -s 0.2
output.setup=on -dir ../results/

But I have encountered this problem:

please enter the num of the algorithm to run it:a4
loading training data...
loading social data...
preprocessing...
parameter batch_size is invalid!
parameter batch_size is invalid!
parameter batch_size is invalid!
parameter batch_size is invalid!
parameter batch_size is invalid!
Traceback (most recent call last):
  File "main.py", line 150, in <module>
    recSys.execute()
  File "/home/name/Desktop/RecQ/main/RecQ.py", line 100, in execute
    self.measure = [dict(m)[i] for i in range(1,k+1)]
KeyError: 1

Excuse me, may I ask which step did I not do well??

@Coder-Yu
Copy link
Owner

hi, thanks for your interest. I have updated the config file, you can download the new version and try again. Kindly remind you that you have to pick out the negative samples and organized them as a file because IF-BPR needs to read negative samples. Besides, all the datasets used in our paper can be found by accessing https://github.com/CQU-CSE/DatasetCollection. In addition, there is a unintentional mistake in our paper that we recorded users that have less than 20 ratings as the cold users while in the paper we wrote 10.

@rcuu
Copy link
Author

rcuu commented Dec 29, 2018

I compared the old and new versions of IF-BPR.conf as if there was no difference...
Then I read the source code of IF_BPR(IF_BPR.py), and placed the ratings_n.txt containing the negative sample in the dataset/epinions/ directory. The same error persists. QAQ

def readNegativeFeedbacks(self):
    ...
    filename = self.config['ratings'][:-4]+'_n.txt'
    with open(filename) as f:
    ...

@Coder-Yu
Copy link
Owner

It's OK now. Sorry for the mistake.

@rcuu
Copy link
Author

rcuu commented Dec 29, 2018

Solved, thank you for your answer.

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