python - 如何为 Tensorflow 自动编码器准备数据(多个“时间序列”)
问题描述
我正在使用 Tensorflow 自动编码器从生产数据中检测异常。
我有一个包含 1927 个元素的列表。每个元素代表一个形状为 6000,20 的 numpy 数组。(来自 19 个特征的 6000 个 count_timersiere - 代表一个生产零件)
all_data = []
for df in yp_clean:
batch_sample = np.asarray(df)
for sample in batch_sample:
all_data.append(sample)
all_data = np.asarray(all_data)
inp = tf.keras.layers.Input(shape = (20, ))
x = tf.keras.layers.Dense(128, activation='relu')(inp)
x = tf.keras.layers.Dense(64, activation='relu')(x)
enc = tf.keras.layers.Dense(2, activation='relu', name='enc')(x)
x = tf.keras.layers.Dense(64, activation='relu')(enc)
x = tf.keras.layers.Dense(128, activation='relu')(x)
out = tf.keras.layers.Dense(20, activation='relu')(x)
autoencoder = tf.keras.models.Model(inp, out)
autoencoder.summary()
count_timeseries 从 1 开始到 6000,表示 30 秒的时间段
我的方法是将所有数据堆叠到一个 hugh np.array 中。形状 1927*6000,20 至少我能够运行自动编码器。但我担心我丢失了“time_series”信息。
我的恐惧正确吗?有没有人做过类似的事情?
顺便说一句:所以我只有 ok 部分的数据,下一步是添加 nok。但我需要知道如何提前准备数据。
感谢您的帮助!
解决方案
推荐阅读
- python - 在 Django 上填写另一个字段时更新一个字段
- mysql - 根据 Id 从同一个表中选择 empName 和 managerName
- r - 使用 R,如何使用字符向量在非常大的字符向量中搜索匹配项
- python - InvalidArgumentError:维度 1 的切片索引 7 超出范围。[Op:StridedSlice] 名称:strided_slice/
- python - 插值 UV 坐标
- amazon-web-services - 如何从公共 Internet 连接到我的无服务器 RDS 实例?
- javascript - 如何将项目存储在本地存储然后调用它?
- python - 使用 or 运算符时,Python 函数意外返回 True
- rest - 我对 Roy Fielding 的 REST 替代 HTTP cookie 的解释是否正确?
- android - Android 模拟器上的未知错误,在运行 android studio 的 Amazon Ec2 Windows 服务器上