MCPcopy Create free account
hub / github.com/DeepRec-AI/DeepRec / __init__

Method __init__

modelzoo/esmm/train.py:61–113  ·  view source on GitHub ↗
(self,
                 input,
                 user_column,
                 item_column,
                 combo_column,
                 user_mlp=[256, 128, 96, 64],
                 item_mlp=[256, 128, 96, 64],
                 combo_mlp=[128, 96, 64, 32],
                 cvr_mlp=[256, 128, 96, 64],
                 ctr_mlp=[256, 128, 96, 64],
                 batch_size=None,
                 optimizer_type='adam',
                 bf16=False,
                 stock_tf=None,
                 adaptive_emb=False,
                 learning_rate=0.1,
                 l2_scale=1e-6,
                 input_layer_partitioner=None,
                 dense_layer_partitioner=None)

Source from the content-addressed store, hash-verified

59headers = LABEL_COLUMNS + ALL_FEATURE_COLUMNS
60class ESMM():
61 def __init__(self,
62 input,
63 user_column,
64 item_column,
65 combo_column,
66 user_mlp=[256, 128, 96, 64],
67 item_mlp=[256, 128, 96, 64],
68 combo_mlp=[128, 96, 64, 32],
69 cvr_mlp=[256, 128, 96, 64],
70 ctr_mlp=[256, 128, 96, 64],
71 batch_size=None,
72 optimizer_type='adam',
73 bf16=False,
74 stock_tf=None,
75 adaptive_emb=False,
76 learning_rate=0.1,
77 l2_scale=1e-6,
78 input_layer_partitioner=None,
79 dense_layer_partitioner=None):
80 if not input:
81 raise ValueError('Dataset is not defined.')
82 if not user_column or not item_column or not combo_column:
83 raise ValueError('User column, item column or combo column is not defined.')
84 self._user_column = user_column
85 self._item_column = item_column
86 self._combo_column = combo_column
87
88 self._user_mlp = user_mlp
89 self._item_mlp = item_mlp
90 self._combo_mlp = combo_mlp
91 self._cvr_mlp = cvr_mlp
92 self._ctr_mlp = ctr_mlp
93 self._batch_size = batch_size
94
95 self._optimizer_type = optimizer_type
96 self._learning_rate = learning_rate
97 self._l2_regularization = self._l2_regularizer(l2_scale) if l2_scale else None
98 self._tf = stock_tf
99 self._adaptive_emb = adaptive_emb
100 self._bf16 = False if self._tf else bf16
101
102 self._input_layer_partitioner = input_layer_partitioner
103 self._dense_layer_partitioner = dense_layer_partitioner
104
105 self.feature = input[0]
106 self.label = input[1]
107
108 self._create_model()
109
110 with tf.name_scope('head'):
111 self._create_loss()
112 self._create_optimizer()
113 self._create_metrics()
114
115 # used to add summary in tensorboard
116 def _add_layer_summary(self, value, tag):

Callers

nothing calls this directly

Calls 6

_l2_regularizerMethod · 0.95
_create_modelMethod · 0.95
_create_lossMethod · 0.95
_create_optimizerMethod · 0.95
_create_metricsMethod · 0.95
name_scopeMethod · 0.45

Tested by

no test coverage detected