我正在努力从可变长度的CSV中创建固定大小的序列。
我所使用的方式是一个函数
def create_sequences(csv, window_size, stride):
sequences = []
for i in range(0, len(csv)-window_size, stride):
sequences.append(csv[i:i+window_size])
return sequences
它成功地返回了序列,但数据丢失了,因为我已经创建了可视化并试图手动解决它,它缺少一些数据。
Total length = 115
Size = 30
Stride = 20
Ending size = 115 -30 = 85
First window: 0 -> 30
Second Window: 20 -> 50
Third Window: 40 -> 70
Fourth Window: 60 -> 90
Fifth Window: 80 -> 110
The last five frames are lost, How can I set up a window from 100 -> 115 and pad the last row?