本文整理汇总了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