我有一个神经网络(一个自动编码器),它从长度的时间序列( M,N,M << N)中获取长度的时间窗口作为输入,并将其转换为另一个同维时间窗口。
为了实现可视化,我想制作一个视频,在帧的顶部显示NN的输入,在帧的底部显示相应的输出,在连续的窗口上运行NN。
我想知道你能不能给我介绍一些工具,或者给我一些提示。
发布于 2019-01-07 23:19:17
使用这,我为它编写了一个脚本。
%matplotlib notebook
import numpy as np
import matplotlib.pyplot as plt
import time
plt.ion()
size_x = 128
def pltts(ts1, ts2, ax, colors, lbl):
x = np.linspace(0,2.5,size_x)
if ax.lines:
ax.lines[0].set_xdata(x)
ax.lines[1].set_xdata(x)
ax.lines[0].set_ydata(ts1)
ax.lines[1].set_ydata(ts2)
else:
l1, l2 = ax.plot(x, ts1, colors[0], x, ts2, colors[1])
fig.legend((l1, l2), ("BLUE", "RED"), loc='center', fontsize=fnt_siz-2)
ax.set_title(lbl, fontsize=fnt_siz-2)
fig.canvas.draw()
fnt_siz = 16
fig,ax = plt.subplots(2,1, figsize=(10,10))
fig.suptitle('Data', fontsize=fnt_siz)
ax[0].set_xlabel('Time', fontsize=fnt_siz-4)
ax[0].set_ylabel('Magnitude', fontsize=fnt_siz-4)
ax[1].set_xlabel('Time', fontsize=fnt_siz-4)
ax[1].set_ylabel('Magnitude', fontsize=fnt_siz-4)
plt.subplots_adjust(hspace=0.75)
# ax[0].grid(True)
# ax[1].grid(True)
for f in range(50):
ts1 = np.random.normal(0, 4, size=(size_x,1))
ts2 = np.random.normal(1, 1, size=(size_x,1))
pltts(ts1, ts2, ax[0], ['b', 'r'], "ORGINAL")
ts1 = 2*ts1
ts2 = -3*ts2
pltts(ts1, ts2, ax[1], ['b', 'r'], "TRANSFORMED")
time.sleep(1)这是一个示例输出:

https://datascience.stackexchange.com/questions/43493
复制相似问题