一、获取历史行情数据
import tushare as ts
df=ts.get_hist_data('600999',start='2016-06-15',end='2018-03-07')
dd=df[['open','high','low','close']]
df
可以得到如下结果:
二、数据归一化处理
data_all = np.array(df).astype(float)
scaler = MinMaxScaler()
data_all = scaler.fit_transform(data_all)
scaler
MinMaxScaler(copy=True, feature_range=(0, 1))
scaler = MinMaxScaler(copy=True,feature_range=(-1,1))
scaler.fit_transform([1,2,3,4,5,6,7])array([-1. , -0.66666667, -0.33333333, 0. , 0.33333333,
0.66666667,

本文是关于使用机器学习预测股票价格的学习笔记,首先介绍了如何获取历史行情数据,接着详细阐述了数据的归一化和正则化处理过程,以提升模型的预测性能。
3814

被折叠的 条评论
为什么被折叠?



