MATLAB Answers

How to classify "unknown" data using an LSTM

1 view (last 30 days)
Thomas Wellsbury
Thomas Wellsbury on 7 Jun 2021
Answered: Srivardhan Gadila on 12 Jun 2021
Hello,
I have created a deep learning model to classify activities, it classifes known (labelled) activites well, however when i attempt to classify new data the trained model has not seen beofre i want it to classify it as 'unknow'. Is there a method that can do this? The problem i have is that the number of possible classes is infinate and i am oinly intreasted in the main classes.
I have tried using the confidence scores to say, if confidence score mean is <= xx for all know activites then classify as "unknow", however with little sucess. Are there any other methods i could try?
Thanks!

Answers (1)

Srivardhan Gadila
Srivardhan Gadila on 12 Jun 2021
One possible approach is to define the network for number of classes = number of known labels (main classes) + 1(for unknown labels) and assign the the unknown class to the data you are not interested and train the network. The downside here is that with more training data the training time will be more. Also if the new dataset is unbalanced then you can make use of the ClassWeights argument of the classificationLayer ( You can refer to the following similar workflow "Balance Classes Using Class Weighting" for addressing the class balancing problem.)

Community Treasure Hunt

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

Start Hunting!

Translated by