All Projects → EvilPsyCHo → Deep Time Series Prediction

EvilPsyCHo / Deep Time Series Prediction

Seq2Seq, Bert, Transformer, WaveNet for time series prediction.

Programming Languages

python
139335 projects - #7 most used programming language

Projects that are alternatives of or similar to Deep Time Series Prediction

Base-On-Relation-Method-Extract-News-DA-RNN-Model-For-Stock-Prediction--Pytorch
基於關聯式新聞提取方法之雙階段注意力機制模型用於股票預測
Stars: ✭ 33 (-81.97%)
Mutual labels:  lstm, seq2seq, attention
Numpy Ml
Machine learning, in numpy
Stars: ✭ 11,100 (+5965.57%)
Mutual labels:  lstm, attention, wavenet
Pointer Networks Experiments
Sorting numbers with pointer networks
Stars: ✭ 53 (-71.04%)
Mutual labels:  lstm, attention, seq2seq
Pytorch Seq2seq
Tutorials on implementing a few sequence-to-sequence (seq2seq) models with PyTorch and TorchText.
Stars: ✭ 3,418 (+1767.76%)
Mutual labels:  lstm, attention, seq2seq
Chinese Chatbot
中文聊天机器人,基于10万组对白训练而成,采用注意力机制,对一般问题都会生成一个有意义的答复。已上传模型,可直接运行,跑不起来直播吃键盘。
Stars: ✭ 124 (-32.24%)
Mutual labels:  lstm, attention, seq2seq
Multimodal Sentiment Analysis
Attention-based multimodal fusion for sentiment analysis
Stars: ✭ 172 (-6.01%)
Mutual labels:  lstm, attention
Cnn lstm for text classify
CNN, LSTM, NBOW, fasttext 中文文本分类
Stars: ✭ 90 (-50.82%)
Mutual labels:  lstm, attention
Multiturndialogzoo
Multi-turn dialogue baselines written in PyTorch
Stars: ✭ 106 (-42.08%)
Mutual labels:  attention, seq2seq
Kaggle Web Traffic
1st place solution
Stars: ✭ 1,641 (+796.72%)
Mutual labels:  kaggle, seq2seq
Mlbox
MLBox is a powerful Automated Machine Learning python library.
Stars: ✭ 1,199 (+555.19%)
Mutual labels:  kaggle, regression
Pytorch Gan Timeseries
GANs for time series generation in pytorch
Stars: ✭ 109 (-40.44%)
Mutual labels:  lstm, wavenet
Rnn For Joint Nlu
Pytorch implementation of "Attention-Based Recurrent Neural Network Models for Joint Intent Detection and Slot Filling" (https://arxiv.org/abs/1609.01454)
Stars: ✭ 176 (-3.83%)
Mutual labels:  lstm, attention
Self Attention Classification
document classification using LSTM + self attention
Stars: ✭ 84 (-54.1%)
Mutual labels:  lstm, attention
Tensorflow seq2seq chatbot
Stars: ✭ 81 (-55.74%)
Mutual labels:  lstm, seq2seq
Machine Learning
My Attempt(s) In The World Of ML/DL....
Stars: ✭ 78 (-57.38%)
Mutual labels:  lstm, attention
Nlp Models Tensorflow
Gathers machine learning and Tensorflow deep learning models for NLP problems, 1.13 < Tensorflow < 2.0
Stars: ✭ 1,603 (+775.96%)
Mutual labels:  lstm, attention
Benchmarks
Comparison tools
Stars: ✭ 139 (-24.04%)
Mutual labels:  kaggle, regression
Image Caption Generator
A neural network to generate captions for an image using CNN and RNN with BEAM Search.
Stars: ✭ 126 (-31.15%)
Mutual labels:  lstm, attention
Nspm
🤖 Neural SPARQL Machines for Knowledge Graph Question Answering.
Stars: ✭ 156 (-14.75%)
Mutual labels:  lstm, seq2seq
Text Classification Keras
📚 Text classification library with Keras
Stars: ✭ 53 (-71.04%)
Mutual labels:  lstm, attention

DeepSeries

Deep Learning Models for time series prediction.

Models

  • [x] Seq2Seq / Attention
  • [x] WaveNet
  • [ ] Bert / Transformer

Quick Start

from deepseries.models import Wave2Wave, RNN2RNN
from deepseries.train import Learner
from deepseries.data import Value, create_seq2seq_data_loader, forward_split
from deepseries.nn import RMSE, MSE
import deepseries.functional as F
import numpy as np
import torch

batch_size = 16
enc_len = 36
dec_len = 12
series_len = 1000

epoch = 100
lr = 0.001

valid_size = 12
test_size = 12

series = np.sin(np.arange(0, series_len)) + np.random.normal(0, 0.1, series_len) + np.log2(np.arange(1, series_len+1))
series = series.reshape(1, 1, -1)

train_idx, valid_idx = forward_split(np.arange(series_len), enc_len=enc_len, valid_size=valid_size+test_size)
valid_idx, test_idx = forward_split(valid_idx, enc_len, test_size)

# mask test, will not be used for calculating mean/std.
mask = np.zeros_like(series).astype(bool)
mask[:, :, test_idx] = False
series, mu, std = F.normalize(series, axis=2, fillna=True, mask=mask)

# create train/valid dataset
train_dl = create_seq2seq_data_loader(series[:, :, train_idx], enc_len, dec_len, sampling_rate=0.1,
                                      batch_size=batch_size, seq_last=True, device='cuda')
valid_dl = create_seq2seq_data_loader(series[:, :, valid_idx], enc_len, dec_len,
                                      batch_size=batch_size, seq_last=True, device='cuda')

# define model
wave = Wave2Wave(target_size=1, num_layers=6, num_blocks=1, dropout=0.1, loss_fn=RMSE())
wave.cuda()
opt = torch.optim.Adam(wave.parameters(), lr=lr)

# train model
wave_learner = Learner(wave, opt, root_dir="./wave", )
wave_learner.fit(max_epochs=epoch, train_dl=train_dl, valid_dl=valid_dl, early_stopping=True, patient=16)

# load best model
wave_learner.load(wave_learner.best_epoch)

# predict and show result
import matplotlib.pyplot as plt
wave_preds = wave_learner.model.predict(torch.tensor(series[:, :, test_idx[:-12]]).float().cuda(), 12).cpu().numpy().reshape(-1)

plt.plot(series[:, :, -48:-12].reshape(-1))
plt.plot(np.arange(36, 48), wave_preds, label="wave2wave preds")
plt.plot(np.arange(36, 48), series[:, :, test_idx[-12:]].reshape(-1), label="target")
plt.legend()

More examples will be update in example folder soon.

Performence

I will test model performence in Kaggle or other data science competition. It will comming soon.

Install

git clone https://github.com/EvilPsyCHo/Deep-Time-Series-Prediction.git
cd Deep-Time-Series-Prediction
python setup.py install

Refs

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].