METHOD OF DETECTING ANOMALIES IN A PHYSICAL SYSTEM, AND CORRESPONDING MICROCONTROLLER AND COMPUTER PROGRAM PRODUCT
A method implemented by computer for generating a model for anomaly detection in a system includes obtaining a learning data matrix corresponding to a normal operation of the system, decomposing the learning data matrix into singular values of the matrix of learning data, calculating a new base, defining a maximum Mahalanobis distance threshold representing a limit of the normal operation of the system, and defining an anomaly detection model from the new base and from the maximum Mahalanobis distance threshold.
1 . A method, implemented by a computer, for generating an anomaly detection model in a physical system, the method comprising:
obtaining a learning data matrix comprising learning data and corresponding to a normal operation of the physical system;
decomposing the learning data matrix into singular values of the learning data matrix, so as to generate an orthogonal input matrix, a diagonal matrix, and an orthogonal output matrix;
determining a rank of the learning data matrix having energy higher than a threshold from the diagonal matrix;
calculating a new base having columns of the orthogonal input matrix selected according to the determined rank;
generating a maximum Mahalanobis distance threshold representing a limit of the normal operation of the physical system; and
generating the anomaly detection model from the new base and from the maximum Mahalanobis distance threshold.
2 . The method according to claim 1 , wherein generating the maximum Mahalanobis distance threshold comprises:
projecting the learning data onto the new base;
calculating an individual Mahalanobis distance for each of the learning data; and
generating the maximum Mahalanobis distance threshold from the calculated individual Mahalanobis distances.
3 . The method according to claim 2 , further comprising calculating a covariance matrix and a precision matrix from the projected learning data and from a mean of the projected learning data, the calculating the individual Mahalanobis distance comprising calculating the individual Mahalanobis distance from the projected learning data, from the precision matrix, and from the mean, and the generated anomaly detection model further comprising the precision matrix and the mean.
4 . The method according to claim 1 , wherein generating the maximum Mahalanobis distance threshold comprises generating the maximum Mahalanobis distance threshold from a chi-square table.
5 . The method according to claim 2 , further comprising transforming the new base to standardize the projected learning data, the anomaly detection model comprising the transformed new base and the maximum Mahalanobis distance threshold.
6 . The method according to claim 1 , further comprising:
obtaining operational data representing an actual operation of the physical system;
projecting the operational data representing the actual operation of the physical system onto the new base of the anomaly detection model;
calculating a projected Mahalanobis distance from the projected operational data;
comparing the calculated projected Mahalanobis distance with the maximum generated Mahalanobis distance threshold; and
detecting anomalies in response to the calculated projected Mahalanobis distance being greater than the maximum Mahalanobis distance threshold.
7 . The method according to claim 6 , wherein calculating the projected Mahalanobis distance is performed using the projected operational data, a precision matrix, and a mean of the anomaly detection model.
8 . A non-transitory computer-readable media storing computer instructions for generating an anomaly detection model in a physical system that, when executed by a processor, cause the processor to perform the steps of:
obtaining a learning data matrix comprising learning data and corresponding to a normal operation of the physical system;
decomposing the learning data matrix into singular values of the learning data matrix, so as to generate an orthogonal input matrix, a diagonal matrix, and an orthogonal output matrix;
determining a rank of the learning data matrix having energy higher than a threshold from the diagonal matrix;
calculating a new base having columns of the orthogonal input matrix selected according to the determined rank;
generating a maximum Mahalanobis distance threshold representing a limit of the normal operation of the physical system; and
generating the anomaly detection model from the new base and from the maximum Mahalanobis distance threshold.
9 . The non-transitory computer-readable media according to claim 8 , wherein the computer instructions that cause the processor to generate the maximum Mahalanobis distance threshold comprise further computer instructions that cause the processor to perform the following steps of:
projecting the learning data onto the new base;
calculating an individual Mahalanobis distance for each of the learning data; and
generating the maximum Mahalanobis distance threshold from the calculated individual Mahalanobis distances.
10 . The non-transitory computer-readable media according to claim 9 , storing further computer instructions that cause the processor to perform the steps of:
calculating a covariance matrix and a precision matrix from the projected learning data and from a mean of the projected learning data, the calculating the individual Mahalanobis distance comprising calculating the individual Mahalanobis distance from the projected learning data, from the precision matrix, and from the mean, and the generated anomaly detection model further comprising the precision matrix and the mean.
11 . The non-transitory computer-readable media according to claim 8 , wherein the computer instructions that cause the processor to generate the maximum Mahalanobis distance threshold comprise further computer instructions that cause the processor to perform the following step of:
generating the maximum Mahalanobis distance threshold from a chi-square table.
12 . The non-transitory computer-readable media according to claim 9 , storing further computer instructions that cause the processor to perform the step of:
transforming the new base to standardize the projected learning data, the anomaly detection model comprising the transformed new base and the maximum Mahalanobis distance threshold.
13 . The non-transitory computer-readable media according to claim 8 , storing further computer instructions that cause the processor to perform the steps of:
obtaining operational data representing an actual operation of the physical system;
projecting the operational data representing the actual operation of the physical system onto the new base of the anomaly detection model;
calculating a projected Mahalanobis distance from the projected operational data;
comparing the calculated projected Mahalanobis distance with the maximum generated Mahalanobis distance threshold; and
detecting anomalies in response to the calculated projected Mahalanobis distance being greater than the maximum Mahalanobis distance threshold.
14 . A microcontroller configured to generate an anomaly detection model in a physical system, the microcontroller comprising:
a non-transitory memory comprising instructions; and
a processor in communication with the non-transitory memory, wherein the processor executes the instructions to:
obtain a learning data matrix comprising learning data and corresponding to a normal operation of the physical system;
decompose the learning data matrix into singular values of the learning data matrix, so as to generate an orthogonal input matrix, a diagonal matrix, and an orthogonal output matrix;
determine a rank of the learning data matrix having energy higher than a threshold from the diagonal matrix;
calculate a new base having columns of the orthogonal input matrix selected according to the determined rank;
generate a maximum Mahalanobis distance threshold representing a limit of the normal operation of the physical system; and
generate the anomaly detection model from the new base and from the maximum Mahalanobis distance threshold.
15 . The microcontroller according to claim 14 , wherein the processor executing the instructions to generate the maximum Mahalanobis distance threshold comprises the processor executing the instructions to:
project the learning data onto the new base;
calculate an individual Mahalanobis distance for each of the learning data; and
generate the maximum Mahalanobis distance threshold from the calculated individual Mahalanobis distances.
16 . The microcontroller according to claim 15 , further comprising the processor executing the instructions to:
calculate a covariance matrix and a precision matrix from the projected learning data and from a mean of the projected learning data, the calculating the individual Mahalanobis distance comprising calculating the individual Mahalanobis distance from the projected learning data, from the precision matrix, and from the mean, and the generated anomaly detection model further comprising the precision matrix and the mean.
17 . The microcontroller according to claim 14 , wherein the processor executing the instructions to generate the maximum Mahalanobis distance threshold comprises the processor executing the instructions to generate the maximum Mahalanobis distance threshold from a chi-square table.
18 . The microcontroller according to claim 15 , further comprising the processor executing the instructions to transform the new base to standardize the projected learning data, the anomaly detection model comprising the transformed new base and the maximum Mahalanobis distance threshold.
19 . The microcontroller according to claim 14 , further comprising the processor executing the instructions to:
obtain operational data representing an actual operation of the physical system;
project the operational data representing the actual operation of the physical system onto the new base of the anomaly detection model;
calculate a projected Mahalanobis distance from the projected operational data;
compare the calculated projected Mahalanobis distance with the maximum generated Mahalanobis distance threshold; and
detect anomalies in response to the calculated projected Mahalanobis distance being greater than the maximum Mahalanobis distance threshold.
20 . The microcontroller according to claim 19 , wherein the processor executing the instructions to calculate the projected Mahalanobis distance comprises the processor executing the instructions to use the projected operational data, a precision matrix, and a mean of the anomaly detection model.