hand10ryo / PyTorchCML

PyTorchCML is a library of PyTorch implementations of matrix factorization (MF) and collaborative metric learning (CML), algorithms used in recommendation systems and data mining.
MIT License
20 stars 2 forks source link

Negative Weight not implemented for sampler.BaseSampler? #38

Closed shivamtundele closed 2 years ago

shivamtundele commented 2 years ago

Getting following error,

---------------------------------------------------------------------------
NotImplementedError                       Traceback (most recent call last)
<ipython-input-32-981b35ba5057> in <module>
      2 item_ids, item_popularity = np.unique(cml_train[interaction_col], return_counts=True)
      3 
----> 4 sampler = samplers.BaseSampler(cml_train_set, neg_weight = item_popularity, n_user = n_user, n_item = n_item, device=device)
      5 
      6 lr = 0.01

~/.local/lib/python3.7/site-packages/PyTorchCML/samplers/BaseSampler.py in __init__(self, train_set, n_user, n_item, pos_weight, neg_weight, device, batch_size, n_neg_samples, strict_negative, neutral)
    109 
    110         else:
--> 111             raise NotImplementedError
    112 
    113     def get_pos_batch(self) -> torch.Tensor:

NotImplementedError: 
hand10ryo commented 2 years ago

Sorry I'm late.

This happens when the length of neg_weight does not match any of n_user or n_item. The error is hard to understand, so I will modify the description as such.