Apparatus, method, and computer-readable medium of training abnormal detecting model
A model training apparatus, a model training method, and a computer-readable medium are provided. In the method, a labeled abnormal sample is inputted into an abnormal detecting model. The abnormal detecting model is based on an autoencoder structure. A reconstructed error between the abnormal sample and an output of the abnormal detecting model is maximized to optimize the abnormal detecting model.
1 . A method of training abnormal detecting model, comprising:
inputting a labeled abnormal sample into an encoder of an abnormal detecting model to obtain a first compression performance, wherein the abnormal detecting model is based on an autoencoder architecture;
inputting the first compression performance into a decoder of the abnormal detecting model to obtain a reconstructed result;
maximizing a reconstructed error between the reconstructed result and the abnormal sample to train the abnormal detecting model, comprising:
inputting the reconstructed result into the encoder of the abnormal detecting model to obtain a second compression performance;
selecting a loss function corresponding to the abnormal sample, wherein the loss function is set such that a predicted error between a target value and a predicted value is greater than an error threshold value, the target value is the first compression performance of the abnormal sample encoded by the encoder of the abnormal detecting model, and to the predicted value is the second compression performance of the reconstructed result encoded by the encoder of the abnormal detecting model; and
maximizing the reconstructed error via the loss function, wherein the predicted error corresponds to the reconstructed error.
2 . The method of claim 1 , further comprising, before the step of inputting the labeled abnormal sample into the abnormal detecting model:
determining a type of input data, wherein the type corresponds to one of the abnormal sample and a normal sample.
3 . The method of claim 1 , further comprising:
inputting a labeled normal sample into the abnormal detecting model; and
minimizing a second reconstructed error between a second output of the normal sample via the abnormal detecting model and the normal sample to optimize the abnormal detecting model.
4 . The method of claim 1 , further comprising:
performing an abnormal detection on data to be tested using the abnormal detecting model.
5 . An apparatus for training abnormal detecting model, comprising:
a storage storing a program code; and
a processor coupled to the storage and loading and executing the program code so as to be configured to:
input a labeled abnormal sample into an encoder of an abnormal detecting model to obtain a first compression performance, wherein the abnormal detecting model is based on an autoencoder architecture;
input the first compression performance into a decoder of the abnormal detecting model to obtain a reconstructed result;
maximize a reconstructed error between the reconstructed result and the abnormal sample to train the abnormal detecting model,
wherein the processor is further configured to:
input the reconstructed result into the encoder of the abnormal detecting model to obtain a second compression performance;
select a loss function corresponding to the abnormal sample, wherein the loss function is set such that a predicted error between a target value and a predicted value is greater than an error threshold value, the target value is the first compression performance of the abnormal sample encoded by the encoder of the abnormal detecting model, and the predicted value is the second compression performance of the reconstructed result encoded by the encoder of the abnormal detecting model; and
maximize the reconstructed error via the loss function, wherein the predicted error corresponds to the reconstructed error.
6 . The apparatus of claim 5 , wherein the processor is further configured to:
determine a type of input data, wherein the type corresponds to one of the abnormal sample and a normal sample.
7 . The apparatus of claim 5 , wherein the processor is further configured to:
input a labeled normal sample into the abnormal detecting model; and
minimize a second reconstructed error between a second output of the normal sample via the abnormal detecting model and the normal sample to optimize the abnormal detecting model.
8 . The apparatus of claim 5 , wherein the processor is further configured to:
perform an abnormal detection on data to be tested using the abnormal detecting model.
9 . A non-transitory computer-readable medium loading a program code via a processor to train abnormal detecting model, comprising the following steps:
inputting a labeled abnormal sample into an encoder of an abnormal detecting model to obtain a first compression performance, wherein the abnormal detecting model is based on an autoencoder architecture;
inputting the first compression performance into a decoder of the abnormal detecting model to obtain a reconstructed result;
maximizing a reconstructed error between the reconstructed result and the abnormal sample to train the abnormal detecting model, comprising:
inputting the reconstructed result into the encoder of the abnormal detecting model to obtain a second compression performance;
selecting a loss function corresponding to the abnormal sample, wherein the loss function is set such that a predicted error between a target value and a predicted value is greater than an error threshold value, the target value is the first compression performance of the abnormal sample encoded by the encoder of the abnormal detecting model, and the predicted value is the second compression performance of the reconstructed result encoded by the encoder of the abnormal detecting model; and
maximizing the reconstructed error via the loss function, wherein the predicted error corresponds to the reconstructed error.