當前位置: 首頁>>代碼示例>>Python>>正文


Python Callbacks.add_watch_ticker_callback方法代碼示例

本文整理匯總了Python中neon.callbacks.callbacks.Callbacks.add_watch_ticker_callback方法的典型用法代碼示例。如果您正苦於以下問題:Python Callbacks.add_watch_ticker_callback方法的具體用法?Python Callbacks.add_watch_ticker_callback怎麽用?Python Callbacks.add_watch_ticker_callback使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在neon.callbacks.callbacks.Callbacks的用法示例。


在下文中一共展示了Callbacks.add_watch_ticker_callback方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。

示例1: GRU

# 需要導入模塊: from neon.callbacks.callbacks import Callbacks [as 別名]
# 或者: from neon.callbacks.callbacks.Callbacks import add_watch_ticker_callback [as 別名]
output_size = 8
N = 120  # number of memory locations
M = 8  # size of a memory location

# model initialization
layers = [
    GRU(hidden_size, init, activation=Tanh(), gate_activation=Logistic()),
    Affine(train_set.nout, init, bias=init, activation=Logistic())
]

cost = GeneralizedCostMask(costfunc=CrossEntropyBinary())

model = Model(layers=layers)

optimizer = RMSProp(gradient_clip_value=gradient_clip_value,
                    stochastic_round=args.rounding)

# configure callbacks
callbacks = Callbacks(model, **args.callback_args)

# we can use the training set as the validation set,
# since the data is tickerally generated
callbacks.add_watch_ticker_callback(train_set)

# train model
model.fit(train_set,
          optimizer=optimizer,
          num_epochs=args.epochs,
          cost=cost,
          callbacks=callbacks)
開發者ID:AdityoSanjaya,項目名稱:neon,代碼行數:32,代碼來源:rnn_copy.py


注:本文中的neon.callbacks.callbacks.Callbacks.add_watch_ticker_callback方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。