Invalidargumenterror: 2 Root Error(s) Found. (0) Invalid Argument: Indices[10,0] = 101102 Is Not In [0, 101102)
I am trying to create a movie recommendation system by training the neural collaborative filtering (NCF) network on the MovieLens dataset. My implementation of NCF is def NCF(num_u
Solution 1:
I believe this error occurred as a result of the embedding layer encountering a value that it did not expect. When you are calling the NCF
function you are passing the unique number of users of the train set. Instead calculate the unique number of users in the full data set and send it to the NCF
function.
For example:
total_num_users = train_set["user_ID"].nunique() + valid_set["user_ID"].nunique() + test_set["user_ID"]..]nunique()
train(model = NCF(num_users = total_num_users, num_items =
train_set["movie_ID"].nunique() + 1, gmf_embedding_dim = 10, mlp_embedding_dim = 10),
x_train = [train_set["user_ID"], train_set["movie_ID"]], y_train =
train_set["interaction"],
x_valid = [valid_set["user_ID"], valid_set["movie_ID"]], y_valid =
valid_set["interaction"],
batch_size = (train_set.shape[0])/10, epochs = 50, save_name = "NCF_1",
checkpoint_path = "D:/Movie Recommendation System Project/model data/checkpoints",
history_path = "D:/Movie Recommendation System Project/model data/training history")
Make sure to follow the same approach to other categorical variables that you are embedding.
Post a Comment for "Invalidargumenterror: 2 Root Error(s) Found. (0) Invalid Argument: Indices[10,0] = 101102 Is Not In [0, 101102)"