I am following the tutorial, but I am using my own data set, the format is the same as the movie lens dataset except I don't have a timestamp. I have userId, itemid, ratings (purchase count as a rating).
I used the following the code
from recoder.model import Recoder
from recoder.data import RecommendationDataset
from recoder.nn import DynamicAutoencoder
from recoder.metrics import AveragePrecision, Recall, NDCG
Hi all,
@amoussawi
I am following the tutorial, but I am using my own data set, the format is the same as the movie lens dataset except I don't have a timestamp. I have userId, itemid, ratings (purchase count as a rating).
I used the following the code
from recoder.model import Recoder from recoder.data import RecommendationDataset from recoder.nn import DynamicAutoencoder from recoder.metrics import AveragePrecision, Recall, NDCG
import scipy.sparse as sparse
train_matrix = sparse.load_npz('train.npz')
val_input_matrix = sparse.load_npz('test_input.npz') val_target_matrix = sparse.load_npz('test_target.npz')
train_dataset = RecommendationDataset(train_matrix)
val_dataset = RecommendationDataset(val_input_matrix, val_target_matrix)
model = DynamicAutoencoder(hidden_layers=[200], activation_type='tanh', noise_prob=0.5, sparse=True)
metrics = [Recall(k=20, normalize=True), Recall(k=50, normalize=True), NDCG(k=100)]
recoder = Recoder(model=model, use_cuda=False, optimizer_type='adam', loss='logistic')
recoder.train(train_dataset=train_dataset, val_dataset=val_dataset, batch_size=500, lr=1e-3, weight_decay=2e-5, num_epochs=100, num_data_workers=4, negative_sampling=True, metrics=metrics, eval_num_recommendations=100)
It ran. Now I want to recommend the top 10 items for a particular userid or for all userid? How do I do that?
I tried the below code:
from recoder.recommender import InferenceRecommender recommendation = InferenceRecommender(recoder,100)
what do I pass inside recommendation.recommend(------)?
or is there any other way to recommend top 10 items for a particular userid or for all userid?
Any help would be appreciated
Thanks