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

error reproducing simulation on FactorUCB #1

Closed
diegoolano opened this issue Mar 21, 2018 · 3 comments
Closed

error reproducing simulation on FactorUCB #1

diegoolano opened this issue Mar 21, 2018 · 3 comments
Labels

Comments

@diegoolano
Copy link

hi, I'm interested in your paper that was published in AAAI 17,
and am trying to get the simulation running, but am receiving the following error.

$ python Simulation.py --alg factorUCB
...
File "Simulation.py", line 508, in
algorithms['LinUCB'] = N_LinUCBAlgorithm(dimension = context_dimension, alpha = alpha, lambda_ = lambda_, n = n_users)
TypeError: init() got an unexpected keyword argument 'n'

This occurs because the constructor for the N_LinUCBAlgorithm class doesn't expect an "n" arg, but instead an "init" one which does not seem related to the "n" in question.

class N_LinUCBAlgorithm:
def init(self, dimension, alpha, lambda_, init="zero"): # n is number of users
self.users = {}

Should I just remove " n = n_users' from the call on line 508 in Simulation.py,
as you sometimes call N_LinUCBA without it from within that same file ( see line 495) ?

algorithms['LinUCB'] = N_LinUCBAlgorithm(dimension = context_dimension, alpha = alpha, lambda_ = lambda_)

Thank you

@diegoolano
Copy link
Author

I'm running things in Python 2.7, and when I removed "n = n_users" from the call above, the code proceeds farther, but then runs into the following error below. Thank you for the assistance.

$ python Simulation.py --alg factorUCB
...
Users 9 CoTheta [ 0.17459147 0.04203424 0.16958883 0.02280975 0.23921426 0.05525657
0.09552645 0.11874966 0.07183244 0.0457676 0.28499082 0.
0.01674014 0.1272744 0.3656073 0.28675806 0.165991 0.07772692
0.17026372 0.07092157]
Traceback (most recent call last):
File "Simulation.py", line 525, in
simExperiment.runAlgorithms(algorithms)
File "Simulation.py", line 302, in runAlgorithms
VDiff[alg_name] += self.getL2Diff(self.articles[pickedArticle.id].featureVector, alg.getV(pickedArticle.id))
File "Simulation.py", line 170, in getL2Diff
return np.linalg.norm(x-y) # L2 norm
ValueError: operands could not be broadcast together with shapes (20,) (25,)

@scheeloong
Copy link

Same error!

@huazhengwang
Copy link
Collaborator

Thank you @diegoolano @scheeloong for pointing out the problem, and it is fixed now:)

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

No branches or pull requests

3 participants