# Detect Anomalies in Text Data Using Variational Autoencoder (VAE) in MATLAB® [![Open in MATLAB Online](https://www.mathworks.com/images/responsive/global/open-in-matlab-online.svg)](https://matlab.mathworks.com/open/github/v1?repo=matlab-deep-learning/anomaly-detection-with-text-variational-autoencoder)
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](https://www.mathworks.com/images/responsive/global/open-in-matlab-online.svg)](https://matlab.mathworks.com/open/github/v1?repo=matlab-deep-learning/anomaly-detection-with-text-variational-autoencoder)
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:
- Go to https://www.mathworks.com/help/textanalytics/ug/create-simple-text-model-for-classification.html.
- Click on the button "Copy Command" on the top right of the page and paste it in MATLAB CLI. This will open the example in the directory where the .csv file is stored.
- Copy the .csv file from the example, and paste it in the cloned repo.
- If the file is saved in a different location, make sure to change the code that points to it in the .mlx file.
## Required Products
- MATLAB (R2023a or later)
- Text Analytics Toolbox™ (R2023a or later)
- Deep Learning Toolbox™ (R2023a or later)
## Contact
Sohini Sarkar, [email protected]
## License
The license is available in license.txt file in this GitHub repository.
## Community Support
[MATLAB Central](https://www.mathworks.com/matlabcentral)
Copyright 2024, The MathWorks, Inc.
没有合适的资源?快使用搜索试试~ 我知道了~
文本变分自动编码器的异常检测matlab代码.zip
共59个文件
xml:50个
m:5个
md:2个
1.该资源内容由用户上传,如若侵权请联系客服进行举报
2.虚拟产品一经售出概不退款(资源遇到问题,请及时私信上传者)
2.虚拟产品一经售出概不退款(资源遇到问题,请及时私信上传者)
版权申诉
0 下载量 190 浏览量
2024-04-08
20:21:53
上传
评论
收藏 159KB ZIP 举报
温馨提示
1.版本:matlab2014/2019a/2021a 2.附赠案例数据可直接运行matlab程序。 3.代码特点:参数化编程、参数可方便更改、代码编程思路清晰、注释明细。 4.适用对象:计算机,电子信息工程、数学等专业的大学生课程设计、期末大作业和毕业设计。
资源推荐
资源详情
资源评论
收起资源包目录
文本变分自动编码器的异常检测matlab代码.zip (59个子文件)
文本变分自动编码器的异常检测matlab代码
SECURITY.md 394B
AnomalyDetectionwithTextusingVAE.mlx 115KB
AnomalyDetectionwithTextusingVAE.prj 107B
resources
project
rootp.xml 46B
EEtUlUb-dLAdf0KpMVivaUlztwA
urkJrkSacyuIV2z38tVZagLKb5Qd.xml 69B
urkJrkSacyuIV2z38tVZagLKb5Qp.xml 111B
root
EEtUlUb-dLAdf0KpMVivaUlztwAp.xml 81B
fjRQtWiSIy7hIlj-Kmk87M7s21kp.xml 80B
GiiBklLgTxteCEmomM8RCvWT0nQd.xml 91B
KAXfQgCar2Yb8zOxgvf9hdmLP1Ep.xml 81B
qaw0eS1zuuY1ar9TdPn1GMfrjbQp.xml 75B
GiiBklLgTxteCEmomM8RCvWT0nQp.xml 81B
KAXfQgCar2Yb8zOxgvf9hdmLP1E
NWvZdOEdk0hJaoiRWYURAy9JWWMp.xml 112B
NWvZdOEdk0hJaoiRWYURAy9JWWMd.xml 143B
Project.xml 73B
NjSPEMsIuLUyIpr2u1Js5bVPsOs
aEHSZBIY-yve10yGis12Zr5DLZod.xml 82B
QWNDYJD5mGW1bWYvPx9DtKnxzw4d.xml 86B
j4xwF_j8iFTVayUMfxLgMnTbencp.xml 77B
R1RggVhA72agI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9mIYp.xml 94B
TMK4UzWHdRLhy_w-CHt9y11Q8XAd.xml 46B
osDe0GCPJWTEXIJtZI34aDTtmGcd.xml 140B
rh0jHbNfmojECiiHH7BQHmZTsWkd.xml 46B
fjRQtWiSIy7hIlj-Kmk87M7s21k
NjSPEMsIuLUyIpr2u1Js5bVPsOsd.xml 114B
NjSPEMsIuLUyIpr2u1Js5bVPsOsp.xml 91B
initializeGlorot.m 252B
initializeZeros.m 168B
samplingLayer.m 2KB
projectAndReshapeLayer.m 3KB
openMainFile.m 67B
README.md 3KB
共 59 条
- 1
资源评论
matlab科研助手
- 粉丝: 1w+
- 资源: 1994
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功