本文整理匯總了Python中data.DataProvider.generate_init方法的典型用法代碼示例。如果您正苦於以下問題:Python DataProvider.generate_init方法的具體用法?Python DataProvider.generate_init怎麽用?Python DataProvider.generate_init使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類data.DataProvider
的用法示例。
在下文中一共展示了DataProvider.generate_init方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: print
# 需要導入模塊: from data import DataProvider [as 別名]
# 或者: from data.DataProvider import generate_init [as 別名]
loss = y_pred + 0 * y_true
return loss
model.compile(optimizer=Adam(lr=0.001), loss = {'merge_layer' : ranking_loss, "pos_layer": dummy_loss}, loss_weights=[1, 0])
print("finish model compiling")
print(model.summary())
# target = np.array([9999] * len(word_data)) # useless since loss function make it times with 0
if os.path.exists(conf.path_checker):
print("load previous checker")
# model.load_weights(conf.path_checker)
# model.fit(
# {"word_idx": word_data, "item_pos_idx": item_pos_data, "item_neg_idx": item_neg_data},
# {"merge_layer": target, "pos_layer": target},
# batch_size=conf.batch_size, nb_epoch=conf.n_epoch, validation_split=0.1,
# callbacks=[my_checker_point(item_embed, word_embed, model, conf),
# # my_value_checker([word_embed_, item_pos_embed_, item_neg_embed_, pos_layer_, neg_layer_, merge_layer_]),
# ModelCheckpoint(filepath=conf.path_checker, verbose=1, save_best_only=True)])
dp.generate_init()
model.fit_generator(generator=dp.generate_data(batch_size=conf.batch_size, is_val=False), nb_worker=1, pickle_safe=False,
nb_epoch=conf.n_epoch, samples_per_epoch=conf.sample_per_epoch,
validation_data = dp.generate_data(batch_size=conf.batch_size, is_val=True), nb_val_samples=1913599,
verbose=1,
callbacks=[
my_checker_point(item_embed, word_embed, model, conf),
ModelCheckpoint(filepath=conf.path_checker, verbose=1, save_best_only=True)
])