-
Notifications
You must be signed in to change notification settings - Fork 4
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
Add GRU4Rec example #20
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great work! There was a lot to do with the data processing.
examples/sequential_retrieval.py
Outdated
import os | ||
|
||
os.environ["KERAS_BACKEND"] = "jax" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Any reason to do that? At some point I was thinking we can write tests to run these automatically with each backend. But I never got around to doing that. But for it to work, the backend has to not be set within the file.
Did you test with TF and Torch too?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yep, working for all backends!
examples/sequential_retrieval.py
Outdated
|
||
import keras_rs | ||
|
||
keras.utils.set_random_seed(42) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Any reason to do that?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I set the seed when I was testing training with different hyperparameters, etc. Can remove/keep it, doesn't matter which way
[basic retrieval](https://github.com/keras-team/keras-rs/blob/main/examples/basic_retrieval.py) | ||
example, we are going to use the MovieLens dataset. | ||
|
||
The dataset preparation step is fairly involved. The original ratings dataset |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for porting all the dataset massaging stuff here. That was most of the work I imagine.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, pretty much. I was trying to not do the conversion to Pandas DF, and somehow use tf.data.group_by_window
. At some point, I gave up xD
examples/sequential_retrieval.py
Outdated
import keras | ||
import pandas as pd | ||
import tensorflow as tf # Needed only for the dataset | ||
from keras import ops |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Further down, you're sometimes using keras.ops.x
and sometimes ops.x
. Make it consistent. I don't think this import is necessary.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh, yeah. Sorry about that!
Note: The loss in the TFRS example does not converge. So, changed a few things.