The present invention relates to a storage medium, an estimation method, and an information processing apparatus.
In data analysis, by using autoencoders or the like, low-dimensional features are extracted from complex multidimensional data, and data analysis is performed using the features. For example, features of an image of a product flowing on a belt conveyor are extracted, and a defective product is detected from among the flowing products.
In recent years, data analysis using a variational autoencoder (VAE) that trains a latent variable as a probability distribution has been used. For example, the VAE includes an encoder and a decoder, and parameters of the encoder and the decoder are machine-learned so as to minimize an expected value of a reconstruction error calculated using an output of the decoder to which the latent variable is input and a normalization error of a probability distribution of a latent variable calculated using an output of the encoder to which the features are input. Anomaly data is detected by inputting a plurality of pieces of detection target data into the VAE that has been trained (trained) in this way.
According to an aspect of the embodiments, a non-transitory computer-readable storage medium storing an estimation program that causes at least one computer to execute a process, the process includes inputting an input data into a trained variational autoencoder that includes an encoder and a decoder; converting, into a first probability distribution, a probability distribution of a latent variable that is generated by the trained variational autoencoder according to the input based on a magnitude of a standard deviation output from the encoder; converting the first probability distribution into a second probability distribution based on an output error of the decoder regarding the input data; and outputting the second probability distribution as an estimated value of a probability distribution of the input data.
The object and advantages of the invention will be realized and attained by means of the elements and combinations particularly pointed out in the claims.
It is to be understood that both the foregoing general description and the following detailed description are exemplary and explanatory and are not restrictive of the invention.
In the VAE described above, a single-variable-independent normal distribution is assumed, and there is no guarantee that the obtained probability distribution of the latent space reflects a distribution of a real space. Therefore, in a case where determination target data is input to the trained VAE and a probability distribution of the input data is estimated using the output of the encoder so as to detect the anomaly data, it is not possible to guarantee an estimation result, anomaly detection accuracy is not high.
Note that it is also considered that an autoencoder that applies the Rate-Distortion theory for minimizing an information entropy of a latent variable is used. In a case where such an autoencoder is used, the probability distribution of the latent space is substantially the same as the probability distribution of the real space data. However, in a case where a shape of the probability distribution of the real space is complicated, it is needed to express the probability distribution of the latent space designed to be the same as that as a complicated shape, for example, by mixing a plurality of parametric probability distributions. Therefore, cost increases in order to improve accuracy, and this is not realistic.
In one aspect, an object is to provide an estimation program, an estimation method, and an information processing apparatus that can improve accuracy of input data anomaly detection.
In one aspect, accuracy of input data anomaly detection can be improved.
Hereinafter, an embodiment of an estimation program, an estimation method, and an information processing apparatus according to the present invention will be described in detail with reference to the drawings. Note that the present invention is not limited by this embodiment. Furthermore, each of the embodiments may be appropriately combined within a range without inconsistency.
Specifically, the information processing apparatus 10 performs machine learning of the VAE that includes an encoder and a decoder using training data and generates a model to which the trained VAE is applied. Then, the information processing apparatus 10 inputs input data of the same domain as the training data into an encoder of the model and acquires restored input data from a decoder of the model.
Here, the information processing apparatus 10 converts the probability distribution of the latent variable output from the encoder of the VAE into a first probability distribution on the basis of a magnitude of a standard deviation of an output of the encoder. Moreover, the information processing apparatus 10 converts the first probability distribution into a second probability distribution on the basis of an output error of the decoder of the VAE and outputs the second probability distribution as an estimated value of the probability distribution of the input data.
In this way, the information processing apparatus 10 detects data, having a lower probability, that occupies a specific ratio as anomaly data on the basis of the generated second probability distribution. Furthermore, the information processing apparatus 10 may detect data having a probability equal to or less than a threshold, from among the plurality of pieces of input data, as the anomaly data, on the basis of the second probability distribution.
The communication unit 11 controls communication with another device. For example, the communication unit 11 receives a machine learning start instruction and various types of data from an administrator's terminal and transmits a result of machine learning, a result of anomaly detection, or the like to the administrator's terminal.
The storage unit 13 stores various types of data, programs executed by the control unit 20, or the like. For example, the storage unit 13 stores training data 14, input data 15, a model 16, or the like.
The training data 14 is training data that is used for machine learning of the VAE and is data belonging to the same domain. For example, in a case where a model that detects a defective product from among products flowing on a belt conveyor is generated, the training data 14 corresponds to image data of the product or the like.
The input data 15 is each piece of data to be input to the generated model and is data to be determined whether or not the data is abnormal. Explaining with reference to the above example, in a case where machine learning of the VAE is performed using the image data of the product as the training data 14, the input data 15 corresponds to an image of the product flowing on the belt conveyor or the like.
The model 16 is a model that is generated by the control unit 20. Specifically, the model 16 is a model to which the VAE that is trained through machine learning using the training data 14 is applied.
The control unit 20 is a processing unit that controls the entire information processing apparatus 10 and includes a training unit 21 and a detection unit 22. The training unit 21 is a processing unit that performs machine learning of the VAE using the training data 14 and generates the model 16. This training unit 21 generates the model 16 to which the VAE trained through machine learning illustrated in
Here, machine learning of the VAE will be described. When training data x belonging to a domain D is input, the encoder 21a compresses features of the training data x and outputs a mean μ(x) and a standard deviation σ(x) of an N-dimensional normal distribution. Then, the noise generation unit 21b generates an N-dimensional noise ε according a mean 0 and a standard deviation I.
By mixing a value obtained by multiplying the noise ε generated by the noise generation unit 21b by the standard deviation σ(x) into the mean μ(x), a latent variable z to be input to the decoder 21c through sampling is determined from the normal distribution according to the standard deviation σ(x) and the mean μ(x). Then, the decoder 21c generates reconstructed data obtained by decoding the training data x, using the latent variable z corresponding to a feature vector of the training data x.
Thereafter, the estimation unit 21d estimates a normalization error R that is an error between a probability distribution of the latent variable z calculated from the training data x and a prior probability distribution of the latent variable z, using the mean μ(x) and the standard deviation σ(x) output from the encoder 21a. Then, the optimization unit 21e adjusts (machine learning) each parameter of the encoder 21a and each parameter of the decoder 21c so as to minimize the normalization error R estimated by the estimation unit 21d and minimize a reconstruction error that is an error between the training data x and the reconstructed data.
Returning to
First, the detection unit 22 calculates a probability distribution p(X) of input data (x) from the probability distribution of the latent variable identified by the VAE.
Specifically, by performing Karhunen-Loeve expansion (KLT) as orthonormal transformation and principal component analysis (PCA) for the input data (x), a probability distribution (p(ym)) of a principal component with a small variance is generated from a probability distribution (p(y1)) of a principal component with a large variance. Thereafter, it is assumed that the scale be adjusted so as to equalize the variances when the probability distribution corresponding to each variance is converted into a latent variable of a normal distribution. For example, regarding a probability distribution (p(z1)) of the latent variable converted from the probability distribution (p(y1)) of the principal component with the large variance and a probability distribution (p(zm)) of the latent variable converted from the probability distribution (p(ym)) of the principal component with the small variance, the scale is adjusted so that the variances become the same.
According to such an assumption, as illustrated in (a) of
Moreover, the detection unit 22 corrects a probability density of the latent variable estimated from the input data with the standard deviation output from the encoder 21a of the VAE. In a case where the scale changes at the time when the probability distribution (p(y)) of the assumed principal component is converted into the probability distribution (p(z)) of the latent variable z, the converted probability density changes in proportion to the scale.
On the other hand, since the standard deviation σ(x) indicates a magnitude of the noise mixed into data, the standard deviation σ(x) indicating the noise changes if the scale changes. That is, when it is assumed that the noise mixed into the input data is known (certain distribution), a change rate of the scale appears in the magnitude of the standard deviation σ(x) output from the encoder 21a of the VAE. Therefore, the detection unit 22 defines a conversion scale as in the formula (1), using a coefficient β of a normalization term of an optimization equation. As a result of these, the probability distribution p(X) of the input data (x) can be expressed by the formula (2). That is, the probability distribution p(X) is an example of a sampling probability and is a distribution of a generation probability that each piece of the input data (x) follows.
(β: coefficient of normalization term of optimization equation)
Note that, although a formula using m principal components is indicated in the formula (2), since an average value of the minus square of the standard deviation σ(x) “bar of σ(x)−2” corresponds to a data variance (unique value) in each principal component, an order indicating a variance of which principal component has the larger variance can be specified. Therefore, when compression to a predetermined dimension is performed, a principal component with a higher compression effect can be selected.
Here, an item A in the formula (2) indicates a probability other than the principal component and is a constant value (mean μ(x)=0, standard deviation σ(x)=1), and an item B corresponds to a probability of the principal component. That is, in the assumption of the conversion illustrated in
Therefore, as indicated in the formula (3), the probability distribution p(X) of the input data (x) can be expressed as proportional to the scale. Note that an item C in the formula (3) is a scale of the reconstruction error and can be defined by the formula (4) in a case where the normal distribution is assumed for the reconstruction error. That is, the probability distribution p(X) of the input data (x) can be defined with an item D of the formula (3), and the probability distribution of the latent variable can be corrected so as to reflect the generation probability of the input data with σ(x) of the latent variable.
Here, processing for calculating the probability distribution of the input data described above will be described in detail. Specifically, similarly to the VAE, a probability distribution qφ(z|x) of the latent variable z with respect to input data x of an m-dimensional domain is assumed as an m-dimensional Gaussian distribution N (μ(x), σ(x)), and parameters μ(x) and σ(x) thereof are identified by the encoder 21 (fφ(x)). Then, using the latent variable z indicated in the formula (5) sampled from the identified distribution, the reconstructed data is estimated by the decoder 21c (gφ(z)) as indicated in the formula (6). Furthermore, the respective parameters of the encoder 21a and the decoder 21c are optimized through machine learning that minimizes the formula (7).
[Math. 5]
z=μ
(x)+σ(x)⊙∈,∈˜N(0,I) Formula (5)
[Math. 6]
Reconstructed data {circumflex over (x)}→{circumflex over (x)}=gθ(z) Formula (6)
[Math. 7]
β·R+E˜β·DKL(qφ(z|x)∥p(z))+E˜q
Thereafter, for the acquired z, the detection unit 22 calculates n (n-dimensional) z that satisfy the formula (8) or the average value of the minus square of the standard deviation σ(x) of the output of the encoder 21a regarding the trained input data and extracts n values in a descending order. Then, the detection unit 22 converts the input data (x) of the domain into distribution parameters (μ(x), σ(x)) by the encoder 21a (fφ(x)), and estimates a generation probability p(x) of the input data (x) according to the formula (9). That is, the generation probability p(x) is a generation probability for each piece of the input data (x), each piece of the input data (x) can be defined according to the probability distribution p(X) in the formula (2), and as result, the generation probability p(x) of each piece of the input data can be defined by the formula (9). Therefore, one generation probability p(x) is calculated for one piece of the input data, and the probability distribution p(X) is configured by collecting the plurality of generation probabilities p(x).
Then, the detection unit 22 detects a certain percentage, for example, 10% of the total, of lower data as the anomaly data, from data of the generation probabilities calculated using the formula (9) for the plurality of pieces of input data 15.
Next, a flow of training processing will be described. Here, the training data 14 will be described as the training data x.
Subsequently, the training unit 21 generates N-dimensional data by sampling a predetermined number of latent variables z (S102). Then, the training unit 21 acquires data obtained by inputting the N-dimensional data into the decoder 21c (gφ(z)) and decoding the training data x (S103).
Thereafter, the training unit 21 calculates a training cost using the normalization error R estimated by the estimation unit 21d and a reconstruction error E that is an error between the training data x and the reconstructed data (S104) and updates respective parameters (θ, φ) of the encoder 21a and the decoder 21c so as to minimize the training cost (S105).
Thereafter, in a case where machine learning is not converged (S106: No), S101 and subsequent steps are repeated for a next piece of the training data 14. On the other hand, in a case where machine learning is converged (S106: Yes), the training unit 21 generates the model 16 to which the VAE that has completed machine learning is applied. Note that, in a case where the number of times of training is equal to or more than a threshold or a restoration error is equal to or less than a threshold, the training unit 21 can determine that machine learning is converged.
Next, a flow of detection processing will be described. Here, the input data 15 will be described as the input data (x).
Subsequently, the detection unit 22 calculates the generation probability p(x) of the input data (x) using the formula (9), on the basis of the acquired distribution parameters (μ(x), σ(x)) (S202). Here, in a case where there is unprocessed input data (x) (S204: No), the detection unit 22 repeats S201 and subsequent steps for the next piece of the input data (x).
Then, when completing the processing for all the pieces of the input data (x) (S204: Yes), the detection unit 22 detects a certain percentage of the input data (x), in ascending order of the generation probability p(x), as the anomaly data (S205).
As described above, the information processing apparatus 10 can estimate the probability distribution of the input data, using the standard deviation output from the encoder 21a of the VAE. Therefore, the information processing apparatus 10 can guarantee that the probability distribution of the latent space reflects a distribution of the real space and can perform highly accurate anomaly detection using the output of the encoder 21a of the VAE. Furthermore, in a case where data of a real domain can be latently represented by a single-variable Gaussian distribution in a task using a probability distribution of the real domain, such as anomaly detection, the information processing apparatus 10 can perform input data anomaly detection without using a complicated distribution and reduce a calculation cost. The input data may be, for example, image data or audio data.
Here, verification using input data that is artificially generated will be described. Here, respective verification results of the first embodiment in which the generation probability p(x) of the input data is estimated according to the formula (8) and the reference technique in which the generation probability (p(μ(x)) of the input data is estimated using the latent space of the VAE will be described.
As illustrated in
Then, a result of estimating the generation probability of the input data using the reference technique, for the plurality of pieces of input data, is illustrated in
Numerical values, data, the number of dimensions, or the like used in the embodiment described above are merely examples and can be arbitrarily changed. Furthermore, a device that performs machine learning of the VAE and a device that performs anomaly detection may be implemented as separate devices.
Furthermore, in addition to the configuration illustrated in
When the training data x belonging to the domain D is input, the encoder 21a compresses features of the training data x and outputs the mean μ(x) and the standard deviation σ(x) of the N-dimensional normal distribution. The decoder 21c-1 generates reconstructed data obtained by decoding the input data using the mean μ(x) output from the encoder 21a. After the noise ε generated by the noise generation unit 21b is mixed into the standard deviation σ(x), the decoder 21c-2 generates the reconstructed data obtained by decoding the input data, using the standard deviation σ(x) including the noise ε and the mean μ(x).
Thereafter, the estimation unit 21d estimates a normalization error R between a probability distribution of training data (x) and the probability distribution of the latent variable z using the mean μ(x) and the standard deviation σ(x) output from the encoder 21a. Then, the optimization unit 21e adjusts (machine learning) each parameter of the encoder 21a and each decoder so as to minimize the normalization error R estimated by the estimation unit 21d and to minimize a reconstruction error D1 that is an error between the reconstructed data generated by the decoder 21c-1 and the input data and a reconstruction error D2 that is an error between the reconstructed data generated by the decoder 21c-1 and the reconstructed data generated by the decoder 21c-2.
Note that, after machine learning is completed, with a method as in the first embodiment, the probability distribution of the input data can be estimated using the trained VAE.
Pieces of information including a processing procedure, a control procedure, a specific name, various types of data, and parameters described above or illustrated in the drawings may be optionally changed unless otherwise specified.
Furthermore, each component of each device illustrated in the drawings is functionally conceptual, and does not necessarily have to be physically configured as illustrated in the drawings. In other words, specific forms of distribution and integration of individual devices are not limited to those illustrated in the drawings. That is, all or a part thereof may be configured by being functionally or physically distributed or integrated in optional units according to various types of loads, usage situations, or the like.
Moreover, all or an optional part of individual processing functions performed in each device may be realized by a CPU and a program analyzed and executed by the CPU, or may be realized as hardware by wired logic.
Next, a hardware configuration example of the information processing apparatus 10 will be described.
The communication device 10a is a network interface card or the like, and communicates with another server. The display device 10b is a device that displays a training result, a detection result, or the like and is, for example, a touch panel, a display, or the like. The HDD 10c stores programs that operate the functions illustrated in
The processor 10e reads a program that executes processing similar to that of each processing unit illustrated in
In this way, the information processing apparatus 10 operates as an information processing apparatus that executes an estimation method by reading and executing programs. Furthermore, the information processing apparatus 10 may realize functions similar to the functions of the embodiment described above by reading the program described above from a recording medium by a medium reading device and executing the read program described above. Note that the program referred to in another embodiment is not limited to being executed by the information processing apparatus 10. For example, the present invention may be similarly applied to a case where another computer or server executes a program, or a case where such a computer and server cooperatively execute a program.
All examples and conditional language provided herein are intended for the pedagogical purposes of aiding the reader in understanding the invention and the concepts contributed by the inventor to further the art, and are not to be construed as limitations to such specifically recited examples and conditions, nor does the organization of such examples in the specification relate to a showing of the superiority and inferiority of the invention. Although one or more embodiments of the present invention have been described in detail, it should be understood that the various changes, substitutions, and alterations could be made hereto without departing from the spirit and scope of the invention.
This application is a continuation application of International Application PCT/JP2020/016212 filed on Apr. 10, 2020 and designated the U.S., the entire contents of which are incorporated herein by reference.
Number | Date | Country | |
---|---|---|---|
Parent | PCT/JP2020/016212 | Apr 2020 | US |
Child | 17942232 | US |