flairNLP / flair

A very simple framework for state-of-the-art Natural Language Processing (NLP)
https://flairnlp.github.io/flair/
Other
13.81k stars 2.09k forks source link

[Feature]: Anomaly Detection / One Class Classification #3496

Open jeffpicard opened 2 months ago

jeffpicard commented 2 months ago

Problem statement

Flair doesn't have an Anomaly Detection / One Class Classification model. While this question describes alternate solutions, some use cases could benefit from this dedicated model type.

Solution

Add a new AnomalyDetection class to flair.models. The implementation would train an autoencoder on a single class of data. At inference time, the autoencoder's reconstruction error of the input would be calculated and compared to a threshold to determine whether the input is in-class.

Additional Context

I plan to pull request code for this soon.

alanakbik commented 2 months ago

Hello @jeffpicard that sounds great, let us know if you need any help!

jeffpicard commented 1 month ago

Thanks @alanakbik! I put up a first stab (linked above) if you're interested.