當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。