Reputation: 11
Can I build a cnn in keras with only one class (class - 0) so it can predict if the given date belongs to this class? Thanks in advance
Edite :Thanks for the answer and comments so far. My data is acceleration time series from a healthy structure but I don't have access to damaged state acceleration signals, so I have only data for class 0.
Upvotes: 1
Views: 4349
Reputation: 2752
I believe what you're describing is an anomaly detection model. Other ML models exist for this purpose, such as the one class support vector machine (https://scikit-learn.org/stable/modules/generated/sklearn.svm.OneClassSVM.html) and isolation forest (https://scikit-learn.org/stable/modules/generated/sklearn.ensemble.IsolationForest.html). It's possible to implement a neural network, but you will need to have a customized loss function - as in, binary cross-entropy doesn't make sense for this application. One example of such a loss function is described here: https://arxiv.org/pdf/1802.06360.pdf which is based on the one class SVM.
I have an implementation of a one class fully connected network here in Keras: https://github.com/danielenricocahall/One-Class-NeuralNetwork which utilizes a loss function based on the one described in that paper, if that helps.
Good luck!
Upvotes: 1