Tech Neo技巧沙龙 | 11月25号,九州云/ZStack与您一路商量云时代收集界线治理实践
STATWORX 团队近日大年夜 Google Finance API 中精选出了 S&P 500 数据,该数据集包含 S&P 500 的指数和股价信息。有了这些数据,他们就欲望能应用深度进修模型和 500 支成分股价猜测 S&P 500 指数。STATWORX 团队的数据集十分新鲜,但只是应用四个隐蔽层的全连接收集实现猜测,读者也可以下载该数据测验测验加倍优良的轮回神经收集。
本文异常合适初学者懂得若何应用 TensorFlow 构建根本的神经收集,它周全展示了构建一个 TensorFlow 模型所涉及的概念与模块。本文所应用的数据集可以直接下载,所以有必定基本的读者也可以测验测验应用更强的轮回神经收集处理这一类时序数据。
数据集地址:http://files.statworx.com/sp500.zip
导入和预处理数据
STATWORX 团队大年夜办事器爬取股票数据,并将它们保存为 csv 格局的文件。该数据集包含 n=41266 分钟的记录,范围大年夜 2017 年的 4 月到 8 月的 500 支股票和 S&P 500 指数,股票和股指典范围分布十分广。
- # Run initializer
- net.run(tf.global_variables_initializer())
- # Setup interactive plot
- plt.ion()
- fig = plt.figure()
- ax1 = fig.add_subplot(111)
- line1, = ax1.plot(y_test)
- line2, = ax1.plot(y_test*0.5)
- plt.show()
- # Number of epochs and batch size
- epochs = 10
- batch_size = 256for e in range(epochs):
- # Shuffle training data
- shuffle_indices = np.random.permutation(np.arange(len(y_train)))
- X_train = X_train[shuffle_indices]
- y_train = y_train[shuffle_indices]
- # Minibatch training
- for i in range(0, len(y_train) // batch_size):
- start = i * batch_size
- batch_x = X_train[start:start + batch_size]
- batch_y = y_train[start:start + batch_size]
- # Run optimizer with batch
- net.run(opt, feed_dict={X: batch_x, Y: batch_y})
- # Show progress
- if np.mod(i, 5) == 0:
- # Prediction
- pred = net.run(out, feed_dict={X: X_test})
推荐阅读
敏捷框架比较:Scrum vs Kanban vs Lean vs XP
Tech Neo技巧沙龙 | 11月25号,九州云/ZStack与您一路商量云时代收集界线治理实践 在这篇文┞仿中, Alesia Krush将对四种最风行的敏捷开辟办法进行比较,给出了每种办法的优缺点。市场上有>>>详细阅读
地址:http://www.17bianji.com/lsqh/39204.html
1/2 1