小编Joa*_*uin的帖子

使用 Python 和机器学习 (LSTM) 预测未来“x”天的股票价格

我按照本教程https://www.youtube.com/watch?v=QIUxPv5PJOY来预测苹果未来某一天的股价。代码是:

#Import the libraries
import math
import pandas_datareader as web
import numpy as np
import pandas as pd
from sklearn.preprocessing import MinMaxScaler
from keras.models import Sequential 
from keras.layers import Dense, LSTM
import matplotlib.pyplot as plt
plt.style.use('fivethirtyeight')

#Get the stock quote
df = web.DataReader('AAPL', data_source='yahoo', start='2012-01-01', end='2020-12-07')

#Show the data
df
#Get the number of rows and columns in the data set
df.shape

#Visualize the closing price history
#We create a plot with name 'Close Price History'
plt.figure(figsize=(16,8))
plt.title('Close …
Run Code Online (Sandbox Code Playgroud)

python machine-learning time-series forecasting lstm

3
推荐指数
1
解决办法
5761
查看次数