示例#1
0
sparse_feat_emb = SparseFeatureMapper(num_of_fields=26,
                                      hash_size=[
                                          1444, 555, 175781, 128509, 306, 19,
                                          11931, 630, 4, 93146, 5161, 174835,
                                          3176, 28, 11255, 165206, 11, 4606,
                                          2017, 4, 172322, 18, 16, 56456, 86,
                                          43356
                                      ],
                                      embedding_dim=2)(sparse_input_node)

attention_output = SelfAttentionInteraction()(
    [dense_feat_emb, sparse_feat_emb])
bottom_mlp_output = MLPInteraction()([dense_feat_emb])
top_mlp_output = MLPInteraction()([attention_output, bottom_mlp_output])

output = PointWiseOptimizer()(top_mlp_output)
model = CTRRecommender(inputs=[dense_input_node, sparse_input_node],
                       outputs=output)

# AutoML search and predict.
searcher = Search(
    model=model,
    tuner='random',
    tuner_params={
        'max_trials': 2,
        'overwrite': True
    },
)
searcher.search(x=train_X,
                y=train_y,
                x_val=val_X,
示例#2
0
                                  id_num=10000,
                                  embedding_dim=64)(input)
item_emb_gmf = LatentFactorMapper(feat_column_id=1,
                                  id_num=10000,
                                  embedding_dim=64)(input)

user_emb_mlp = LatentFactorMapper(feat_column_id=0,
                                  id_num=10000,
                                  embedding_dim=64)(input)
item_emb_mlp = LatentFactorMapper(feat_column_id=1,
                                  id_num=10000,
                                  embedding_dim=64)(input)
innerproduct_output = ElementwiseInteraction(elementwise_type="innerporduct")(
    [user_emb_gmf, item_emb_gmf])
mlp_output = MLPInteraction()([user_emb_mlp, item_emb_mlp])
output = PointWiseOptimizer()([innerproduct_output, mlp_output])
model = CTRRecommender(inputs=input, outputs=output)

# AutoML search and predict.
searcher = Search(
    model=model,
    tuner='random',
    tuner_params={
        'max_trials': 10,
        'overwrite': True
    },
)
searcher.search(x=train_X,
                y=train_y,
                x_val=val_X,
                y_val=val_y,
示例#3
0
    # select model
    if args.model == 'dlrm':
        output = build_dlrm(emb_dict)
    if args.model == 'deepfm':
        output = build_deepfm(emb_dict)
    if args.model == 'crossnet':
        output = build_neumf(emb_dict)
    if args.model == 'autoint':
        output = build_autorec(emb_dict)
    if args.model == 'neumf':
        output = build_autorec(emb_dict)
    if args.model == 'autorec':
        output = build_autorec(emb_dict)

    output = PointWiseOptimizer()(output)
    model = CTRRecommender(inputs=input, outputs=output)

    # search and predict.
    searcher = Search(
        model=model,
        tuner=args.search,  ## hyperband, bayesian
        tuner_params={
            'max_trials': args.trials,
            'overwrite': True
        })
    start_time = time.time()
    searcher.search(x=train_X,
                    y=train_y,
                    x_val=val_X,
                    y_val=val_y,