Detect Anomalies in Text Data Using Variational Autoencoder

버전 1.0 (135 KB) 작성자: Sohini Sarkar
This example shows how to detect out-of-distribution text data using a variational autoencoder (VAE).
다운로드 수: 16
업데이트 날짜: 2024/3/27

Detect Anomalies in Text Data Using Variational Autoencoder (VAE) in MATLAB® Open in MATLAB Online

This example shows how to detect out-of-distribution text data using a variational autoencoder (VAE).

Overview

VAEs are a neural network architecture composed of two parts:

  • An encoder that encodes data in a lower-dimensional parameter space.
  • A decoder that reconstructs the input data by mapping the lower-dimensional representation back into the original space.

You can use a VAE to detect anomalies in your dataset. To do this, train a VAE on your data. Then, encode and decode a test data point. Compare the output of the decoder with the input data. If the input and output are similar, then the data is in-distribution. If the input and output are dissimilar, then the data is out-of-distribution, or anomalous.

This example includes three steps.

  1. Load and preprocess the text data.
  2. Set up and train the encoder and decoder networks.
  3. Use the VAE to detect anomalies in test data

Setup

Clone the repository in a local directory. If you would like to use this repository with MATLAB Online, clink Open in MATLAB Online

The main live script is AnomalyDetectionwithTextusingVAE.mlx. The other .m files are supporting functions for sampling the latent space, projecting and reshaping after sampling from latent space, and initializations of the project and reshape layer. You can either open the .mlx for demo or open the .prj file which will automatically open .mlx file.

Before running the file, get the data using the following steps:

Required Products

  • MATLAB (R2023a or later)
  • Text Analytics Toolbox™ (R2023a or later)
  • Deep Learning Toolbox™ (R2023a or later)

Contact

Sohini Sarkar, ssarkar@mathworks.com

License

The license is available in license.txt file in this GitHub repository.

Community Support

MATLAB Central

Copyright 2024, The MathWorks, Inc.

인용 양식

Sohini Sarkar (2024). Detect Anomalies in Text Data Using Variational Autoencoder (https://github.com/matlab-deep-learning/anomaly-detection-with-text-variational-autoencoder/releases/tag/v1.0), GitHub. 검색 날짜: .

MATLAB 릴리스 호환 정보
개발 환경: R2024a
모든 릴리스와 호환
플랫폼 호환성
Windows macOS Linux
태그 태그 추가

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!
버전 게시됨 릴리스 정보
1.0

이 GitHub 애드온의 문제를 보거나 보고하려면 GitHub 리포지토리로 가십시오.
이 GitHub 애드온의 문제를 보거나 보고하려면 GitHub 리포지토리로 가십시오.