我编写了以下代码以可视化时间序列聚类。
for yi in range(6):
plt.subplot(6, 1, 1 + yi)
for xx in stack_data[y_pred6 == yi]:
plt.plot(xx.ravel(), "k-", alpha=.2)e
plt.tight_layout()
plt.show()
我使用的数据是33维NumPy数组,如下所示。
In:stack_data.shape
out:(33, 3277, 1)
在每张图上,我要为前14个数组添加一个红色:即stack_data[0:13]
。
接下来的17个数组为蓝色:stack_data[14:32]
。
我们可能会发现在数组上添加标签的一些线索,但是请告诉我您的想法。 谢谢。