当前位置: 首页>>代码示例>>Python>>正文


Python lstm.build_model方法代码示例

本文整理汇总了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 
开发者ID:cullengao,项目名称:EasyLSTM,代码行数:35,代码来源:runner.py


注:本文中的lstm.build_model方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。