neupy 时间序列信号处理
来源:互联网 发布:lol物品数据库 编辑:程序博客网 时间:2024/06/04 18:21
neupy 时间序列信号处理
neupy 时间序列信号处理。在Python神经网络模块界,neupy 可能不算知名,但是它确实比较好用,设计简单直观,容易上手。
# -*- coding: utf-8 -*-import numpy as npfrom sklearn.model_selection import train_test_splitfrom neupy import algorithms, estimators, environment# 只是自己定义的包,用来输入基金数据import finance.fundimport pytseriesenvironment.reproducible()# input data# 读者要用这段代码,需要自己获得时间序列数据,然后把时间序列转换成训练样本。fd = finance.fund.Fund.load('161226',500)data = fd['累计净值'].values[::-1]# data = np.sin(np.linspace(0,10,300)) # 另一个例子# 移动均值pytseries.TimeSeries([np.mean(data[k:k+order]) for k in range(len(data)-order+1)])ts = pytseries.TimeSeries(data)step = 30# generate samples for training from the sequencedatax, datat = ts.generate_Xy(step=step, style='row')x_train, x_test, y_train, y_test = train_test_split(datax, datat, train_size=0.99)# construct grnngrnnet = algorithms.GRNN()grnnet.train(x_train, y_train)back = 0data0 = ts[-step:][np.newaxis,:]ys = grnnet.predict(data0)y = ys.copy()for _ in range(50): data0 = np.hstack((data0[:,1:], y)) y = grnnet.predict(data0) ys = np.vstack((ys, y))import matplotlib.pyplot as pltplt.plot(ts.values[step:], 'o', color='blue')datay = grnnet.predict(datax)# plt.plot(y, '*', color='blue')plt.plot(np.vstack((datay, ys)), color='red')error = estimators.rmsle(datat, datay)plt.title("CODE: %s, GRNN RMSLE = %.4f"%(fd.code, error))plt.show()
阅读全文
0 0
- neupy 时间序列信号处理
- HTK语音信号处理-帧序列
- 时间序列处理工具选择
- pandas时间序列频率处理
- 大话离散时间信号处理(一)
- 大话离散时间信号处理(二)
- 数字信号处理第一章:离散时间信号与离散时间系统
- 离散时间复指数信号序列周期性质
- json序列化技巧 时间问题处理
- python+ARIMA 进行时间序列处理
- pandas时间序列分析和处理Timeseries
- 语音信号处理之----动态时间规整(DTW)
- 语音信号处理之动态时间规整(DTW)
- python+pandas+时间、日期以及时间序列处理
- linux 信号&信号处理
- 信号和信号处理
- linux 信号&信号处理
- linux 信号&信号处理
- lintcode刷题——装最多水的容器
- 字符串匹配的KMP算法
- 这几天的烦恼
- hdu 2188 简单巴什博奕
- LeetCode-108-Convert Sorted Array to Binary Search Tree(转化已排序数组到二叉排序树)
- neupy 时间序列信号处理
- 腾讯校招软件测试工程师题库
- FZU
- HEVC代码学习21:xTZSearch函数
- SAP JCO connector 例子
- ASP.NET MVC 5
- HDU1698 线段树 区间更新
- 用brew在mac上安装mysql
- ILI百度指数