如何掩盖张量的时间步长之前
我的时间序列数据的形式为[batch_size,Horizon,feature]
。事件经常发生,我将它们划分为单独的“ meta”张量作为布尔国旗。即,除了发生给定事件时(在这种情况下为1)时,它是填充零相同形状的张量。
如果事件发生在地平线内,我需要能够防止我的模型在事件发生之前查看数据;因此,默认情况下,在第二维中,蒙版应该是所有掩码,并且在检测到的事件之前的时间段应为所有零。
仅应考虑最后一个事件,即使存在先前的事件,所有先前的时间段也应为0。
一维示例(meta - > mask):
[0, 0, 1, 0] -> [0, 0, 1, 1]
[0, 0, 0, 1] -> [0, 0, 0, 1]
[1, 0, 1, 0] -> [0, 0, 1, 1]
[1, 0, 0, 0] -> [1, 1, 1, 1]
[0, 0, 0, 0] -> [1, 1, 1, 1]
I have time-series data in the form of [batch_size, horizon, feature]
. Events occur every so often, and I demarcate them in a separate "meta" tensor as a boolean flag. i.e., it's a tensor of the same shape filled with zeros except for when a given event occurs (in which case it's a 1).
I need to be able to prevent my model from looking at data prior to the event if an event has occurred within the horizon; so by default within the 2nd dimension, the mask should be all ones, and timesteps before a detected event should be all zeros.
Only the last event should be considered, and all prior timesteps should be 0 even if there were prior events.
One-dimensional examples (meta -> mask):
[0, 0, 1, 0] -> [0, 0, 1, 1]
[0, 0, 0, 1] -> [0, 0, 0, 1]
[1, 0, 1, 0] -> [0, 0, 1, 1]
[1, 0, 0, 0] -> [1, 1, 1, 1]
[0, 0, 0, 0] -> [1, 1, 1, 1]
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
也许这样的东西:
Maybe something like this: