Exemplo n.º 1
0
item_graph_module = GraphModule(data=contexts)

ratio_split = RatioSplit(data=ratings,
                         test_size=0.2,
                         rating_threshold=3.5,
                         shuffle=True,
                         exclude_unknowns=True,
                         verbose=True,
                         item_graph=item_graph_module)

pcrl = PCRL(k=100, z_dims=[300], max_iter=300, learning_rate=0.001)

# Evaluation metrics
nDgc = metrics.NDCG(k=-1)
rec = metrics.Recall(k=20)
pre = metrics.Precision(k=20)

# Instantiate and run your experiment
exp = Experiment(eval_method=ratio_split,
                 models=[pcrl],
                 metrics=[nDgc, rec, pre])
exp.run()
"""
Output:
     | NDCG@-1 | Recall@20 | Precision@20 | Train (s) | Test (s)
---- + ------- + --------- + ------------ + --------- + --------
pcrl |  0.1922 |    0.0862 |       0.0148 | 2591.4878 |   4.0957

*Results may change slightly from one run to another due to different random initial parameters
"""
Exemplo n.º 2
0
    exclude_unknowns=True,
    verbose=True,
    user_graph=user_graph_modality,
    seed=123,
)

# Instantiate CVAECF model
cvaecf = CVAECF(z_dim=20,
                h_dim=20,
                autoencoder_structure=[40],
                learning_rate=0.001,
                n_epochs=70,
                batch_size=128,
                verbose=True,
                seed=123)

# Evaluation metrics
ndcg = metrics.NDCG(k=50)
rec = metrics.Recall(k=50)
pre = metrics.Precision(k=50)

# Put everything together into an experiment and run it
Experiment(eval_method=ratio_split, models=[cvaecf], metrics=[ndcg, pre,
                                                              rec]).run()
"""
Output:
       | NDCG@50 | Precision@50 | Recall@50 | Train (s) | Test (s)
------ + ------- + ------------ + --------- + --------- + --------
CVAECF |  0.4171 |       0.0781 |    0.8689 |   13.0752 |   1.4574
"""