当前位置:网站首页>滑窗法切分数据
滑窗法切分数据
2022-07-31 12:58:00 【码破苍穹】
#滑窗法处理数据
def data_winow_split(input_data, WINDOW_INTERVAL, WINDOW_IENGTH):
data_len = len(input_data)
split_size = int((data_len - WINDOW_LENGTH) / WINDOW_INTERVAL) + 1
print(split_size)
res = []
for i in range(split_size):
start_index = i * WINDOW_INTERVAL
end_index = start_index + WINDOW_LENGTH
print(start_index, end_index)
cur_data = input_data[start_index:end_index]
res.append(cur_data)
return res
input_data = [i for i in range(12)]
WINDOW_INTERVAL = 2
WINDOW_LENGTH = 4
print(input_data)
print(data_winow_split(input_data, WINDOW_INTERVAL, WINDOW_LENGTH))
边栏推荐
猜你喜欢
NameNode (NN) and SecondaryNameNode (2NN) working mechanism
How does the SAP ABAP OData service support the $filter (filter) operation trial version
C#使用NumericUpDown控件
IDEA连接MySQL数据库并执行SQL查询操作
Use docker to build mysql master-slave
分布式监视 Zabbix 和 Prometheus 到底怎么选?千万别用错了!
Ali on three sides: MQ message loss, repetition, backlog problem, how to solve?
Istio微服务治理网格的全方面可视化监控(微服务架构展示、资源监控、流量监控、链路监控)
跨境电商小知识之跨境电商物流定义以及方式讲解
PyQt5快速开发与实战10.2 复利计算 && 10.3 刷新博客点击量
随机推荐
Flutter keyboard visibility
列表页优化思路
Optimization of five data submission methods
CentOS7 installation MySQL graphic detailed tutorial
JSP中如何借助response对象实现页面跳转呢?
PyQt5快速开发与实战 10.1 获取城市天气预报
AMBA APB学习记录(AMBA 3/4)
聊聊 SAP 产品 UI 上的消息显示机制
手撕Verilog PWM呼吸灯
go中select语句
[Shader] Shader official example [easy to understand]
C#中+=的用法
Anaconda安装labelImg图像标注软件
IDEA的database使用教程(使用mysql数据库)
电脑重要文件很多,如何备份比较安全?
ERROR 1064 (42000) You have an error in your SQL syntax; check the manual that corresponds to your
系统集成项目管理工程师(软考中级)知识点总结【挣值分析】【关键路径】
关于我放弃考研这件事儿
Double non-one into bytes!!Pure dry goods sharing
EasyMock日记1[通俗易懂]