## TCAN TensorFlow
TensorFlow implementation of multivariate time series forecasting model introduced in Lin, Y., Koprinska, I.,
& Rana, M. (2021). Temporal Convolutional Attention Neural Networks for Time Series Forecasting. In 2021 International
Joint Conference on Neural Networks (IJCNN) (pp. 1-8). IEEE.
[https://doi.org/10.1109/IJCNN52387.2021.9534351](https://doi.org/10.1109/IJCNN52387.2021.9534351).
### Dependencies
```bash
pandas==1.3.4
numpy==1.19.5
tensorflow==2.7.0
tensorflow_probability==0.14.1
tensorflow_addons==0.15.0
plotly==5.3.1
kaleido==0.2.1
```
### Usage
```python
import numpy as np
from tcan_tensorflow.model import TCAN
# Generate two time series
N = 1000
t = np.linspace(0, 1, N)
e = np.random.multivariate_normal(mean=[0, 0], cov=[[1, 0.25], [0.25, 1]], size=N)
a = 40 + 30 * t + 20 * np.cos(2 * np.pi * (20 * t - 0.5)) + e[:, 0]
b = 50 - 40 * t + 30 * np.sin(2 * np.pi * (20 * t - 0.5)) + e[:, 1]
y = np.hstack([a.reshape(- 1, 1), b.reshape(- 1, 1)])
# Fit the model
model = TCAN(
y=y,
x=None,
forecast_period=100,
lookback_period=300,
quantiles=[0.01, 0.1, 0.5, 0.9, 0.99],
filters=2,
kernel_size=3,
dilation_rates=[1, 2],
dropout=0,
alpha=1.5
)
model.fit(
regularization=0.5,
learning_rate=0.01,
batch_size=64,
epochs=200,
verbose=1
)
```
```python
# Plot the in-sample predictions
predictions = model.predict(index=900)
fig = model.plot_predictions()
fig.write_image('predictions.png', width=750, height=650)
```
![predictions](example/predictions.png)
```python
# Plot the out-of-sample forecasts
forecasts = model.forecast()
fig = model.plot_forecasts()
fig.write_image('forecasts.png', width=750, height=650)
```
![forecasts](example/forecasts.png)
没有合适的资源?快使用搜索试试~ 我知道了~
基于 时间卷积注意神经网络 时间序列预测-光伏功率预测实例.完整项目分享 毕设
共17个文件
py:10个
png:3个
txt:1个
1.该资源内容由用户上传,如若侵权请联系客服进行举报
2.虚拟产品一经售出概不退款(资源遇到问题,请及时私信上传者)
2.虚拟产品一经售出概不退款(资源遇到问题,请及时私信上传者)
版权申诉
5星 · 超过95%的资源 4 下载量 47 浏览量
2023-03-19
22:06:58
上传
评论 1
收藏 226KB ZIP 举报
温馨提示
基于时间卷积注意神经网络 时间序列预测-光伏功率实例.完整项目分享 毕设
资源推荐
资源详情
资源评论
收起资源包目录
时间卷积注意神经网络_时间序列预测-光伏功率实例.zip (17个子文件)
tcan-tensorflow-main
LICENSE 1KB
requirements.txt 131B
.gitignore 2KB
tcan_tensorflow
utils.py 3KB
losses.py 2KB
activations
activations.png 36KB
activations.py 1KB
test.py 2KB
layers
layers.py 2KB
test.py 3KB
model.py 18KB
modules.py 3KB
plots.py 4KB
README.MD 2KB
example
forecasts.png 92KB
example.py 1KB
predictions.png 91KB
共 17 条
- 1
资源评论
- ao~ao~2024-04-01发现一个超赞的资源,赶紧学习起来,大家一起进步,支持!
- soulmate23382023-06-17支持这个资源,内容详细,主要是能解决当下的问题,感谢大佬分享~
- 茶色西陆2024-01-26资源很受用,资源主总结的很全面,内容与描述一致,解决了我当下的问题。
- dunming_67254132023-12-27感谢资源主分享的资源解决了我当下的问题,非常有用的资源。
计算机毕设论文
- 粉丝: 1w+
- 资源: 399
下载权益
C知道特权
VIP文章
课程特权
开通VIP
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功