Skip to content

AttributeError: 'Tensor' object has no attribute '_uses_learning_phase' #11

Description

@upavloff

Hello,
I'm trying all your models in order to determine which one fits the most with my acceptation. This is for CTR prediction with Avazu data.
I tried them all I have mistakes in four of them, some of which are probably due to me, the one I understand the least is the following :
<< AttributeError: 'Tensor' object has no attribute '_uses_learning_phase' >>

Here is my code (which is more or less the example code you gave for criteo) :

model = DIN({"sparse": sparse_feature_list,"dense": dense_feature_list},
sparse_feature_name,task='binary')

model.compile("adam", "binary_crossentropy", metrics=['binary_crossentropy'], )

history = model.fit(train_model_input, train[click].values,
batch_size=226, epochs=5, verbose=2, validation_split=0.2, )


Just so you know here is the output of :

print( sparse_feature_list )
[SingleFeat(name='site_id', dimension=1000, hash_flag=True, dtype='string'),
SingleFeat(name='site_domain', dimension=1000, hash_flag=True, dtype='string'),
SingleFeat(name='site_category', dimension=1000, hash_flag=True, dtype='string'),
SingleFeat(name='app_id', dimension=1000, hash_flag=True, dtype='string'),
SingleFeat(name='app_domain', dimension=1000, hash_flag=True, dtype='string'),
SingleFeat(name='app_category', dimension=1000, hash_flag=True, dtype='string'),
SingleFeat(name='device_id', dimension=1000, hash_flag=True, dtype='string'),
SingleFeat(name='device_ip', dimension=1000, hash_flag=True, dtype='string'),
SingleFeat(name='device_model', dimension=1000, hash_flag=True, dtype='string')]
print(dense_feature_list)
[SingleFeat(name='id', dimension=0, hash_flag=False, dtype='float32'),
SingleFeat(name='C1', dimension=0, hash_flag=False, dtype='float32'),
SingleFeat(name='banner_pos', dimension=0, hash_flag=False, dtype='float32'),
SingleFeat(name='device_type', dimension=0, hash_flag=False, dtype='float32'),
SingleFeat(name='device_conn_type', dimension=0, hash_flag=False, dtype='float32'),
SingleFeat(name='C14', dimension=0, hash_flag=False, dtype='float32'),
SingleFeat(name='C15', dimension=0, hash_flag=False, dtype='float32'),
SingleFeat(name='C16', dimension=0, hash_flag=False, dtype='float32'),
SingleFeat(name='C17', dimension=0, hash_flag=False, dtype='float32'),
SingleFeat(name='C18', dimension=0, hash_flag=False, dtype='float32'),
SingleFeat(name='C19', dimension=0, hash_flag=False, dtype='float32'),
SingleFeat(name='C20', dimension=0, hash_flag=False, dtype='float32'),
SingleFeat(name='C21', dimension=0, hash_flag=False, dtype='float32'),
SingleFeat(name='hour', dimension=0, hash_flag=False, dtype='float32'),
SingleFeat(name='weekday', dimension=0, hash_flag=False, dtype='float32')]

If you have any comment on what I might do wrong don't hesitate to tell me !

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions