A method for predicting abnormal online behavior based on generative adversarial networks
By generating adversarial networks to generate realistic Internet behavior data and using Euclidean distance to calculate similarity, the problem of inability to effectively predict Internet abnormal behavior in the existing technology is solved, and fast and simple abnormal prediction and detection is achieved, protecting enterprises or individuals Legal rights and interests.
Patent Information
- Application Number
- CN202211006197.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-08-22
- Publication Date
- 2024-11-22
- Estimated Expiration
- 2042-08-22
AI Technical Summary
The existing technology cannot effectively and promptly detect and stop abnormal Internet behaviors, resulting in infringement of the legitimate rights and interests of enterprises or individuals, and the cost of manual labeling and prediction is high and inoperable.
Using an unsupervised generative model based on a generative adversarial network, the Internet behavior data with outliers are generated through fitting training, and the similarity is calculated using Euclidean distance to realize the abnormal prediction of Internet behavior, and a security threshold is set to perform abnormalities. Test.
It realizes fast and simple prediction of abnormal behaviors in Internet access, can promptly detect and stop abnormal behaviors, protect the legitimate rights and interests of enterprises or individuals, and has fast model training speed and high accuracy.
Smart Images

Figure CN115473700B_ABST
Abstract
Description
Technical Field
[0001] The invention relates to an abnormal online behavior prediction method based on an unsupervised generative adversarial network, and belongs to the technical field of data processing. Background Art
[0002] In actual enterprise application scenarios, there are massive amounts of log data, but these data are all data without outlier labels. Through these data, it is impossible to directly discover abnormal online behaviors, and it is impossible to stop some illegal elements' violations and crimes (such as data leakage, bank fraud, personal fraud, etc.) in time, thus infringing the legitimate rights and interests of enterprises or individuals. Predicting whether online behavior is abnormal can solve the above problems, but since each person can generate thousands of online behaviors a day, for massive online behavior data, if each online behavior is manually marked and predicted, it is not only costly, but also prone to errors and not operational. Therefore, it is very necessary to use unsupervised generative models to complete the prediction of online behavior anomalies. Summary of the invention
[0003] The purpose of the present invention is to address the shortcomings of the prior art and provide a method for predicting abnormal Internet behavior based on an unsupervised generative model, Generative Adversarial Nets (GAN), so as to timely discover and stop abnormal Internet behavior and protect the legitimate rights and interests of enterprises or individuals.
[0004] To achieve the above object, the present invention adopts the following technical solution:
[0005] A method for predicting abnormal Internet behavior based on a generative adversarial network, wherein the method uses a generative adversarial network as an abnormal Internet behavior prediction model, inputs Internet behavior data with abnormal values into the generative adversarial network for fitting training; then uses a generator in the generative adversarial network to generate simulated Internet behavior data with abnormal values; for each Internet behavior data without abnormal values for which abnormal values need to be predicted, finds the simulated Internet behavior data with the smallest Euclidean distance therefrom, and uses the abnormal values of the simulated Internet behavior data as its own abnormal values, and finally realizes abnormal Internet behavior prediction based on the abnormal values.
[0006] The above-mentioned method for predicting abnormal online behavior based on a generative adversarial network comprises the following steps:
[0007] a. Preprocessing of online behavior data: using LabelEncoder to encode online behavior, converting text features into digital features, splitting and concatenating the encoded information to obtain high-level features, and finally normalizing the high-level features to obtain preprocessed online behavior data;
[0008] b. Initialize the generative adversarial network model consisting of the generator and the discriminator;
[0009] c. Input the pre-processed Internet behavior data with outliers into the generative adversarial network for training;
[0010] d. Use the generator in the trained generative adversarial network to generate multiple simulated Internet behavior data with outliers;
[0011] e. For each pre-processed Internet behavior data without outliers for which outliers need to be predicted, calculate the Euclidean distance between it and each simulated Internet behavior data, and take the simulated Internet behavior data with the smallest Euclidean distance as the most similar simulated Internet behavior data;
[0012] f. The outlier value of the simulated online behavior data that is most similar to each online behavior data without outliers for which outliers need to be predicted is used as the outlier value of the online behavior data without outliers, and finally the online behavior anomaly prediction is realized based on the outliers.
[0013] The above-mentioned method for predicting abnormal Internet behavior based on generative adversarial network, using the generator in the generative adversarial network to generate multiple simulated Internet behavior data with abnormal values is as follows:
[0014] (1) Initialize n random 4D noises and input the noise into the generator;
[0015] (2) The generator outputs simulated Internet behavior data with outliers corresponding to each noise according to the parameters obtained by training the generative adversarial network, and obtains n simulated Internet behavior data with outliers.
[0016] The above-mentioned method for predicting abnormal Internet behavior based on generative adversarial networks, and the specific method for realizing abnormal Internet behavior prediction according to abnormal values are as follows: the higher the abnormal value of the Internet behavior data, the more abnormal the Internet behavior, and a safety threshold is set. If the abnormal value of the Internet behavior data is less than the safety threshold, the Internet behavior is judged to be normal Internet behavior, otherwise the Internet behavior is judged to be abnormal Internet behavior.
[0017] The above-mentioned method for predicting abnormal online behavior based on a generative adversarial network, the working process of the generative adversarial network is as follows:
[0018] (1) Initialize a generator network and a discriminator network;
[0019] (2) Input online behavior data with outliers, and the discriminator is responsible for judging the authenticity of the real data and the simulated data generated by the generator;
[0020] (3) Initialize random noise and input it into the generator. The generator is responsible for using the noise to generate simulated Internet behavior data with abnormal values. The generated data is then given to the discriminator for discrimination.
[0021] (4) Through the continuous game between the generator and the discriminator, a generative adversarial network model is finally obtained to generate realistic Internet behavior data with outliers.
[0022] The above-mentioned abnormal Internet behavior prediction method based on the generative adversarial network performs feature splitting and splicing on the encoded information to obtain the specific method of high-level features:
[0023] (1) After using the LabelEncoder method to digitally encode the string features, each string feature is represented by a specific number;
[0024] (2) The time feature of online behavior is a string consisting of year, month, day, hour, and minute. The to_datetime function in the panda package is used to split this string into different feature expressions.
[0025] (3) Different online behavior features are concatenated, and then the concatenated features are counted to obtain high-level features of different online behaviors.
[0026] The present invention uses a generative adversarial network to generate simulated online behavior data with outliers, and determines the outliers of each online behavior data according to the most similar simulated online behavior data, thereby realizing the abnormal prediction of online behavior. The method is simple, has a fast model training speed, is easy to implement, and can timely discover and stop abnormal online behavior, protecting the legitimate rights and interests of enterprises or individuals. BRIEF DESCRIPTION OF THE DRAWINGS
[0027] The present invention will be further described in detail below in conjunction with the accompanying drawings and specific embodiments.
[0028] Figure 1 It is a model diagram of the generative adversarial network;
[0029] Figure 2 This is a flow chart of the Internet behavior data processing and model training of the present invention;
[0030] Figure 3 The generator generates a data flow chart of simulated Internet behavior;
[0031] Figure 4 is based on Figure 3 A flow chart for predicting Internet behavior test data using the generated simulated Internet behavior data;
[0032] Figure 5 It is a flow chart of the evaluation criteria for prediction results;
[0033] Figure 6 It is a flow chart of abnormal Internet behavior detection based on abnormal Internet behavior prediction. DETAILED DESCRIPTION
[0034] The present invention provides an abnormal prediction method for Internet behavior based on a generative adversarial network. The method predicts abnormal values of Internet behavior based on an unsupervised generative model generative adversarial network. As an unsupervised generative model, the generative adversarial network can be used as an abnormal prediction model for Internet behavior. By learning the distribution of Internet behavior data with abnormal values, Internet behavior data with abnormal values can be generated, thereby predicting abnormal values of Internet behavior. Whether the employee's Internet behavior is normal is detected by judging whether the abnormal value is within a safety threshold. If the employee is detected to have abnormal Internet behavior, the administrator can further track future logs to eliminate the risk of internal data leakage in the enterprise.
[0035] When using a generative adversarial network to predict abnormal online behavior, each online behavior of a user will have an outlier value between 0 and 1, which is named outlier. The higher the outlier value, the more abnormal the behavior of the user. The present invention uses an exhaustive method to compare similarities based on the data generated by GAN and the test data. It does not need to build a complex model to predict abnormal online behavior, and has the advantages of fast prediction speed and high prediction accuracy.
[0036] This method is based on the user's online behavior data, and each online behavior contains information such as IP (Internet Protocol address), SwitchIP (switch IP), url (uniform resource locator), port (port number), vlan (virtual local area network), time (online time), etc. Through the online behavior data of each user, the user's online behavior abnormality is predicted; through the online behavior data of multiple users in the group, the online behavior abnormality is predicted for the group users; through the online behavior data of multiple users in multiple groups, the online behavior abnormality is predicted for multiple groups of users. The present invention uses an unsupervised generative model to generate an adversarial network, and by learning the distribution of user online behavior data with abnormal values, the generator therein can generate simulated online behavior data with abnormal values. Taking these generated simulated online behavior data with predicted values as a benchmark, the Euclidean distance is used to calculate the similarity between the online behavior data, and the exhaustive method is used to compare the similarity of the data to obtain the online behavior prediction value closest to the true value, thereby completing the abnormal prediction task of the user's online behavior. If necessary, based on the above-mentioned abnormal prediction of online behavior, a security threshold can be set to perform abnormal detection of online behavior.
[0037] The method includes preprocessing of online behavior data, training of a generative adversarial network, generation of online behavior data with outliers, and prediction of outliers of online behavior data. The method includes the following steps:
[0038] Step A: Preprocessing of online behavior data: using LabelEncoder to encode online behavior, converting text features into digital features, splitting and concatenating the encoded information to obtain high-level features, and finally normalizing it;
[0039] Step B: Initialize the generative adversarial network model;
[0040] Step C: Input the Internet behavior data with outliers into the generative adversarial network for fitting training;
[0041] Step D: Use the generator in the generative adversarial network to generate simulated Internet behavior data with outliers;
[0042] Step E: For the Internet behavior data without outliers for which outliers need to be predicted, the Euclidean distance is used to calculate the similarity between the Internet behavior data. The simulated Internet behavior data with the smallest Euclidean distance is the most similar simulated Internet behavior data. The most similar simulated Internet behavior data with outliers is found through an exhaustive method.
[0043] Step F: The outlier value of the simulated online behavior data that is most similar to each online behavior data without outliers for which outliers need to be predicted is used as the outlier value of the online behavior data without outliers, and finally the online behavior anomaly prediction is realized based on the outliers.
[0044] Step G: Evaluate the accuracy of the model using evaluation indicators based on the prediction results;
[0045] You can set a security threshold to detect anomalies in Internet behavior data, which is convenient for administrators to manage later. For example, if the outlier threshold is set to 0.5, the predicted outlier value less than 0.5 is detected as normal Internet behavior, and the value greater than 0.5 is detected as abnormal Internet behavior.
[0046] The data preprocessing algorithm is: digitally encode the features of the online behavior data, and then obtain high-level features through feature combination. The specific method is:
[0047] (1) After the string features are digitally encoded using the LabelEncoder method, each string feature is represented by a specific number, such as an IP (Internet Protocol address) address is encoded as a number.
[0048] (2) The time feature of the online behavior is a string consisting of year, month, day, hour, and minute. The to_datetime function in the panda package can be used to split this string into different feature expressions.
[0049] (3) Concatenate different Internet behavior features, such as concatenating IP (Internet Protocol address) features and URL (Uniform Resource Locator) features into a digital feature (indicating the behavior of using this IP to access this URL), and then count and statistically analyze this concatenated feature to obtain high-level features of different Internet behaviors.
[0050] When the user's online behavior is repeated, some low-level features will not change because the IP address used and the URL visited are the same, but the combined high-level features will change. For example, a high-level feature after combination can represent the frequency of a certain online behavior. Finally, the normalization method is used to normalize the online behavior data.
[0051] The network structure of the generated adversarial network is as follows Figure 1 As shown, its working process is:
[0052] (1) Initialize a generator network and a discriminator network;
[0053] (2) Input online behavior data with outliers, and the discriminator is responsible for judging the authenticity of the real data and the simulated data generated by the generator;
[0054] (3) Initialize random noise and input it into the generator. The generator is responsible for using the noise to generate simulated Internet behavior data with abnormal values. The generated data is then given to the discriminator for discrimination.
[0055] (4) Through the continuous game between the generator and the discriminator, a generative adversarial network model is finally obtained to generate realistic Internet behavior data with outliers.
[0056] The training process of the generative adversarial network model is as follows Figure 2 As shown, its working process is:
[0057] (1) Convert text features in online behavior data into digital features;
[0058] (2) Normalize the data in (1) to [0, 1];
[0059] (3) Create a DataLoader interface to facilitate model training;
[0060] (4) Inputting the online behavior data into the generative adversarial network model to train the generative adversarial network;
[0061] (5) Print the generator loss and discriminator loss in the generative adversarial network and save the model after each training.
[0062] The process of the generator network generating realistic data is as follows Figure 3 As shown, its working process is:
[0063] (1) Initialize n random 4D noise input generator networks;
[0064] (2) The generator outputs simulated Internet behavior data with outliers based on the parameters learned by the model, and obtains n simulated Internet behavior data with outliers.
[0065] Online behavior prediction and detection methods such as Figure 4 As shown, its working process is:
[0066] (1) Taking the simulated Internet behavior data with outliers generated by the generator in the generative adversarial network as the benchmark, using Euclidean distance as the similarity calculation method, and using the exhaustive method to compare the similarity between the test data without outliers and the generated simulated Internet behavior data with outliers;
[0067] (2) For the test data, its outlier value is the outlier value in the simulated data that is closest to its online behavior data;
[0068] (3) Obtain the outlier value of each Internet behavior test data without outliers.
[0069] Evaluation indicators for predicting abnormal online behavior include Figure 5 As shown in the figure, the working process is to calculate the root mean square error (RMSE) between the true value and the predicted value of each online behavior data. The flag is the data subscript for calculating the root mean square error. After traversing the entire test data, the error between the predicted value and the true value of each data is obtained. The accumulated errors are added and then divided by the total to obtain the overall root mean square error. The root mean square error is then calculated to obtain the evaluation index Score = 1 / RMSE + 1, and its value range is [0,1]. The closer it is to 1, the more accurate the prediction of online behavior anomalies is.
[0070] The process of detecting abnormal online behavior based on abnormal online behavior prediction is as follows: Figure 6 As shown, its working process is to determine whether the predicted abnormal value of each Internet behavior data is higher than the safety threshold, so that normal behavior and abnormal behavior can be detected.
[0071] like Figure 1 As shown in the figure, the generative adversarial network consists of a discriminator D and a generator G, where G processes the input random noise into fake data similar to the original data; D is used to determine whether the data is real data or fake data. Similar to a game process, in the continuous game process, D and G learn from each other and continuously improve their data processing capabilities, so that the generator can achieve the best generation effect.
[0072] D and G use the value function V(G,D) shown in formula (1) to learn. G needs to learn the distribution of the original data and keep getting closer to the original data distribution. D needs to accurately judge whether the data is real or generated by the generator. Through the continuous confrontation between the two models, the p learned by the generator should eventually g Equal to p data (where p g represents the data distribution generated by the generator, p data represents the actual data distribution).
[0073]
[0074] In formula (1), x is the real data input to the discriminator, z is the noise vector input to the generator, E is the expected distribution of the data, D(x) represents the distribution of the real data discriminated by the discriminator, and G(z) represents the generated distribution of the data generated by the generator using the noise vector. What D needs to do is to maximize V(D,G), that is, to maximize the difference between the real distribution and the generated distribution, and what G needs to do is to minimize this difference, that is, to make p data With p g The difference between the two distributions is minimal. The distribution generated by G can be assumed to be P G (x;θ),P G (x; θ) is a distribution controlled by parameter θ. For D, maximizing V(D,G) means that the distribution D(x) for the real data x should be close to 1, and the distribution D(G(z)) for the generated data should be close to 0.
[0075] D needs to maximize V(D, G) and solve for the optimal D, as shown in formula (2). According to formula (1), we can further calculate formula (2), which maximizes V(D, G), which is equivalent to maximizing the integrand in formula (2).
[0076]
[0077] Through calculation, D* represents the value of D when V(D, G) is maximum. When D = D*, as shown in formula (3), V(D, G) has a maximum value. Substituting D* into it, we can get the final training standard C(G) of D, as shown in formula (4).
[0078]
[0079]
[0080] It can be seen that the training standard of D is to maximize p data and p g The difference between the two distributions, when D* is formula (3), the maximized V(D,G) is shown in formula (4), and G corresponds to making pdata and p g The distribution of the two is the smallest. By calculation, if and only if the data distribution generated by the generator is p g Equal to the true data distribution p data When p g =p data , in order to achieve the global minimum of the training criterion C(G).
[0081] like Figure 2 As shown, each Internet behavior contains information such as IP (Internet Protocol address), SwitchIP (switch IP), url (Uniform Resource Locator), port (port number), vlan (virtual local area network), time (Internet time), etc. In this embodiment, LabelEncoder is used to encode the Internet behavior features, and the text features are converted into digital features. The digital features obtained after encoding can be received by the model. Advanced features are obtained by splicing and counting features. For example, an advanced feature representing "the number of times a user uses a certain IP to visit a certain url" can judge its abnormal situation based on the number of visits. After training, a specific generative adversarial network model is obtained and the model is saved.
[0082] Figure 3 It is a flow chart of the generator generating realistic Internet behavior data, which indicates that the generator in the trained generative adversarial network is used to generate Internet behavior data to obtain generated data.
[0083] Figure 4 is based on Figure 3 The generated simulated online behavior data is used to predict the online behavior test data. The flowchart shows the specific process of predicting abnormal online behavior. The generated data is used as a benchmark, and the data is taken out from the test set one by one to calculate the similarity with all the data in the generated data (using Euclidean distance as the similarity standard). The outlier of the online behavior data with the closest similarity is the predicted value of this online behavior test data.
[0084] Figure 5 It is a flow chart of the prediction result evaluation standard, which is used as the evaluation index of the prediction of abnormal Internet behavior based on the generative adversarial network in the present invention. The test data is input, the flag is used to traverse the entire test set, and the square sum of the errors between the predicted value and the true value of the flag data is calculated. The sum of the squares is divided by the total to obtain the root mean square error (RMSE), and then the final score is calculated by Score = 1 / RMSE+1.
[0085] Figure 6The present invention is a flow chart of abnormal Internet behavior detection based on abnormal Internet behavior prediction. As an abnormal Internet behavior detection method of the present invention, an Internet behavior safety threshold is set based on abnormal Internet behavior prediction, and the predicted abnormal value is compared with the safety threshold. A value below the safety threshold is safe, and a value above the safety threshold is abnormal. Normal Internet behavior and abnormal Internet behavior can be detected.
[0086] Matters not covered by the present invention are known technologies.
[0087] The above embodiments are only for illustrating the technical concept and features of the present invention, and their purpose is to enable people familiar with the technology to understand the content of the present invention and implement it accordingly, and they cannot be used to limit the protection scope of the present invention. Any equivalent changes or modifications made according to the spirit of the present invention should be included in the protection scope of the present invention.
[0088] The beneficial effects of the present invention are:
[0089] 1. This paper applies an unsupervised generative model, generative adversarial network, to the prediction of abnormal online behavior. Generative adversarial network is one of the most promising deep learning methods. Inspired by zero-sum game, it consists of generator G and discriminator D. The discriminator and generator learn from each other and continuously improve their data processing capabilities, so that the generator can achieve the best effect of generating online behavior data.
[0090] 2. The present invention uses the generator in the generative adversarial network to generate online behavior data with outliers (outliers represent the abnormal degree of user online behavior, between 0 and 1), making the online behavior data more diverse. Through the selection of parameters, the training and use of the entire generative adversarial network are simple, effective and easy to implement.
[0091] 3. The present invention uses the Euclidean distance to calculate the similarity between the Internet behavior data to be predicted and the simulated Internet behavior data generated by the generator. The simulated Internet behavior data with the smallest Euclidean distance is used as the standard, and its outlier is used as the predicted value of the test Internet behavior data. Through this method, the abnormal prediction of Internet behavior of the same employee, multiple employees in a department, and multiple employees in multiple departments has a high accuracy rate.
[0092] 4. The present invention sets an Internet behavior safety threshold based on the prediction of Internet behavior anomalies, and can detect Internet behavior anomalies based on the comparison between the predicted value and the safety threshold.
[0093] 5. The method of the present invention is simple, has a fast model training speed and is easy to implement.
[0094] The present invention has important applications in the analysis of abnormal online behavior in network security, anti-fraud in the financial industry, and monitoring of enemy activities in military missions.
Claims
1. A method for predicting abnormal online behavior based on a generative adversarial network, characterized in that: The method uses a generative adversarial network as an abnormal online behavior prediction model, and inputs online behavior data with abnormal values into the generative adversarial network for fitting training; Then use the generator in the generative adversarial network to generate simulated Internet behavior data with outliers; For each Internet behavior data without outliers for which outliers need to be predicted, find the simulated Internet behavior data with the smallest Euclidean distance, and use the outliers of the simulated Internet behavior data as its own outliers. Finally, predict the Internet behavior anomalies based on the outliers. The specific method for predicting abnormal Internet behavior based on abnormal values is as follows: the higher the abnormal value of the Internet behavior data, the more abnormal the Internet behavior is. A safety threshold is set. If the abnormal value of the Internet behavior data is less than the safety threshold, the Internet behavior is judged to be normal Internet behavior, otherwise the Internet behavior is judged to be abnormal Internet behavior.
2. According to claim 1, a method for predicting abnormal online behavior based on a generative adversarial network is characterized in that: The method comprises the following steps: a. Preprocessing of online behavior data: using LabelEncoder to encode online behavior, converting text features into digital features, splitting and concatenating the encoded information to obtain high-level features, and finally normalizing the high-level features to obtain preprocessed online behavior data; b. Initialize the generative adversarial network model consisting of the generator and the discriminator; c. Input the pre-processed Internet behavior data with outliers into the generative adversarial network for training; d. Use the generator in the trained generative adversarial network to generate multiple simulated Internet behavior data with outliers; e. For each pre-processed Internet behavior data without outliers for which outliers need to be predicted, calculate the Euclidean distance between it and each simulated Internet behavior data, and take the simulated Internet behavior data with the smallest Euclidean distance as the most similar simulated Internet behavior data; f. The outlier value of the simulated online behavior data that is most similar to each online behavior data without outliers for which outliers need to be predicted is used as the outlier value of the online behavior data without outliers, and finally the online behavior anomaly prediction is realized based on the outliers.
3. The method for predicting abnormal online behavior based on a generative adversarial network according to claim 2, characterized in that: The specific method of using the generator in the generative adversarial network to generate multiple simulated Internet behavior data with abnormal values is as follows: (1) Initialize n random 4D noises and input the noise into the generator; (2) The generator outputs simulated Internet behavior data with outliers corresponding to each noise according to the parameters obtained by training the generative adversarial network, and obtains n simulated Internet behavior data with outliers.
4. The method for predicting abnormal online behavior based on a generative adversarial network according to claim 1, characterized in that: The working process of the generative adversarial network is as follows: (1) Initialize a generator network and a discriminator network; (2) Input online behavior data with outliers, and the discriminator is responsible for judging the authenticity of the real data and the simulated data generated by the generator; (3) Initialize the random noise and input it into the generator. The generator is responsible for using the noise to generate simulated Internet behavior data with abnormal values. The generated data is then given to the discriminator for discrimination. (4) Through the continuous game between the generator and the discriminator, a generative adversarial network model is finally obtained to generate realistic Internet behavior data with outliers.
5. The method for predicting abnormal online behavior based on a generative adversarial network according to claim 4 is characterized in that: The specific method of splitting and concatenating the encoded information to obtain high-level features is: (1) After using the LabelEncoder method to digitally encode the string features, each string feature is represented by a specific number; (2) The time feature of online behavior is a string consisting of year, month, day, hour, and minute. The to_datetime function in the panda package is used to split this string into different feature expressions. (3) Different online behavior features are concatenated and then counted to obtain high-level features of different online behaviors.
