KarypisLab / SLIM

High-performance implementation of SLIM-based approaches for Top-N recommendation
112 stars 17 forks source link

Non-negative value for l1r #3

Closed murak038 closed 4 years ago

murak038 commented 4 years ago

I ran the model selection example provided in UserGuide.ipynb (first code chunk) and got the error (second code chunk). The l1r value is positive and I even tried to switch the sign to be negative and get the same error.


from SLIM import SLIM, SLIMatrix

traindata = pd.read_csv('../../test/AutomotiveTrain.ijv', delimiter=' ', header=None)
valdata = pd.read_csv('../../test/AutomotiveTest.ijv', delimiter=' ', header=None)
trainmat = SLIMatrix(traindata)
# initlaize the validation matrix using the training matrix
valmat = SLIMatrix(valdata, trainmat)

params = {'dbglvl':3, 
          'algo':'cd', 
          'nthreads':1, 
          'l1r':1., 
          'l2r':1.,
          'optTol':1e-7,
          'niters':100}

l1s = [0.01, 0.1, 0.5, 1, 2, 4]
l2s = [0.1, 0.5, 1, 2, 5, 10]

model = SLIM()
model.mselect(params, trainmat, valmat, l1s, l2s, nrcmds=10)```

```$ model.mselect(params, trainmat, valmat, l1s, l2s, nrcmds=10)
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/usr/local/lib/python3.7/site-packages/SLIM-2.0.0-py3.7.egg/SLIM/core.py", line 460, in mselect
  File "/usr/local/lib/python3.7/site-packages/SLIM-2.0.0-py3.7.egg/SLIM/core.py", line 175, in check_dict_params
TypeError: Please provide non-negative value for l1r.```
nikolakopoulos commented 4 years ago

It would also be a good idea to change the values of l1 l2 in the example, since the best performance is achieved at the extreme values of the considered range

shuix007 commented 4 years ago

Hi Rohit,

Thanks for your feedback, the issue is fixed. Please try again.

Zeren

murak038 commented 4 years ago

It works now. Thanks!