视频讲解:RNN+LSTM正弦sin信号预测_哔哩哔哩_bilibili
效果演示:
数据展示:
完整代码:
import torch
import torch.nn as nn
import torch.optim as optim
import numpy as np
import matplotlib.pyplot as plt
import pandas as pd
from sklearn.preprocessing import MinMaxScaler
from sklearn.metrics import mean_squared_error, mean_absolute_error
import math
# 输入数据时序步数
STEP = 4
# gauss状态分布随机信号数部分(origin)
data = pd.read_csv('12-06 15_54_07_sibato.csv') # 读取文件
training_set = data.iloc[200:5212 - 1200, 1:3].values
training_set[:, 0] = training_set[:, 0] - 2.30