keras-anomaly-detection

Anomaly detection implemented in Keras

The source codes of the recurrent, convolutional and feedforward networks auto-encoders for anomaly detection can be found in keras_anomaly_detection/library/convolutional.py and keras_anomaly_detection/library/recurrent.py and keras_anomaly_detection/library/feedforward.py

The the anomaly detection is implemented using auto-encoder with convolutional, feedforward, and recurrent networks and can be applied to:

  • timeseries data to detect timeseries time windows that have anomaly pattern

  • structured data (i.e., tabular data) to detect anomaly in data records
    • Conv1DAutoEncoder in keras_anomaly_detection/library/convolutional.py
    • FeedforwardAutoEncoder in keras_anomaly_detection/library/feedforward.py
       
      看LSTM的模型吧:

          def create_model(time_window_size, metric):
      model = Sequential()
      model.add(LSTM(units=128, input_shape=(time_window_size, 1), return_sequences=False)) model.add(Dense(units=time_window_size, activation='linear')) model.compile(optimizer='adam', loss='mean_squared_error', metrics=[metric])
      print(model.summary())
      return model

      再看feedforward的模型:

          def create_model(self, input_dim):
      encoding_dim = 14
      input_layer = Input(shape=(input_dim,)) encoder = Dense(encoding_dim, activation="tanh",
      activity_regularizer=regularizers.l1(10e-5))(input_layer)
      encoder = Dense(encoding_dim // 2, activation="relu")(encoder) decoder = Dense(encoding_dim // 2, activation='tanh')(encoder)
      decoder = Dense(input_dim, activation='relu')(decoder) model = Model(inputs=input_layer, outputs=decoder)
      model.compile(optimizer='adam',
      loss='mean_squared_error',
      metrics=['accuracy'])

      CNN的:

          def create_model(time_window_size, metric):
      model = Sequential()
      model.add(Conv1D(filters=256, kernel_size=5, padding='same', activation='relu',
      input_shape=(time_window_size, 1)))
      model.add(GlobalMaxPool1D()) model.add(Dense(units=time_window_size, activation='linear')) model.compile(optimizer='adam', loss='mean_squared_error', metrics=[metric])
      print(model.summary())
      return model

      都是将输出设置成自己,异常点就是查看偏离那90%的预测error较大的点。

最新文章

  1. 浅析Java 泛型
  2. 特征提取k_word
  3. 在Altium_Designer_PCB_中插入图片的方法
  4. .getClass();
  5. xdebug调试一直等待连接
  6. 界面显示这个时间格式的js代码: 2016年1月19日 星期二 乙未(羊)年 腊月初十
  7. C++中弱符号(弱引用)的意义及实例
  8. c++ 实现将数字转换为中文数字输出
  9. Genymotion Android模拟器Genymotion的安装和使用
  10. CXF使用
  11. 关于在VB.NET中调用使用VC++编写的类库dll的一点笔记
  12. [转帖]Linux的进程线程及调度
  13. Hyper
  14. Java学习笔记八(反射)
  15. 如何打开Intellij IDEA的代码提示功能/联想/自动联想
  16. CentOS 7中firewall防火墙详解和配置以及切换为iptables防火墙
  17. Javascript能做什么 不能做什么。
  18. Microsoft.CSharp.RuntimeBinder.RuntimeBinderException: “object”未包括“get_Range”的定义
  19. SAP Cloud for Customer Account和individual customer的区别
  20. 【转】spring MVC入门示例(hello world demo)

热门文章

  1. CSS3 转换
  2. 02: MySQL的安装与基本配置
  3. JAVA第十周《网络编程》学习内容总结
  4. hdu Naive Operations 线段树
  5. 如何将一个Winform嵌入到一个Control当中
  6. BZOJ2982: combination Lucas
  7. 04_Windows平台Spark开发环境构建
  8. HDU 6127 Hard challenge(扫描线)
  9. IIS Express 配置json minitype
  10. Redis 5种数据结构及其使用场景举例--STRING