deepctr.models package¶
Submodules¶
- deepctr.models.afm module
- deepctr.models.autoint module
- deepctr.models.ccpm module
- deepctr.models.dcn module
- deepctr.models.dcnmix module
- deepctr.models.edcn module
- deepctr.models.deepfm module
- deepctr.models.fgcnn module
- deepctr.models.fibinet module
- deepctr.models.fnn module
- deepctr.models.mlr module
- deepctr.models.onn module
- deepctr.models.nfm module
- deepctr.models.pnn module
- deepctr.models.wdl module
- deepctr.models.xdeepfm module
- deepctr.models.flen module
- deepctr.models.ifm module
- deepctr.models.difm module
- deepctr.models.deepfefm module
- deepctr.models.multitask.sharedbottom module
- deepctr.models.multitask.esmm module
- deepctr.models.multitask.mmoe module
- deepctr.models.multitask.ple module
Module contents¶
-
deepctr.models.
AFM
(linear_feature_columns, dnn_feature_columns, fm_group='default_group', use_attention=True, attention_factor=8, l2_reg_linear=1e-05, l2_reg_embedding=1e-05, l2_reg_att=1e-05, afm_dropout=0, seed=1024, task='binary')[source]¶ Instantiates the Attentional Factorization Machine architecture.
Parameters: - linear_feature_columns – An iterable containing all the features used by linear part of the model.
- dnn_feature_columns – An iterable containing all the features used by deep part of the model.
- fm_group – list, group_name of features that will be used to do feature interactions.
- use_attention – bool,whether use attention or not,if set to
False
.it is the same as standard Factorization Machine - attention_factor – positive integer,units in attention net
- l2_reg_linear – float. L2 regularizer strength applied to linear part
- l2_reg_embedding – float. L2 regularizer strength applied to embedding vector
- l2_reg_att – float. L2 regularizer strength applied to attention net
- afm_dropout – float in [0,1), Fraction of the attention net output units to dropout.
- seed – integer ,to use as random seed.
- task – str,
"binary"
for binary logloss or"regression"
for regression loss
Returns: A Keras model instance.
-
deepctr.models.
CCPM
(linear_feature_columns, dnn_feature_columns, conv_kernel_width=(6, 5), conv_filters=(4, 4), dnn_hidden_units=(128, 64), l2_reg_linear=1e-05, l2_reg_embedding=1e-05, l2_reg_dnn=0, dnn_dropout=0, seed=1024, task='binary')[source]¶ Instantiates the Convolutional Click Prediction Model architecture.
Parameters: - linear_feature_columns – An iterable containing all the features used by linear part of the model.
- dnn_feature_columns – An iterable containing all the features used by deep part of the model.
- conv_kernel_width – list,list of positive integer or empty list,the width of filter in each conv layer.
- conv_filters – list,list of positive integer or empty list,the number of filters in each conv layer.
- dnn_hidden_units – list,list of positive integer or empty list, the layer number and units in each layer of DNN.
- l2_reg_linear – float. L2 regularizer strength applied to linear part
- l2_reg_embedding – float. L2 regularizer strength applied to embedding vector
- l2_reg_dnn – float. L2 regularizer strength applied to DNN
- dnn_dropout – float in [0,1), the probability we will drop out a given DNN coordinate.
- init_std – float,to use as the initialize std of embedding vector
- task – str,
"binary"
for binary logloss or"regression"
for regression loss
Returns: A Keras model instance.
-
deepctr.models.
DCN
(linear_feature_columns, dnn_feature_columns, cross_num=2, cross_parameterization='vector', dnn_hidden_units=(256, 128, 64), l2_reg_linear=1e-05, l2_reg_embedding=1e-05, l2_reg_cross=1e-05, l2_reg_dnn=0, seed=1024, dnn_dropout=0, dnn_use_bn=False, dnn_activation='relu', task='binary')[source]¶ Instantiates the Deep&Cross Network architecture.
Parameters: - linear_feature_columns – An iterable containing all the features used by linear part of the model.
- dnn_feature_columns – An iterable containing all the features used by deep part of the model.
- cross_num – positive integet,cross layer number
- cross_parameterization – str,
"vector"
or"matrix"
, how to parameterize the cross network. - dnn_hidden_units – list,list of positive integer or empty list, the layer number and units in each layer of DNN
- l2_reg_linear – float. L2 regularizer strength applied to linear part
- l2_reg_embedding – float. L2 regularizer strength applied to embedding vector
- l2_reg_cross – float. L2 regularizer strength applied to cross net
- l2_reg_dnn – float. L2 regularizer strength applied to DNN
- seed – integer ,to use as random seed.
- dnn_dropout – float in [0,1), the probability we will drop out a given DNN coordinate.
- dnn_use_bn – bool. Whether use BatchNormalization before activation or not DNN
- dnn_activation – Activation function to use in DNN
- task – str,
"binary"
for binary logloss or"regression"
for regression loss
Returns: A Keras model instance.
-
deepctr.models.
IFM
(linear_feature_columns, dnn_feature_columns, dnn_hidden_units=(256, 128, 64), l2_reg_linear=1e-05, l2_reg_embedding=1e-05, l2_reg_dnn=0, seed=1024, dnn_dropout=0, dnn_activation='relu', dnn_use_bn=False, task='binary')[source]¶ Instantiates the IFM Network architecture.
Parameters: - linear_feature_columns – An iterable containing all the features used by linear part of the model.
- dnn_feature_columns – An iterable containing all the features used by deep part of the model.
- dnn_hidden_units – list,list of positive integer or empty list, the layer number and units in each layer of DNN
- l2_reg_linear – float. L2 regularizer strength applied to linear part
- l2_reg_embedding – float. L2 regularizer strength applied to embedding vector
- l2_reg_dnn – float. L2 regularizer strength applied to DNN
- seed – integer ,to use as random seed.
- dnn_dropout – float in [0,1), the probability we will drop out a given DNN coordinate.
- dnn_activation – Activation function to use in DNN
- dnn_use_bn – bool. Whether use BatchNormalization before activation or not in DNN
- task – str,
"binary"
for binary logloss or"regression"
for regression loss
Returns: A Keras model instance.
-
deepctr.models.
DIFM
(linear_feature_columns, dnn_feature_columns, att_embedding_size=8, att_head_num=8, att_res=True, dnn_hidden_units=(256, 128, 64), l2_reg_linear=1e-05, l2_reg_embedding=1e-05, l2_reg_dnn=0, seed=1024, dnn_dropout=0, dnn_activation='relu', dnn_use_bn=False, task='binary')[source]¶ Instantiates the DIFM Network architecture.
Parameters: - linear_feature_columns – An iterable containing all the features used by linear part of the model.
- dnn_feature_columns – An iterable containing all the features used by deep part of the model.
- att_embedding_size – integer, the embedding size in multi-head self-attention network.
- att_head_num – int. The head number in multi-head self-attention network.
- att_res – bool. Whether or not use standard residual connections before output.
- dnn_hidden_units – list,list of positive integer or empty list, the layer number and units in each layer of DNN
- l2_reg_linear – float. L2 regularizer strength applied to linear part
- l2_reg_embedding – float. L2 regularizer strength applied to embedding vector
- l2_reg_dnn – float. L2 regularizer strength applied to DNN
- seed – integer ,to use as random seed.
- dnn_dropout – float in [0,1), the probability we will drop out a given DNN coordinate.
- dnn_activation – Activation function to use in DNN
- dnn_use_bn – bool. Whether use BatchNormalization before activation or not in DNN
- task – str,
"binary"
for binary logloss or"regression"
for regression loss
Returns: A Keras model instance.
-
deepctr.models.
DCNMix
(linear_feature_columns, dnn_feature_columns, cross_num=2, dnn_hidden_units=(256, 128, 64), l2_reg_linear=1e-05, l2_reg_embedding=1e-05, low_rank=32, num_experts=4, l2_reg_cross=1e-05, l2_reg_dnn=0, seed=1024, dnn_dropout=0, dnn_use_bn=False, dnn_activation='relu', task='binary')[source]¶ Instantiates the Deep&Cross Network with mixture of experts architecture.
Parameters: - linear_feature_columns – An iterable containing all the features used by linear part of the model.
- dnn_feature_columns – An iterable containing all the features used by deep part of the model.
- cross_num – positive integet,cross layer number
- dnn_hidden_units – list,list of positive integer or empty list, the layer number and units in each layer of DNN
- l2_reg_linear – float. L2 regularizer strength applied to linear part
- l2_reg_embedding – float. L2 regularizer strength applied to embedding vector
- l2_reg_cross – float. L2 regularizer strength applied to cross net
- l2_reg_dnn – float. L2 regularizer strength applied to DNN
- seed – integer ,to use as random seed.
- dnn_dropout – float in [0,1), the probability we will drop out a given DNN coordinate.
- dnn_use_bn – bool. Whether use BatchNormalization before activation or not DNN
- dnn_activation – Activation function to use in DNN
- low_rank – Positive integer, dimensionality of low-rank sapce.
- num_experts – Positive integer, number of experts.
- task – str,
"binary"
for binary logloss or"regression"
for regression loss
Returns: A Keras model instance.
-
deepctr.models.
MLR
(region_feature_columns, base_feature_columns=None, region_num=4, l2_reg_linear=1e-05, seed=1024, task='binary', bias_feature_columns=None)[source]¶ Instantiates the Mixed Logistic Regression/Piece-wise Linear Model.
Parameters: - region_feature_columns – An iterable containing all the features used by region part of the model.
- base_feature_columns – An iterable containing all the features used by base part of the model.
- region_num – integer > 1,indicate the piece number
- l2_reg_linear – float. L2 regularizer strength applied to weight
- seed – integer ,to use as random seed.
- task – str,
"binary"
for binary logloss or"regression"
for regression loss - bias_feature_columns – An iterable containing all the features used by bias part of the model.
Returns: A Keras model instance.
-
deepctr.models.
DeepFM
(linear_feature_columns, dnn_feature_columns, fm_group=('default_group', ), dnn_hidden_units=(256, 128, 64), l2_reg_linear=1e-05, l2_reg_embedding=1e-05, l2_reg_dnn=0, seed=1024, dnn_dropout=0, dnn_activation='relu', dnn_use_bn=False, task='binary')[source]¶ Instantiates the DeepFM Network architecture.
Parameters: - linear_feature_columns – An iterable containing all the features used by the linear part of the model.
- dnn_feature_columns – An iterable containing all the features used by the deep part of the model.
- fm_group – list, group_name of features that will be used to do feature interactions.
- dnn_hidden_units – list,list of positive integer or empty list, the layer number and units in each layer of DNN
- l2_reg_linear – float. L2 regularizer strength applied to linear part
- l2_reg_embedding – float. L2 regularizer strength applied to embedding vector
- l2_reg_dnn – float. L2 regularizer strength applied to DNN
- seed – integer ,to use as random seed.
- dnn_dropout – float in [0,1), the probability we will drop out a given DNN coordinate.
- dnn_activation – Activation function to use in DNN
- dnn_use_bn – bool. Whether use BatchNormalization before activation or not in DNN
- task – str,
"binary"
for binary logloss or"regression"
for regression loss
Returns: A Keras model instance.
-
deepctr.models.
MLR
(region_feature_columns, base_feature_columns=None, region_num=4, l2_reg_linear=1e-05, seed=1024, task='binary', bias_feature_columns=None)[source] Instantiates the Mixed Logistic Regression/Piece-wise Linear Model.
Parameters: - region_feature_columns – An iterable containing all the features used by region part of the model.
- base_feature_columns – An iterable containing all the features used by base part of the model.
- region_num – integer > 1,indicate the piece number
- l2_reg_linear – float. L2 regularizer strength applied to weight
- seed – integer ,to use as random seed.
- task – str,
"binary"
for binary logloss or"regression"
for regression loss - bias_feature_columns – An iterable containing all the features used by bias part of the model.
Returns: A Keras model instance.
-
deepctr.models.
NFM
(linear_feature_columns, dnn_feature_columns, dnn_hidden_units=(256, 128, 64), l2_reg_embedding=1e-05, l2_reg_linear=1e-05, l2_reg_dnn=0, seed=1024, bi_dropout=0, dnn_dropout=0, dnn_activation='relu', task='binary')[source]¶ Instantiates the Neural Factorization Machine architecture.
Parameters: - linear_feature_columns – An iterable containing all the features used by linear part of the model.
- dnn_feature_columns – An iterable containing all the features used by deep part of the model.
- dnn_hidden_units – list,list of positive integer or empty list, the layer number and units in each layer of deep net
- l2_reg_embedding – float. L2 regularizer strength applied to embedding vector
- l2_reg_linear – float. L2 regularizer strength applied to linear part.
- l2_reg_dnn – float . L2 regularizer strength applied to DNN
- seed – integer ,to use as random seed.
- biout_dropout – When not
None
, the probability we will drop out the output of BiInteractionPooling Layer. - dnn_dropout – float in [0,1), the probability we will drop out a given DNN coordinate.
- dnn_activation – Activation function to use in deep net
- task – str,
"binary"
for binary logloss or"regression"
for regression loss
Returns: A Keras model instance.
-
deepctr.models.
DIN
(dnn_feature_columns, history_feature_list, dnn_use_bn=False, dnn_hidden_units=(256, 128, 64), dnn_activation='relu', att_hidden_size=(80, 40), att_activation='dice', att_weight_normalization=False, l2_reg_dnn=0, l2_reg_embedding=1e-06, dnn_dropout=0, seed=1024, task='binary')[source]¶ Instantiates the Deep Interest Network architecture.
Parameters: - dnn_feature_columns – An iterable containing all the features used by deep part of the model.
- history_feature_list – list,to indicate sequence sparse field
- dnn_use_bn – bool. Whether use BatchNormalization before activation or not in deep net
- dnn_hidden_units – list,list of positive integer or empty list, the layer number and units in each layer of deep net
- dnn_activation – Activation function to use in deep net
- att_hidden_size – list,list of positive integer , the layer number and units in each layer of attention net
- att_activation – Activation function to use in attention net
- att_weight_normalization – bool.Whether normalize the attention score of local activation unit.
- l2_reg_dnn – float. L2 regularizer strength applied to DNN
- l2_reg_embedding – float. L2 regularizer strength applied to embedding vector
- dnn_dropout – float in [0,1), the probability we will drop out a given DNN coordinate.
- seed – integer ,to use as random seed.
- task – str,
"binary"
for binary logloss or"regression"
for regression loss
Returns: A Keras model instance.
-
deepctr.models.
DIEN
(dnn_feature_columns, history_feature_list, gru_type='GRU', use_negsampling=False, alpha=1.0, use_bn=False, dnn_hidden_units=(256, 128, 64), dnn_activation='relu', att_hidden_units=(64, 16), att_activation='dice', att_weight_normalization=True, l2_reg_dnn=0, l2_reg_embedding=1e-06, dnn_dropout=0, seed=1024, task='binary')[source]¶ Instantiates the Deep Interest Evolution Network architecture.
Parameters: - dnn_feature_columns – An iterable containing all the features used by deep part of the model.
- history_feature_list – list,to indicate sequence sparse field
- gru_type – str,can be GRU AIGRU AUGRU AGRU
- use_negsampling – bool, whether or not use negtive sampling
- alpha – float ,weight of auxiliary_loss
- use_bn – bool. Whether use BatchNormalization before activation or not in deep net
- dnn_hidden_units – list,list of positive integer or empty list, the layer number and units in each layer of DNN
- dnn_activation – Activation function to use in DNN
- att_hidden_units – list,list of positive integer , the layer number and units in each layer of attention net
- att_activation – Activation function to use in attention net
- att_weight_normalization – bool.Whether normalize the attention score of local activation unit.
- l2_reg_dnn – float. L2 regularizer strength applied to DNN
- l2_reg_embedding – float. L2 regularizer strength applied to embedding vector
- dnn_dropout – float in [0,1), the probability we will drop out a given DNN coordinate.
- init_std – float,to use as the initialize std of embedding vector
- seed – integer ,to use as random seed.
- task – str,
"binary"
for binary logloss or"regression"
for regression loss
Returns: A Keras model instance.
-
deepctr.models.
FNN
(linear_feature_columns, dnn_feature_columns, dnn_hidden_units=(256, 128, 64), l2_reg_embedding=1e-05, l2_reg_linear=1e-05, l2_reg_dnn=0, seed=1024, dnn_dropout=0, dnn_activation='relu', task='binary')[source]¶ Instantiates the Factorization-supported Neural Network architecture.
Parameters: - linear_feature_columns – An iterable containing all the features used by linear part of the model.
- dnn_feature_columns – An iterable containing all the features used by deep part of the model.
- dnn_hidden_units – list,list of positive integer or empty list, the layer number and units in each layer of deep net
- l2_reg_embedding – float. L2 regularizer strength applied to embedding vector
- l2_reg_linear – float. L2 regularizer strength applied to linear weight
- l2_reg_dnn – float . L2 regularizer strength applied to DNN
- seed – integer ,to use as random seed.
- dnn_dropout – float in [0,1), the probability we will drop out a given DNN coordinate.
- dnn_activation – Activation function to use in DNN
- task – str,
"binary"
for binary logloss or"regression"
for regression loss
Returns: A Keras model instance.
-
deepctr.models.
PNN
(dnn_feature_columns, dnn_hidden_units=(256, 128, 64), l2_reg_embedding=1e-05, l2_reg_dnn=0, seed=1024, dnn_dropout=0, dnn_activation='relu', use_inner=True, use_outter=False, kernel_type='mat', task='binary')[source]¶ Instantiates the Product-based Neural Network architecture.
Parameters: - dnn_feature_columns – An iterable containing all the features used by deep part of the model.
- dnn_hidden_units – list,list of positive integer or empty list, the layer number and units in each layer of deep net
- l2_reg_embedding – float . L2 regularizer strength applied to embedding vector
- l2_reg_dnn – float. L2 regularizer strength applied to DNN
- seed – integer ,to use as random seed.
- dnn_dropout – float in [0,1), the probability we will drop out a given DNN coordinate.
- dnn_activation – Activation function to use in DNN
- use_inner – bool,whether use inner-product or not.
- use_outter – bool,whether use outter-product or not.
- kernel_type – str,kernel_type used in outter-product,can be
'mat'
,'vec'
or'num'
- task – str,
"binary"
for binary logloss or"regression"
for regression loss
Returns: A Keras model instance.
-
deepctr.models.
WDL
(linear_feature_columns, dnn_feature_columns, dnn_hidden_units=(256, 128, 64), l2_reg_linear=1e-05, l2_reg_embedding=1e-05, l2_reg_dnn=0, seed=1024, dnn_dropout=0, dnn_activation='relu', task='binary')[source]¶ Instantiates the Wide&Deep Learning architecture.
Parameters: - linear_feature_columns – An iterable containing all the features used by linear part of the model.
- dnn_feature_columns – An iterable containing all the features used by deep part of the model.
- dnn_hidden_units – list,list of positive integer or empty list, the layer number and units in each layer of DNN
- l2_reg_linear – float. L2 regularizer strength applied to wide part
- l2_reg_embedding – float. L2 regularizer strength applied to embedding vector
- l2_reg_dnn – float. L2 regularizer strength applied to DNN
- seed – integer ,to use as random seed.
- dnn_dropout – float in [0,1), the probability we will drop out a given DNN coordinate.
- dnn_activation – Activation function to use in DNN
- task – str,
"binary"
for binary logloss or"regression"
for regression loss
Returns: A Keras model instance.
-
deepctr.models.
xDeepFM
(linear_feature_columns, dnn_feature_columns, dnn_hidden_units=(256, 128, 64), cin_layer_size=(128, 128), cin_split_half=True, cin_activation='relu', l2_reg_linear=1e-05, l2_reg_embedding=1e-05, l2_reg_dnn=0, l2_reg_cin=0, seed=1024, dnn_dropout=0, dnn_activation='relu', dnn_use_bn=False, task='binary')[source]¶ Instantiates the xDeepFM architecture.
Parameters: - linear_feature_columns – An iterable containing all the features used by linear part of the model.
- dnn_feature_columns – An iterable containing all the features used by deep part of the model.
- dnn_hidden_units – list,list of positive integer or empty list, the layer number and units in each layer of deep net
- cin_layer_size – list,list of positive integer or empty list, the feature maps in each hidden layer of Compressed Interaction Network
- cin_split_half – bool.if set to True, half of the feature maps in each hidden will connect to output unit
- cin_activation – activation function used on feature maps
- l2_reg_linear – float. L2 regularizer strength applied to linear part
- l2_reg_embedding – L2 regularizer strength applied to embedding vector
- l2_reg_dnn – L2 regularizer strength applied to deep net
- l2_reg_cin – L2 regularizer strength applied to CIN.
- seed – integer ,to use as random seed.
- dnn_dropout – float in [0,1), the probability we will drop out a given DNN coordinate.
- dnn_activation – Activation function to use in DNN
- dnn_use_bn – bool. Whether use BatchNormalization before activation or not in DNN
- task – str,
"binary"
for binary logloss or"regression"
for regression loss
Returns: A Keras model instance.
-
deepctr.models.
AutoInt
(linear_feature_columns, dnn_feature_columns, att_layer_num=3, att_embedding_size=8, att_head_num=2, att_res=True, dnn_hidden_units=(256, 128, 64), dnn_activation='relu', l2_reg_linear=1e-05, l2_reg_embedding=1e-05, l2_reg_dnn=0, dnn_use_bn=False, dnn_dropout=0, seed=1024, task='binary')[source]¶ Instantiates the AutoInt Network architecture.
Parameters: - linear_feature_columns – An iterable containing all the features used by linear part of the model.
- dnn_feature_columns – An iterable containing all the features used by deep part of the model.
- att_layer_num – int.The InteractingLayer number to be used.
- att_embedding_size – int.The embedding size in multi-head self-attention network.
- att_head_num – int.The head number in multi-head self-attention network.
- att_res – bool.Whether or not use standard residual connections before output.
- dnn_hidden_units – list,list of positive integer or empty list, the layer number and units in each layer of DNN
- dnn_activation – Activation function to use in DNN
- l2_reg_linear – float. L2 regularizer strength applied to linear part
- l2_reg_embedding – float. L2 regularizer strength applied to embedding vector
- l2_reg_dnn – float. L2 regularizer strength applied to DNN
- dnn_use_bn – bool. Whether use BatchNormalization before activation or not in DNN
- dnn_dropout – float in [0,1), the probability we will drop out a given DNN coordinate.
- seed – integer ,to use as random seed.
- task – str,
"binary"
for binary logloss or"regression"
for regression loss
Returns: A Keras model instance.
-
deepctr.models.
ONN
(linear_feature_columns, dnn_feature_columns, dnn_hidden_units=(256, 128, 64), l2_reg_embedding=1e-05, l2_reg_linear=1e-05, l2_reg_dnn=0, dnn_dropout=0, seed=1024, use_bn=True, reduce_sum=False, task='binary')[source]¶ Instantiates the Operation-aware Neural Networks architecture.
Parameters: - linear_feature_columns – An iterable containing all the features used by linear part of the model.
- dnn_feature_columns – An iterable containing all the features used by deep part of the model.
- dnn_hidden_units – list,list of positive integer or empty list, the layer number and units in each layer of deep net
- l2_reg_embedding – float. L2 regularizer strength applied to embedding vector
- l2_reg_linear – float. L2 regularizer strength applied to linear part.
- l2_reg_dnn – float . L2 regularizer strength applied to DNN
- seed – integer ,to use as random seed.
- dnn_dropout – float in [0,1), the probability we will drop out a given DNN coordinate.
- use_bn – bool,whether use bn after ffm out or not
- reduce_sum – bool,whether apply reduce_sum on cross vector
- task – str,
"binary"
for binary logloss or"regression"
for regression loss
Returns: A Keras model instance.
-
deepctr.models.
FGCNN
(linear_feature_columns, dnn_feature_columns, conv_kernel_width=(7, 7, 7, 7), conv_filters=(14, 16, 18, 20), new_maps=(3, 3, 3, 3), pooling_width=(2, 2, 2, 2), dnn_hidden_units=(256, 128, 64), l2_reg_linear=1e-05, l2_reg_embedding=1e-05, l2_reg_dnn=0, dnn_dropout=0, seed=1024, task='binary')[source]¶ Instantiates the Feature Generation by Convolutional Neural Network architecture.
Parameters: - linear_feature_columns – An iterable containing all the features used by linear part of the model.
- dnn_feature_columns – An iterable containing all the features used by deep part of the model.
- conv_kernel_width – list,list of positive integer or empty list,the width of filter in each conv layer.
- conv_filters – list,list of positive integer or empty list,the number of filters in each conv layer.
- new_maps – list, list of positive integer or empty list, the feature maps of generated features.
- pooling_width – list, list of positive integer or empty list,the width of pooling layer.
- dnn_hidden_units – list,list of positive integer or empty list, the layer number and units in each layer of deep net.
- l2_reg_linear – float. L2 regularizer strength applied to linear part
- l2_reg_embedding – float. L2 regularizer strength applied to embedding vector
- l2_reg_dnn – float. L2 regularizer strength applied to DNN
- dnn_dropout – float in [0,1), the probability we will drop out a given DNN coordinate.
- seed – integer ,to use as random seed.
- task – str,
"binary"
for binary logloss or"regression"
for regression loss
Returns: A Keras model instance.
-
deepctr.models.
DSIN
(dnn_feature_columns, sess_feature_list, sess_max_count=5, bias_encoding=False, att_embedding_size=1, att_head_num=8, dnn_hidden_units=(256, 128, 64), dnn_activation='relu', dnn_dropout=0, dnn_use_bn=False, l2_reg_dnn=0, l2_reg_embedding=1e-06, seed=1024, task='binary')[source]¶ Instantiates the Deep Session Interest Network architecture.
Parameters: - dnn_feature_columns – An iterable containing all the features used by deep part of the model.
- sess_feature_list – list,to indicate sequence sparse field
- sess_max_count – positive int, to indicate the max number of sessions
- sess_len_max – positive int, to indicate the max length of each session
- bias_encoding – bool. Whether use bias encoding or postional encoding
- att_embedding_size – positive int, the embedding size of each attention head
- att_head_num – positive int, the number of attention head
- dnn_hidden_units – list,list of positive integer or empty list, the layer number and units in each layer of deep net
- dnn_activation – Activation function to use in deep net
- dnn_dropout – float in [0,1), the probability we will drop out a given DNN coordinate.
- dnn_use_bn – bool. Whether use BatchNormalization before activation or not in deep net
- l2_reg_dnn – float. L2 regularizer strength applied to DNN
- l2_reg_embedding – float. L2 regularizer strength applied to embedding vector
- seed – integer ,to use as random seed.
- task – str,
"binary"
for binary logloss or"regression"
for regression loss
Returns: A Keras model instance.
-
deepctr.models.
FiBiNET
(linear_feature_columns, dnn_feature_columns, bilinear_type='interaction', reduction_ratio=3, dnn_hidden_units=(256, 128, 64), l2_reg_linear=1e-05, l2_reg_embedding=1e-05, l2_reg_dnn=0, seed=1024, dnn_dropout=0, dnn_activation='relu', task='binary')[source]¶ Instantiates the Feature Importance and Bilinear feature Interaction NETwork architecture.
Parameters: - linear_feature_columns – An iterable containing all the features used by linear part of the model.
- dnn_feature_columns – An iterable containing all the features used by deep part of the model.
- bilinear_type – str,bilinear function type used in Bilinear Interaction Layer,can be
'all'
,'each'
or'interaction'
- reduction_ratio – integer in [1,inf), reduction ratio used in SENET Layer
- dnn_hidden_units – list,list of positive integer or empty list, the layer number and units in each layer of DNN
- l2_reg_linear – float. L2 regularizer strength applied to wide part
- l2_reg_embedding – float. L2 regularizer strength applied to embedding vector
- l2_reg_dnn – float. L2 regularizer strength applied to DNN
- seed – integer ,to use as random seed.
- dnn_dropout – float in [0,1), the probability we will drop out a given DNN coordinate.
- dnn_activation – Activation function to use in DNN
- task – str,
"binary"
for binary logloss or"regression"
for regression loss
Returns: A Keras model instance.
-
deepctr.models.
FLEN
(linear_feature_columns, dnn_feature_columns, dnn_hidden_units=(256, 128, 64), l2_reg_linear=1e-05, l2_reg_embedding=1e-05, l2_reg_dnn=0, seed=1024, dnn_dropout=0.0, dnn_activation='relu', dnn_use_bn=False, task='binary')[source]¶ Instantiates the FLEN Network architecture.
Parameters: - linear_feature_columns – An iterable containing all the features used by linear part of the model.
- dnn_feature_columns – An iterable containing all the features used by deep part of the model.
- dnn_hidden_units – list,list of positive integer or empty list, the layer number and units in each layer of deep net
- l2_reg_linear – float. L2 regularizer strength applied to linear part
- l2_reg_embedding – float. L2 regularizer strength applied to embedding vector
- l2_reg_dnn – float. L2 regularizer strength applied to DNN
- seed – integer ,to use as random seed.
- dnn_dropout – float in [0,1), the probability we will drop out a given DNN coordinate.
- dnn_activation – Activation function to use in DNN
- dnn_use_bn – bool. Whether use BatchNormalization before activation or not in DNN
- task – str,
"binary"
for binary logloss or"regression"
for regression loss
Returns: A Keras model instance.
-
deepctr.models.
FwFM
(linear_feature_columns, dnn_feature_columns, fm_group=('default_group', ), dnn_hidden_units=(256, 128, 64), l2_reg_linear=1e-05, l2_reg_embedding=1e-05, l2_reg_field_strength=1e-05, l2_reg_dnn=0, seed=1024, dnn_dropout=0, dnn_activation='relu', dnn_use_bn=False, task='binary')[source]¶ Instantiates the FwFM Network architecture.
Parameters: - linear_feature_columns – An iterable containing all the features used by linear part of the model.
- dnn_feature_columns – An iterable containing all the features used by deep part of the model.
- fm_group – list, group_name of features that will be used to do feature interactions.
- dnn_hidden_units – list,list of positive integer or empty list if do not want DNN, the layer number and units
in each layer of DNN :param l2_reg_linear: float. L2 regularizer strength applied to linear part :param l2_reg_field_strength: float. L2 regularizer strength applied to the field pair strength parameters :param l2_reg_embedding: float. L2 regularizer strength applied to embedding vector :param l2_reg_dnn: float. L2 regularizer strength applied to DNN :param seed: integer ,to use as random seed. :param dnn_dropout: float in [0,1), the probability we will drop out a given DNN coordinate. :param dnn_activation: Activation function to use in DNN :param dnn_use_bn: bool. Whether use BatchNormalization before activation or not in DNN :param task: str,
"binary"
for binary logloss or"regression"
for regression loss :return: A Keras model instance.
-
deepctr.models.
BST
(dnn_feature_columns, history_feature_list, transformer_num=1, att_head_num=8, use_bn=False, dnn_hidden_units=(256, 128, 64), dnn_activation='relu', l2_reg_dnn=0, l2_reg_embedding=1e-06, dnn_dropout=0.0, seed=1024, task='binary')[source]¶ Instantiates the BST architecture.
Parameters: - dnn_feature_columns – An iterable containing all the features used by deep part of the model.
- history_feature_list – list, to indicate sequence sparse field.
- transformer_num – int, the number of transformer layer.
- att_head_num – int, the number of heads in multi-head self attention.
- use_bn – bool. Whether use BatchNormalization before activation or not in deep net
- dnn_hidden_units – list,list of positive integer or empty list, the layer number and units in each layer of DNN
- dnn_activation – Activation function to use in DNN
- l2_reg_dnn – float. L2 regularizer strength applied to DNN
- l2_reg_embedding – float. L2 regularizer strength applied to embedding vector
- dnn_dropout – float in [0,1), the probability we will drop out a given DNN coordinate.
- seed – integer ,to use as random seed.
- task – str,
"binary"
for binary logloss or"regression"
for regression loss
Returns: A Keras model instance.
-
deepctr.models.
DeepFEFM
(linear_feature_columns, dnn_feature_columns, use_fefm=True, dnn_hidden_units=(256, 128, 64), l2_reg_linear=1e-05, l2_reg_embedding_feat=1e-05, l2_reg_embedding_field=1e-05, l2_reg_dnn=0, seed=1024, dnn_dropout=0.0, exclude_feature_embed_in_dnn=False, use_linear=True, use_fefm_embed_in_dnn=True, dnn_activation='relu', dnn_use_bn=False, task='binary')[source]¶ Instantiates the DeepFEFM Network architecture or the shallow FEFM architecture (Ablation studies supported)
Parameters: - linear_feature_columns – An iterable containing all the features used by linear part of the model.
- dnn_feature_columns – An iterable containing all the features used by deep part of the model.
- fm_group – list, group_name of features that will be used to do feature interactions.
- use_fefm – bool,use FEFM logit or not (doesn’t effect FEFM embeddings in DNN, controls only the use of final FEFM logit)
- dnn_hidden_units – list,list of positive integer or empty list, the layer number and units in each layer of DNN
- l2_reg_linear – float. L2 regularizer strength applied to linear part
- l2_reg_embedding_feat – float. L2 regularizer strength applied to embedding vector of features
- l2_reg_embedding_field – float, L2 regularizer to field embeddings
- l2_reg_dnn – float. L2 regularizer strength applied to DNN
- seed – integer ,to use as random seed.
- dnn_dropout – float in [0,1), the probability we will drop out a given DNN coordinate.
- exclude_feature_embed_in_dnn – bool, used in ablation studies for removing feature embeddings in DNN
- use_linear – bool, used in ablation studies
- use_fefm_embed_in_dnn – bool, True if FEFM interaction embeddings are to be used in FEFM (set False for Ablation)
- dnn_activation – Activation function to use in DNN
- dnn_use_bn – bool. Whether use BatchNormalization before activation or not in DNN
- task – str,
"binary"
for binary logloss or"regression"
for regression loss
Returns: A Keras model instance.
Instantiates the SharedBottom multi-task learning Network architecture.
Parameters: - dnn_feature_columns – An iterable containing all the features used by deep part of the model.
- bottom_dnn_hidden_units – list,list of positive integer or empty list, the layer number and units in each layer of shared bottom DNN.
- tower_dnn_hidden_units – list,list of positive integer or empty list, the layer number and units in each layer of task-specific DNN.
- l2_reg_embedding – float. L2 regularizer strength applied to embedding vector
- l2_reg_dnn – float. L2 regularizer strength applied to DNN
- seed – integer ,to use as random seed.
- dnn_dropout – float in [0,1), the probability we will drop out a given DNN coordinate.
- dnn_activation – Activation function to use in DNN
- dnn_use_bn – bool. Whether use BatchNormalization before activation or not in DNN
- task_types – list of str, indicating the loss of each tasks,
"binary"
for binary logloss or"regression"
for regression loss. e.g. [‘binary’, ‘regression’] - task_names – list of str, indicating the predict target of each tasks
Returns: A Keras model instance.
-
deepctr.models.
ESMM
(dnn_feature_columns, tower_dnn_hidden_units=(256, 128, 64), l2_reg_embedding=1e-05, l2_reg_dnn=0, seed=1024, dnn_dropout=0, dnn_activation='relu', dnn_use_bn=False, task_types=('binary', 'binary'), task_names=('ctr', 'ctcvr'))[source]¶ Instantiates the Entire Space Multi-Task Model architecture.
Parameters: - dnn_feature_columns – An iterable containing all the features used by deep part of the model.
- tower_dnn_hidden_units – list,list of positive integer or empty list, the layer number and units in each layer of task DNN.
- l2_reg_embedding – float. L2 regularizer strength applied to embedding vector.
- l2_reg_dnn – float. L2 regularizer strength applied to DNN.
- seed – integer ,to use as random seed.
- dnn_dropout – float in [0,1), the probability we will drop out a given DNN coordinate.
- dnn_activation – Activation function to use in DNN
- dnn_use_bn – bool. Whether use BatchNormalization before activation or not in DNN
- task_types – str, indicating the loss of each tasks,
"binary"
for binary logloss or"regression"
for regression loss. - task_names – list of str, indicating the predict target of each tasks. default value is [‘ctr’, ‘ctcvr’]
Returns: A Keras model instance.
-
deepctr.models.
MMOE
(dnn_feature_columns, num_experts=3, expert_dnn_hidden_units=(256, 128), tower_dnn_hidden_units=(64, ), gate_dnn_hidden_units=(), l2_reg_embedding=1e-05, l2_reg_dnn=0, seed=1024, dnn_dropout=0, dnn_activation='relu', dnn_use_bn=False, task_types=('binary', 'binary'), task_names=('ctr', 'ctcvr'))[source]¶ Instantiates the Multi-gate Mixture-of-Experts multi-task learning architecture.
Parameters: - dnn_feature_columns – An iterable containing all the features used by deep part of the model.
- num_experts – integer, number of experts.
- expert_dnn_hidden_units – list,list of positive integer or empty list, the layer number and units in each layer of expert DNN.
- tower_dnn_hidden_units – list,list of positive integer or empty list, the layer number and units in each layer of task-specific DNN.
- gate_dnn_hidden_units – list,list of positive integer or empty list, the layer number and units in each layer of gate DNN.
- l2_reg_embedding – float. L2 regularizer strength applied to embedding vector
- l2_reg_dnn – float. L2 regularizer strength applied to DNN
- seed – integer ,to use as random seed.
- dnn_dropout – float in [0,1), the probability we will drop out a given DNN coordinate.
- dnn_activation – Activation function to use in DNN
- dnn_use_bn – bool. Whether use BatchNormalization before activation or not in DNN
- task_types – list of str, indicating the loss of each tasks,
"binary"
for binary logloss,"regression"
for regression loss. e.g. [‘binary’, ‘regression’] - task_names – list of str, indicating the predict target of each tasks
Returns: a Keras model instance
-
deepctr.models.
PLE
(dnn_feature_columns, shared_expert_num=1, specific_expert_num=1, num_levels=2, expert_dnn_hidden_units=(256, ), tower_dnn_hidden_units=(64, ), gate_dnn_hidden_units=(), l2_reg_embedding=1e-05, l2_reg_dnn=0, seed=1024, dnn_dropout=0, dnn_activation='relu', dnn_use_bn=False, task_types=('binary', 'binary'), task_names=('ctr', 'ctcvr'))[source]¶ Instantiates the multi level of Customized Gate Control of Progressive Layered Extraction architecture.
Parameters: - dnn_feature_columns – An iterable containing all the features used by deep part of the model.
- shared_expert_num – integer, number of task-shared experts.
- specific_expert_num – integer, number of task-specific experts.
- num_levels – integer, number of CGC levels.
- expert_dnn_hidden_units – list,list of positive integer or empty list, the layer number and units in each layer of expert DNN.
- tower_dnn_hidden_units – list,list of positive integer or empty list, the layer number and units in each layer of task-specific DNN.
- gate_dnn_hidden_units – list,list of positive integer or empty list, the layer number and units in each layer of gate DNN.
- l2_reg_embedding – float. L2 regularizer strength applied to embedding vector.
- l2_reg_dnn – float. L2 regularizer strength applied to DNN.
- seed – integer ,to use as random seed.
- dnn_dropout – float in [0,1), the probability we will drop out a given DNN coordinate.
- dnn_activation – Activation function to use in DNN.
- dnn_use_bn – bool. Whether use BatchNormalization before activation or not in DNN.
- task_types – list of str, indicating the loss of each tasks,
"binary"
for binary logloss,"regression"
for regression loss. e.g. [‘binary’, ‘regression’] - task_names – list of str, indicating the predict target of each tasks
Returns: a Keras model instance.
-
deepctr.models.
EDCN
(linear_feature_columns, dnn_feature_columns, cross_num=2, cross_parameterization='vector', bridge_type='concatenation', tau=1.0, l2_reg_linear=1e-05, l2_reg_embedding=1e-05, l2_reg_cross=1e-05, l2_reg_dnn=0, seed=1024, dnn_dropout=0, dnn_use_bn=False, dnn_activation='relu', task='binary')[source]¶ Instantiates the Enhanced Deep&Cross Network architecture.
Parameters: - linear_feature_columns – An iterable containing all the features used by linear part of the model.
- dnn_feature_columns – An iterable containing all the features used by deep part of the model.
- cross_num – positive integet,cross layer number
- cross_parameterization – str,
"vector"
or"matrix"
, how to parameterize the cross network. - bridge_type – The type of bridge interaction, one of
"pointwise_addition"
,"hadamard_product"
,"concatenation"
,"attention_pooling"
- tau – Positive float, the temperature coefficient to control distribution of field-wise gating unit
- l2_reg_linear – float. L2 regularizer strength applied to linear part
- l2_reg_embedding – float. L2 regularizer strength applied to embedding vector
- l2_reg_cross – float. L2 regularizer strength applied to cross net
- l2_reg_dnn – float. L2 regularizer strength applied to DNN
- seed – integer ,to use as random seed.
- dnn_dropout – float in [0,1), the probability we will drop out a given DNN coordinate.
- dnn_use_bn – bool. Whether use BatchNormalization before activation or not DNN
- dnn_activation – Activation function to use in DNN
- task – str,
"binary"
for binary logloss or"regression"
for regression loss
Returns: A Keras model instance.