Exemplo n.º 1
0
                               raw_data['max_item'],
                               name='Test')

model = VisualCML(batch_size=batch_size,
                  max_user=raw_data['max_user'],
                  max_item=raw_data['max_item'],
                  l2_reg=0.001,
                  l2_reg_mlp=0.001,
                  dropout_rate=0.5,
                  dim_embed=50,
                  item_f_source=raw_data['item_features'],
                  dims=[1028, 128, 50],
                  sess_config=sess_config,
                  opt='Adam')
sampler = PairwiseSampler(batch_size=batch_size,
                          dataset=train_dataset,
                          num_process=5)
model_trainer = ImplicitModelTrainer(batch_size=batch_size,
                                     test_batch_size=test_batch_size,
                                     item_serving_size=item_serving_size,
                                     train_dataset=train_dataset,
                                     model=model,
                                     sampler=sampler)

auc_evaluator = AUC()
recall_evaluator = Recall(recall_at=[10, 20, 30, 40, 50, 60, 70, 80, 90, 100])

model_trainer.train(num_itr=int(1e5),
                    display_itr=display_itr,
                    eval_datasets=[val_dataset, test_dataset],
                    evaluators=[auc_evaluator, recall_evaluator],
Exemplo n.º 2
0
                                  max_user=max_users,
                                  max_item=max_items,
                                  name='Val')
    test_dataset = ImplicitDataset(raw_data=csv,
                                   max_user=max_users,
                                   max_item=max_items,
                                   name='Test')

    bpr_model = BPR(batch_size=1000,
                    max_user=train_dataset.max_user(),
                    max_item=train_dataset.max_item(),
                    dim_embed=20,
                    opt='Adam')

    print("before sampler")
    sampler = PairwiseSampler(batch_size=1000, dataset=train_dataset)
    print("after sampler")

    auc_evaluator = AUC()
    print("after evaluator")

    model_trainer = ImplicitModelTrainer(batch_size=1000,
                                         test_batch_size=100,
                                         train_dataset=train_dataset,
                                         model=bpr_model,
                                         sampler=sampler)
    print("after implicit")

    model_trainer.train(num_itr=10,
                        display_itr=10,
                        eval_datasets=[val_dataset, test_dataset],