Closed JustAnotherDataScientist closed 4 years ago
I thought on those steps as well and I agree with your correction actually.
I think that this comment was intended for a different repo (?), because this codebase has no get_metrics
method. (Also, the code above calls methods that are non-existent in this implementation; e.g. model.layers[1].reset_hidden_states
--> assuming that model
is a GRU4Rec
object, its layers
attribute is a list of integers that signal the size of each layer and not the list of actual GRU layers, and thus they don't have a reset_hidden_states
method. Many other things don't align with this repo either.)
The metrics (recall & MRR) can be measured by using either evaluate_sessions_batch
or evaluate_gpu
from evaluation.py
. The latter (evaluate_gpu
) is recommended, because it has higher GPU utilization. The hidden states are reset to zero in lines 184-189
. If you still use evaluate_sessions_batch
, the hidden state is reset to zero inside the predict_next_batch
method in gru4rec.py
whenever any of the session indexes change (see lines 657-662
).
((There is a third evaluation method in evaluation.py
, but that one can't be used to evaluate the GRU4Rec model. It is there for reproducing experiments with the baseline.)
Ho, sorry for that. the code comes from gru4rec Keras implementation
Very sorry, eveTu is right, the code comes from gru4rec Keras ! I close the issue right away. Anyways, thanks for sharing your work Hidasi.
In current version of the code, it seems that there is no reset of hidden states for ending sessions in test batch.
I modified on my local env the get_metrics function to the following :
Can someone confirm that there was an error, and that my correction worked ?