本文整理匯總了Python中lstm.build_model方法的典型用法代碼示例。如果您正苦於以下問題:Python lstm.build_model方法的具體用法?Python lstm.build_model怎麽用?Python lstm.build_model使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類lstm
的用法示例。
在下文中一共展示了lstm.build_model方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: train_initial
# 需要導入模塊: import lstm [as 別名]
# 或者: from lstm import build_model [as 別名]
def train_initial(filename, savename, n_seq, n_labels, n_dimension,
n_hidden, dropout, epochs, tb_on, autosave):
print tb_on, autosave
usage_ratio = 1
print '========================= Reformating ========================='
_, _, _, _ = pretraining.divide_save(filename, savename, n_seq=n_seq,
n_labels=n_labels)
print '========================= Reading ========================='
X_train, y_train, X_test, y_test = test.read_data(savename=savename,
n_seq=n_seq,
n_labels=n_labels,
n_dimension=n_dimension)
data = (X_train, y_train, X_test, y_test)
print '========================= Modeling ========================='
model = lstm.build_model(n_dimension=n_dimension,
n_labels=n_labels,
n_seq=n_seq,
n_hidden=n_hidden,
dropout=dropout)
print '========================= Training =========================='
model = lstm.run_network(model=model, data=data, epochs=epochs,
usage_ratio=usage_ratio, tb_on=tb_on, autosave=autosave, savename=savename)
print '========================= Testing =========================='
test.test_all_metrics(model, data=data, usage_ratio=usage_ratio)
# Pass functional variables from external