alibaba / Curvature-Learning-Framework

Curvlearn, a Tensorflow based non-Euclidean deep learning framework.
Apache License 2.0
156 stars 31 forks source link

Help needed #1

Closed tita1999 closed 2 years ago

tita1999 commented 2 years ago

Hello, I'm trying to implement HyperML on my data using the manifold PoincareBall. I'm not familiar with TensorFlow so it has been a little hard for me to understand if I need to change some parameters in order for the model to work well. Until now, I've made these changes: image I tried to implement the model but it got stuck on step 1000 and the HR metric doesn't print. You can see that below: image

I am doing something wrong? Another issue relates to the results. When I get to the end of the training, how can I check if my model worked and get some recommendations for a specific user?

Thanks in advance!

longo11070001 commented 2 years ago

Hi, Tita. Thanks for trying CurvatureLearning.

I haven't yet found the exact reason for your problem from the clue that you presented above. For now, my doubt comes from:

  1. Please check if your program suffered from running out of memory or GPU memory
  2. Please check if your program had consumed the entire dataset
  3. Please check if you were using TF=1.15.0
  4. Reduce the "log_steps" to see whether the loss encountered sudden changes at around 1000+ steps
  5. Change the "gamma" parameter to see whether the preset loss function is not appropriate for your own task. If your program still got stuck, could you please provide us with the statistics of your dataset, as well as the piece of code that you tackle your data? So we may find some hints.

For your second issue, please refer to the Tensorflow Saver on saving and restoring your model checkpoint. To do inference, you could just replace the evaluate function by feeding test_model.predict_scores or test_model. rank_items to the run interface based on the input data of specific users.

XuZhirong commented 2 years ago

Hi, this is the general instruction for debugging the model with curvature.

First, you could try the Euclidean manifold and remove RiemannianParameter, thus the same with the original euclidean model, to verify the correctness of your model. The above hints always solve most issues.

Then carefully tuning the parameters in embedding initializer (with small stddev) and fermi-dirac decoder ($p=\sigma(\lambda - t \cdot \mathbf{x})$ should be around zero with smooth gradient). Now the models are supposed to get stable results.

If issues still exist, trying another manifold such as Stereographic manifold is always a good idea.

Feel free to contact us if you feel hard to implement your model with curvlearn!

tita1999 commented 2 years ago

Hello everybody. First of all, thank you so much for your quick response. I tried your suggestion but it continue not to work until I changed the number of "items" each user has. So, my dataset has more than 50 items for each user, and when I reduced the number of items per user, it started working I don't really know why.

Anyways, then, I saw that my HR was not working and this is the error underlying it:

image

Here is my dataset if you want to try it yourself: data.txt

Thank you.

tita1999 commented 2 years ago

Well nevermind... It worked!!! Thank you so much, you just saved my master thesis!! But if you could explain me why did I had to reduce the number of items per user, I would be so much grateful.

Have a nice day! :)