Exemplo n.º 1
0
    print("===================================ConvMF Option Setting===================================")
    print("\taux path - %s" % aux_path)
    print("\tdata path - %s" % data_path)
    print("\tresult path - %s" % res_dir)
    print("\tpretrained w2v data path - %s" % pretrain_w2v)
    print("\tdimension: %d\n\tlambda_u: %.4f\n\tlambda_v: %.4f\n\tmax_iter: %d\n\tnum_kernel_per_ws: %d" \
          % (dimension, lambda_u, lambda_v, max_iter, num_kernel_per_ws))
    print("===========================================================================================")

    R, D_all = data_factory.load(aux_path)
    CNN_X = D_all['X_sequence']
    vocab_size = len(D_all['X_vocab']) + 1

    from models import ConvMF

    if pretrain_w2v is None:
        init_W = None
    else:
        init_W = data_factory.read_pretrained_word2vec(
            pretrain_w2v, D_all['X_vocab'], emb_dim)

    train_user = data_factory.read_rating(data_path + '/train_user.dat')
    train_item = data_factory.read_rating(data_path + '/train_item.dat')
    valid_user = data_factory.read_rating(data_path + '/valid_user.dat')
    test_user = data_factory.read_rating(data_path + '/test_user.dat')

    ConvMF(max_iter=max_iter, res_dir=res_dir,
           lambda_u=lambda_u, lambda_v=lambda_v, dimension=dimension, vocab_size=vocab_size, init_W=init_W, give_item_weight=give_item_weight, CNN_X=CNN_X, emb_dim=emb_dim,
           num_kernel_per_ws=num_kernel_per_ws,
           train_user=train_user, train_item=train_item, valid_user=valid_user, test_user=test_user, R=R)
Exemplo n.º 2
0
               valid_user=valid_user,
               test_user=test_user,
               R=R,
               attributes_X=features_matrix,
               cae_output_dim=att_dim,
               use_transfer_block=use_transfer_block)
 elif content_mode == 'cnn':
     ConvMF(max_iter=max_iter,
            res_dir=fold_res_dir,
            state_log_dir=fold_res_dir,
            lambda_u=lambda_u,
            lambda_v=lambda_v,
            dimension=dimension,
            vocab_size=vocab_size,
            init_W=init_W,
            max_len=max_length,
            give_item_weight=give_item_weight,
            CNN_X=CNN_X,
            emb_dim=emb_dim,
            num_kernel_per_ws=num_kernel_per_ws,
            train_user=train_user,
            train_item=train_item,
            valid_user=valid_user,
            test_user=test_user,
            R=R)
 elif content_mode == 'cae':
     # attributes dimension must be euall to u, and v vectors dimension
     CAEMF(max_iter=max_iter,
           res_dir=fold_res_dir,
           state_log_dir=fold_res_dir,
           lambda_u=lambda_u,
           lambda_v=lambda_v,