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.
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 toflair.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.