最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

Python:生成具有趋势的随机时间序列数据(例如周期性、指数衰减等)

SEO心得admin47浏览0评论
本文介绍了Python:生成具有趋势的随机时间序列数据(例如周期性、指数衰减等)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

我正在尝试生成一些随机时间序列,其趋势包括周期性(例如销售)、指数下降(例如 Facebook 帖子上的点赞数)、指数增加(例如比特币价格)、普遍增加(股票行情)等.我可以生成一般递增/递减的时间序列,如下

I am trying to generate some random time series with trends like cyclical (e.g. sales), exponentially decreasing (e.g. facebook likes on a post), exponentially increasing (e.g. bitcoin prices), generally increasing (stock tickers) etc. I can generate generally increasing/decreasing time series with the following

import numpy as np import pandas as pd from numpy import sqrt import matplotlib.pyplot as plt vol = .030 lag = 300 df = pd.DataFrame(np.random.randn(100000) * sqrt(vol) * sqrt(1 / 252.)).cumsum() plt.plot(df[0].tolist()) plt.show()

但我不知道如何产生周期性趋势或指数增长或下降趋势.有没有办法做到这一点 ?

But I don't know how to generate cyclical trends or exponentially increasing or decreasing trends. Is there a way to do this ?

推荐答案

你可能想要评估 TimeSynth

You may want to evaluate TimeSynth

TimeSynth 是一个开源库,用于为*模型测试*生成合成时间序列.该库可以生成规则和不规则时间序列.该架构允许用户将不同的*信号*与不同的架构匹配,从而允许要生成的大量信号.下面列出了可用的 *signals* 和 *noise* 类型."

发布评论

评论列表(0)

  1. 暂无评论