Abnormal user detection method and system based on multilayer features

By integrating user statistics, behavior, network attributes and high-dimensional features in the detection of abnormal users on social networks, and using attention-based composite neural networks, the problem of text analysis in the existing technology being difficult to accurately characterize user behavior patterns is solved, achieving Provides more accurate abnormal user detection.

CN118568330AActive Publication Date: 2024-08-30UNIV OF SCI & TECH BEIJING +1
View PDF 11 Cites 0 Cited by

Patent Information

Application Number
CN202410714581.9
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-06-04
Publication Date
2024-08-30
Estimated Expiration
2044-06-04

AI Technical Summary

Technical Problem

Existing methods for detecting abnormal users in social networks mainly rely on text analysis, which is difficult to accurately characterize users' behavior patterns and attributes, and ignores users' behavior patterns and attribute information.

Method used

An abnormal user detection method based on multi-layer features is proposed. It collects social network data through crawlers, cleans and constructs user portraits, integrates user statistical attributes, behavioral attributes, network attributes and high-dimensional attribute features, and uses a composite method based on attention mechanism. Neural networks make classification predictions.

Benefits of technology

Effectively integrates user behavior patterns, attributes and tweet features to improve the accuracy and effect of abnormal user detection and obtain better classification prediction results.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118568330A
    Figure CN118568330A
Patent Text Reader

Abstract

The invention belongs to the technical field of user detection, and particularly relates to an abnormal user detection method and system based on multilayer features, which effectively fuses user behavior patterns, user attributes and user tweet features in social data. Social network user data is summarized into four levels of user statistical attributes, user behavior attributes, user network attributes and high-dimensional attributes, and normal users and abnormal users are classified and predicted by using a composite neural network model based on an attention mechanism, so that a better abnormal user detection result can be obtained.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention belongs to the technical field of user detection, and specifically relates to a method and system for detecting abnormal users based on multi-layer features. Background Art

[0002] In the Internet era, social networks serve as a platform for users to express their personal opinions and thoughts, and are also the primary channel for most people to receive social information. Whenever a major social incident occurs, in addition to a large number of normal users' discussions on social network platforms, some abnormal users' malicious and guiding remarks are also implied, which affects the public's judgment of the incident and causes a series of adverse effects. Most of the existing abnormal user detection methods on social networks only use natural language processing algorithms to process user tweets or comments, extract semantic features to train classifiers, and thus determine whether the user is an abnormal user. Taking the Chinese social network Weibo as an example, the existing abnormal user detection methods generally obtain training data sets by obtaining social network tweets or comments. Data cleaning is performed by removing duplicate content, hyperlinks and emoticons, etc., to obtain pure text content. The feature matrix is ​​constructed by feature extraction and word vectorization methods such as TF-IDF and word2vec. Finally, the feature matrix is ​​input into deep learning or machine learning classifiers such as RNN, LSTM, SVM for training. After the classifier training and screening, the text is divided into malicious text and normal text, so as to make an abnormal judgment on the user to whom the text belongs.

[0003] Social data is mainly text-based, but it also contains information such as user attributes and user behavior. Social text analysis can be used to detect abnormal users. However, social data is heterogeneous, dynamic, noisy, hidden, and informal. It is difficult to accurately characterize abnormal users or discover their behavior patterns and personalities by text analysis alone. In recent years, multi-layer attention mechanisms have been widely used in abnormal user detection. They have shown superior performance in mining hidden information in texts compared to traditional neural networks and machine learning algorithms. However, they still only focus on the analysis of comment texts and ignore user behavior patterns and attribute information. Summary of the invention

[0004] In order to solve the problems existing in the prior art, the main purpose of the present invention is to propose an abnormal user detection method and system based on multi-layer features, which effectively integrates user behavior patterns, user attributes and user tweet features in social data, and uses a composite neural network based on the attention mechanism to classify and predict normal users and abnormal users.

[0005] To solve the above technical problems, according to one aspect of the present invention, the present invention provides the following technical solutions:

[0006] A method for detecting abnormal users based on multi-layer features comprises the following steps:

[0007] S1. Collect social network data through crawlers. The collected content includes user homepage information, social network information and tweet information. The collected content is integrated to form a social network user data set used for training;

[0008] S2, performing data cleaning operations on the data in the social network user data set;

[0009] S3. Summarize the cleaned data into four levels of user features: personal features, network features, tweet features, and high-dimensional features, and construct user portraits;

[0010] S4, feature fusion of user features at four levels;

[0011] S5. Input the fused feature matrix into the classifier for training to complete abnormal user detection based on multi-layer features.

[0012] Preferably, in step S1, during the social network collection stage by crawlers, according to pre-set rules, the web crawler automatically captures public information on web pages by simulating a browser to send a network request to a server and receive a request response.

[0013] Preferably, in step S2, data cleaning first removes the training data containing missing fields in the original data set to obtain an original data set without missing fields; since there may be a problem of repeated crawling during crawling, data cleaning uses the content field in the data set as a comparison condition, removes duplicate data from the original data set without missing fields, and obtains an original data set without missing or duplicate fields; data with a field type of str belongs to unstructured text data that cannot be recognized by a computer and needs to be processed; in the data set without missing or duplicate fields, for time fields such as birth, year, and publish_time, the str information is converted to datetime type through the parse method in the dateutil package; in the data set without missing or duplicate fields, for long text data such as content and topic, the links and emoticons in str are first removed through the clean method in the harvesttext library, and then the traditional Chinese is converted into simplified Chinese through the convert method in the zhconv package; after the above cleaning, the cleaned original data set U is obtained.

[0014] Preferably, in step S3, the social network user data is summarized into four levels: user statistical attributes, user behavioral attributes, user network attributes and high-dimensional attributes.

[0015] Preferably, in step S3, the abnormal user profile problem is summarized as a given user The abnormal label lm ∈L={0,1} selected problem; where u m It refers to any piece of user data in the cleaned original data set, U is the cleaned original data set, n is the total number of user data contained in the cleaned original data set, and label l m =0 indicates a non-abnormal user, label l m =1 indicates an abnormal user.

[0016] Preferably, in step S3, for any piece of data u m , feature construction and selection are performed according to the following rules:

[0017] (1) Personal characteristics: including user_id_length, user_id_num, year, sex, and ip;

[0018] user_id_length: the length of the nickname, obtained by counting u m The number of characters in the field name is obtained;

[0019] user_id_num: the proportion of numbers in nicknames, calculated by counting u m The number of characters in the field name is compared with the total number of characters;

[0020] year: user age, expressed in u m The year field in the middle field is obtained directly or by using the current time and u m The middle field birth is calculated by difference;

[0021] sex: User gender, via u m The sex field in the middle is obtained directly;

[0022] ip: via u m The location field in the middle is retrieved and compared with the Chinese postal code table;

[0023] (2) Tweet features: including publish_hour, is_origion, is_topic, and content_vec;

[0024] publish_hour: Weibo publishing time, through u m The publish_time field in the middle is directly obtained;

[0025] is_origin: whether it is an original microblog, through u m The is_origin field in the middle is obtained directly;

[0026] is_topic: whether it contains a topic, through u mThe is_topic field in the middle is obtained directly;

[0027] content_vec: tensor obtained by text type content, obtained through BERT pre-training model, used as input for subsequent classifiers;

[0028] (3) Network features: including forward_num, comment_num, like_num, followers_num, and following_num;

[0029] Network characteristics can be obtained through u m The fields with the same name in are obtained directly;

[0030] (4) High-dimensional features: High-dimensional features l m " reflects the properties of social network user data that cannot be described by explicit meaning. The subscripts m and u m The m in is the user number. The export of high-dimensional features includes eight steps:

[0031] 1) Sample a subset U of size k from the cleaned original data set U s , select U from the label set L s The corresponding label set L s ;

[0032] 2) Obtain the subset U according to the above rules for constructing user portraits s Any user Feature vectors other than high-dimensional features

[0033] 3) Yes Perform feature fusion to obtain a single input vector for the classifier

[0034] 4) Using the Matrix As input, its corresponding label [l1,…l k-1 ,l k ] T As output, train the first-layer classifier and retain the classifier parameters. The classifier can be any low-level classifier, including but not limited to naive Bayes classifier, shallow neural network, etc.

[0035] 5) According to the above rules for constructing user portraits, any user in the set U is obtained Feature vectors other than high-dimensional features

[0036] 6) Yes Perform feature fusion, see below for the method, and get a single input vector for the classifier

[0037] 7) Using the input vector As the prediction object, use the trained layer classifier to predict the output prediction value

[0038] 8) The predicted value of the classifier l m 'After normalization, we get high-dimensional features l m ”;

[0039] After the user portrait is constructed, a user feature vector containing high-dimensional features is obtained User feature vector and its corresponding label l m Stored in csv format as dataset U profile ; where user feature vector Contains a single piece of data u m The 15 features obtained from the portrait have a total of 14+768=782 values.

[0040] Preferably, in step S4, before the feature is sent to the classifier, the tweet feature content_vec of length 768 needs to be fused with more than ten other features; the feature fusion step exists in both the high-dimensional feature derivation step 3) and the step 6) and the abnormal user detection based on multi-layer features, the only difference being that the abnormal user detection based on multi-layer features has one more feature (high-dimensional feature l m ”).

[0041] Preferably, in step S5, a composite neural network model based on an attention mechanism is used for training, which specifically includes the following steps:

[0042] 1) First, extract the image features from the dataset U profile Divide into training set and test set according to 8:2, assuming that the training set has s data;

[0043] 2) Take the s data in the training set Perform feature fusion to obtain Then get the input of the model

[0044] 3) Use CNN to extract features, select ReLU as the activation function for the convolution layer, use the maximum pooling method, and finally get the output through sigmoid activation The representation is as follows:

[0045]

[0046] P=max(Z)+b p

[0047]

[0048] Among them, Z is the output of a convolution layer, P is the output of the pooling, and W c is the convolutional layer weight, W o is the output layer weight, b c is the convolutional layer bias, b p is the pooling layer bias, b o is the output layer bias;

[0049] 4) Use LSTM to extract text features and output h t It is expressed as follows:

[0050] h t =LSTM(O c,t-1 ,O c,t ),t∈[1,i]

[0051] Among them, O c,t O c The value at time t, i is O c Length;

[0052] 5) Use the output of LSTM as the input of the attention layer and assign weights in a probabilistic manner. The output of the attention layer is o t It is expressed as follows:

[0053] e t =utanh(wh t +b)

[0054]

[0055] Among them, u and w are weights; b is bias; e is t is the probability distribution;

[0056] 6) The abnormal user prediction result y is obtained through the sigmoid activation function. y is expressed as follows:

[0057] y=sigmoid(ws t +b)

[0058] Among them, w is the weight and b is the bias.

[0059] According to another aspect of the present invention, the present invention provides the following technical solution:

[0060] A multi-layer feature-based abnormal user detection system, used to implement the above-mentioned multi-layer feature-based abnormal user detection method, comprising:

[0061] Data collection module: collects social network data through crawlers. The collected content includes user homepage information, social network information and tweet information. The collected content is integrated to form a social network user data set used for training;

[0062] Data cleaning module: performs data cleaning operations such as deduplication, link removal, expression removal, and deletion of useless data on the data in the social network user data set;

[0063] Build user portrait module: summarize the cleaned data into four levels of user features: personal features, network features, tweet features, and high-dimensional features, and build user portraits;

[0064] Feature fusion module: fuses the user features at four levels;

[0065] Abnormal user detection module: The fused feature matrix is ​​input into the classifier for training to complete abnormal user detection based on multi-layer features.

[0066] The beneficial effects of the present invention are as follows:

[0067] The present invention proposes an abnormal user detection method and system based on multi-layer features, which effectively integrates user behavior patterns, user attributes and user tweet features in social data, summarizes social network user data into four levels: user statistical attributes, user behavioral attributes, user network attributes and high-dimensional attributes, and uses a composite neural network model based on the attention mechanism to classify and predict normal users and abnormal users, so as to obtain better abnormal user detection results. BRIEF DESCRIPTION OF THE DRAWINGS

[0068] In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on the structures shown in these drawings without paying creative work.

[0069] Figure 1 The figure is a flow chart of the abnormal user detection method based on multi-layer features of the present invention.

[0070] Figure 2 It is a schematic diagram of the feature fusion process of the present invention.

[0071] Figure 3 It is a schematic diagram of the process of training the composite neural network model of the present invention.

[0072] The realization of the purpose, functional features and advantages of the present invention will be further explained in conjunction with embodiments and with reference to the accompanying drawings. DETAILED DESCRIPTION

[0073] The following will be described clearly and completely in conjunction with the technical solutions in the embodiments. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.

[0074] The present invention proposes a method and system for detecting abnormal users based on multi-layer features, which has the following advantages:

[0075] (1) It provides a method for autonomously collecting user data from social networking platforms (taking Weibo as an example). By changing the seed URL, it is possible to collect user homepage information, social network information, and tweet information, rather than relying on existing web crawler tools to collect data within a limited scope.

[0076] (2) In addition to text, a user portrait construction method is proposed that incorporates user behavior patterns and attribute information. Social network user data is summarized into four levels: user statistical attributes, user behavioral attributes, user network attributes, and high-dimensional attributes. This enriches the input of the classifier and can obtain better results than abnormal user detection based on pure text.

[0077] (3) High-dimensional features use the idea of ​​stacking strategy. Stacking method is often used in classification model training to prevent the model from being affected by the inherent defects of a single algorithm, which can enhance the robustness of the prediction method.

[0078] (4) Feature fusion is required before the features are sent to the classifier. Since the length of the tweet feature content_vec is 768 and the other features total 14, directly sending them to the classifier for training will cause a few features to be directly overwhelmed by the network. Therefore, a feature fusion method for increasing the dimension of the 14 features is proposed.

[0079] According to one aspect of the present invention, the present invention provides the following technical solution:

[0080] like Figure 1 As shown, a method for detecting abnormal users based on multi-layer features includes the following steps:

[0081] S1. Collect social network data through crawlers. The collected content includes user homepage information, social network information and tweet information. The collected content is integrated to form a social network user data set used for training;

[0082] S2. Perform data cleaning operations such as removing duplicates, removing links, removing expressions, and deleting useless data on the data in the social network user data set;

[0083] S3. Summarize the cleaned data into four levels of user features: personal features, network features, tweet features, and high-dimensional features, and construct user portraits;

[0084] S4, feature fusion of user features at four levels;

[0085] S5. Input the fused feature matrix into the classifier for training to complete abnormal user detection based on multi-layer features.

[0086] In one embodiment of the present invention, in step S1, during the social network collection phase by crawlers, according to pre-set rules, the web crawler automatically crawls public information on web pages by simulating a browser to send a network request to a server and receive a request response.

[0087] In one embodiment of the present invention, in step S1, right-click on the original page to be crawled and select [Inspect] to enter the web developer tool, and obtain the request URL and web page request method of the original page from the [Header] in the [Network] mode; use the request method to request the web page, parse the URL address to obtain the web page information; use the web page parsing method such as xpath / bs4 / re to parse the web page; add the URL obtained by parsing to the collection list according to pre-set rules, and then select the next page URL to be crawled according to a specific strategy until the collection list is empty or sufficient data is collected; store the valid information after the web page information is parsed as the original data set.

[0088] In one embodiment of the present invention, in the step S1, in the user homepage information crawling task, the original page URL is https: / / s.weibo.com / user, where user refers to the unique identification code uid of the Weibo user, and the URL list to be crawled contains the seed URL of the user to be crawled, and each URL is distinguished by user; the web page information is stored in html format, and the crawled content needs to be obtained by web page parsing: the structured information (nickname, gender, number of followers, IP address, etc.) in the crawled web page belongs to structured access in the web page, and is directly read after being converted to json format through response.json(); the remaining unstructured access information is extracted through xpath.

[0089] In one embodiment of the present invention, in step S1, the crawling task of user tweet information and network information is for Weibo topics, and the original page URL is https: / / s.weibo.com / weibo?q=%23%E6%9D%8E%E8%8D%A3%E6%B5%A9%23, where q represents the unicode encoding of the Weibo topic keyword; the web page information obtained by parsing the URL address is extracted through xpath and Python's String library related text processing API.

[0090] In one embodiment of the present invention, in step S1, the fields of the original data set crawled are as follows:

[0091]

[0092] In one embodiment of the present invention, in step S2, since the data of the social network platform is sparse, the missing values ​​in the original data set obtained by crawling will affect the network performance. The data cleaning first removes the training data containing missing fields in the original data set to obtain the original data set without missing fields; since there may be repeated crawling problems in the crawling, the data cleaning uses the content field in the data set as a comparison condition, removes duplicate data from the original data set without missing fields, and obtains a complete and non-missing original data set; the data with the field type of str belongs to unstructured text data that cannot be recognized by the computer and needs to be processed; in the complete and non-missing data set, for time fields such as birth, year, and publish_time, the str information is converted to datetime type through the parse method in the dateutil package; in the complete and non-missing data set, for long text data such as content and topic, the links and emoticons in str are first removed by the clean method in the harvesttext library, and then the traditional Chinese is converted to simplified Chinese by the convert method in the zhconv package; after the above cleaning, the cleaned original data set U is obtained.

[0093] In one embodiment of the present invention, in step S3, social network user data can be summarized into four levels: user statistical attributes (age, gender, IP address, etc.), user behavioral attributes (posting comments, tweets, topics, etc.), user network attributes (following and being followed, egocentric network structure, etc.) and high-dimensional attributes; the input of the classifier can be enriched according to the four levels of social network user data attributes, and in addition to text analysis, the user's behavior pattern and attribute information are also input, which can theoretically enhance the effect of abnormal user detection.

[0094] In one embodiment of the present invention, in step S3, the abnormal user profile problem can be summarized as: The abnormal label l m ∈L={0,1} selected problem; where u m It refers to any piece of user data in the cleaned original data set, U is the cleaned original data set, n is the total number of user data contained in the cleaned original data set, and label l m =0 indicates a non-abnormal user, label l m =1 indicates an abnormal user.

[0095] In one embodiment of the present invention, in step S3, for any piece of data u m , feature construction and selection are performed according to the following rules:

[0096] (1) Personal characteristics: including user_id_length, user_id_num, year, sex, and ip;

[0097] user_id_length: the length of the nickname, obtained by counting u m The number of characters in the field name is obtained. Studies have shown that the length of the nickname is correlated with user activity. Non-default numeric nicknames with longer characters generally belong to non-abnormal users.

[0098] user_id_num: the proportion of numbers in nicknames, calculated by counting u m The number of numeric characters in the name field is calculated by comparing the total number of characters. Since the initial nicknames of Weibo users are garbled numbers, a high proportion of numbers in the nickname can, to a certain extent, reflect that the user is an abnormal user such as a "small account" or a "water army";

[0099] year: user age, expressed in u m The year field in the middle field is obtained directly or by using the current time and u m The year feature may be unknown. Among users with unknown year features, the proportion of abnormal users is higher than that of users with known year features.

[0100] sex: User gender, via u m The sex field in the middle field is directly obtained and divided into {male, female, unknown}. The proportion of abnormal users among users with unknown sex features is higher than that among users with known sex features.

[0101] ip: via u m The location field in the middle is searched and compared with the Chinese postal code table to confirm that the user is classified as {within China, outside China, unknown};

[0102] (2) Tweet features: including publish_hour, is_origion, is_topic, and content_vec;

[0103] publish_hour: Weibo publishing time, through u m The publish_time field in the middle field is directly derived; the publishing time largely reflects the user's behavior habits and living conditions, and sometimes it can also reflect whether the user is within the Beijing time range;

[0104] is_origin: whether it is an original microblog, through u m The is_origin field in the middle field is directly obtained to confirm that the tweet is classified as {original, non-original}; original microblogs reflect the user's social habits and sharing habits;

[0105] is_topic: whether it contains a topic, through u m The is_topic field in the is_topic field is directly obtained; if the field is empty, you can use the re regular expression to match u m Whether the content field contains "#.*?#" determines whether it contains a topic. The matching principle is that .*? refers to characters of any length and content. The confirmation tweet is divided into {contains a topic, does not contain a topic}; this feature reflects the user's attention to real-time hot spots. The is_topic feature of abnormal users is mostly containing topics;

[0106] content_vec: tensor obtained by text type content, obtained through bert pre-training model, used as input for subsequent classifiers; the specific operation is to import BertModel from transformers, use the from_pretrained method to load the 'bert_base_chinese' pre-training model from BertModel, and finally use the bert method to convert u m The field content is converted into the output of the last hidden layer of the bert_base_chinese model. The output is a three-dimensional tensor with a length of 768, meaning u m The sentence-level representation of the content sequence in the middle field can be used as the classifier input for downstream tasks;

[0107] (3) Network features: including forward_num, comment_num, like_num, followers_num, and following_num.

[0108] Network characteristics are also called degree characteristics, which are important statistical indicators reflecting the popularity, activity, and network influence of users. Network characteristics can be obtained through um The fields with the same name in are obtained directly;

[0109] (4) High-dimensional features: High-dimensional features l m " reflects the attributes of social network user data that cannot be described by explicit meaning. The subscript m (1≤m≤n) and u m The m in is the user number. The export of high-dimensional features includes eight steps:

[0110] 1) Sample a subset U of size k (0≤k≤n) from the cleaned original data set U s , select U from the label set L s The corresponding label set L s ;

[0111] 2) Obtain the subset U according to the above rules for constructing user portraits s Any user Feature vectors other than high-dimensional features

[0112] 3) Yes Perform feature fusion, see below for the method, and get a single input vector for the classifier

[0113] 4) Using the Matrix As input, its corresponding label [l1,…l k-1 ,l k ] T As output, train the first-layer classifier and retain the classifier parameters. The classifier can be any low-level classifier, including but not limited to naive Bayes classifier, shallow neural network, etc.

[0114] 5) According to the above rules for constructing user portraits, any user in the set U is obtained Feature vectors other than high-dimensional features

[0115] 6) Yes Perform feature fusion to obtain a single input vector for the classifier

[0116] 7) Using the input vector As the prediction object, use the trained layer classifier to predict the output prediction value

[0117] 8) The predicted value of the classifier l m 'After normalization, we get high-dimensional features l m ”;

[0118] After the user portrait is constructed, a user feature vector containing high-dimensional features is obtained User feature vector and its corresponding label l m Stored in csv format as dataset U profile ; where user feature vector Contains a single piece of data u m The 15 features obtained from the portrait have a total of 14+768=782 values.

[0119] In one embodiment of the present invention, in step S4, the tweet feature content_vec of length 768 needs to be fused with more than ten other features before the feature is sent to the classifier; the feature fusion step exists in both the high-dimensional feature derivation step 3) and the step 6) and the abnormal user detection based on multi-layer features, where the only difference is that the abnormal user detection based on multi-layer features has one more feature (high-dimensional feature l m ”).

[0120] In one embodiment of the present invention, in step S4, the feature fusion step is as follows: Figure 2 As shown in the figure, the squares represent any row of the matrix feature matrix. Indicates feature fusion. There are two fusion modes: concat is feature concatenation, which directly concatenates two 768-dimensional features into a 1536-dimensional fused feature; add is feature addition, that is, each feature is added in order to obtain a new 768-dimensional fused feature.

[0121] In one embodiment of the present invention, in step S5, in order to achieve a better recognition effect, a composite neural network model based on the attention mechanism is used for training, and its flow chart is as follows: Figure 3 As shown, the specific steps include:

[0122] 1) First, extract the image features from the dataset U profile Divide into training set and test set according to 8:2, assuming that the training set has s data;

[0123] 2) Take the s data in the training set Perform feature fusion to obtain Then get the input of the model

[0124] 3) Use CNN to extract features, select ReLU as the activation function for the convolution layer, use the maximum pooling method, and finally get the output through sigmoid activation The representation is as follows:

[0125]

[0126] P=max(Z)+b p

[0127]

[0128] Among them, Z is the output of a convolution layer, P is the output of the pooling, and W c is the convolutional layer weight, W o is the output layer weight, b c is the convolutional layer bias, b p is the pooling layer bias, b o is the output layer bias;

[0129] 4) Use LSTM to extract text features and output h t It is expressed as follows:

[0130] h t =LSTM(O c,t-1 ,O c,t ),t∈[1,i]

[0131] Among them, O c,t O c The value at time t, i is O c Length;

[0132] 5) Use the output of LSTM as the input of the attention layer and assign weights in a probabilistic manner. The output of the attention layer is o t It is expressed as follows:

[0133] e t =utanh(wh t +b)

[0134]

[0135] Among them, u and w are weights; b is bias; e is t is the probability distribution;

[0136] 6) The abnormal user prediction result y is obtained through the sigmoid activation function. y is expressed as follows:

[0137] y=sigmoid(ws t +b)

[0138] Among them, w is the weight and b is the bias.

[0139] According to another aspect of the present invention, the present invention provides the following technical solution:

[0140] A multi-layer feature-based abnormal user detection system, used to implement the above-mentioned multi-layer feature-based abnormal user detection method, comprising:

[0141] Data collection module: collects social network data through crawlers. The collected content includes user homepage information, social network information and tweet information. The collected content is integrated to form a social network user data set used for training;

[0142] Data cleaning module: performs data cleaning operations such as deduplication, link removal, expression removal, and deletion of useless data on the data in the social network user data set;

[0143] Build user portrait module: summarize the cleaned data into four levels of user features: personal features, network features, tweet features, and high-dimensional features, and build user portraits;

[0144] Feature fusion module: fuses the user features at four levels;

[0145] Abnormal user detection module: The fused feature matrix is ​​input into the classifier for training to complete abnormal user detection based on multi-layer features.

[0146] It should be noted that the BERT model used in content_vec is not limited to BERT_base_chinese; the selection of low-level trainers in high-dimensional features covers various existing machine learning and deep learning classifiers; the algorithm used in the abnormal user detection method based on multi-layer features is not limited to convolutional neural networks.

[0147] The present invention effectively integrates user behavior patterns, user attributes and user tweet features in social data, summarizes social network user data into four levels: user statistical attributes, user behavioral attributes, user network attributes and high-dimensional attributes, and uses a composite neural network model based on the attention mechanism to classify and predict normal users and abnormal users, so as to obtain better abnormal user detection results.

[0148] The above description is only a preferred embodiment of the present invention, and does not limit the patent scope of the present invention. All equivalent structural changes made by using the contents of the present invention specification under the inventive concept of the present invention, or directly / indirectly applied in other related technical fields are included in the patent protection scope of the present invention.

Claims

1. A method for detecting abnormal users based on multi-layer features. It is characterized in that The following steps are involved: S1. Collect social network data through crawlers. The collected content includes user homepage information, social network information and tweet information. The collected content is integrated to form a social network user data set used for training; S2, performing data cleaning operations on the data in the social network user data set; S3. Summarize the cleaned data into four levels of user features: personal features, network features, tweet features, and high-dimensional features, and construct user portraits; S4, feature fusion of user features at four levels; S5. Input the fused feature matrix into the classifier for training to complete abnormal user detection based on multi-layer features.

2. The abnormal user detection method based on multi-layer features according to claim 1, It is characterized in that In step S1, during the social network collection phase by using a crawler, according to pre-set rules, the web crawler automatically crawls public information on a web page by simulating a browser to send a network request to a server and receive a request response.

3. The abnormal user detection method based on multi-layer features according to claim 1, It is characterized in that In the step S2, data cleaning first removes the training data containing missing fields in the original data set to obtain an original data set without missing fields; since there may be a problem of repeated crawling during crawling, data cleaning uses the content field in the data set as a comparison condition, removes duplicate data from the original data set without missing fields, and obtains an original data set without missing or duplicate fields; data with a field type of str belongs to unstructured text data that cannot be recognized by computers and needs to be processed; in the data set without missing or duplicate fields, for time fields such as birth, year, and publish_time, the str information is converted to datetime type through the parse method in the dateutil package; in the data set without missing or duplicate fields, for long text data such as content and topic, the links and emoticons in str are first removed through the clean method in the harvesttext library, and then the traditional Chinese is converted to simplified Chinese through the convert method in the zhconv package; after the above cleaning, the cleaned original data set U is obtained.

4. The abnormal user detection method based on multi-layer features according to claim 1, It is characterized in that In step S3, the social network user data is summarized into four levels: user statistical attributes, user behavioral attributes, user network attributes and high-dimensional attributes.

5. The abnormal user detection method based on multi-layer features according to claim 4, It is characterized in that In step S3, the abnormal user profile problem is summarized as given a user The abnormal label l m ∈L={0,1} selected problem; where u m It refers to any piece of user data in the cleaned original data set, U is the cleaned original data set, n is the total number of user data contained in the cleaned original data set, and label l m =0 indicates a non-abnormal user, label l m =1 indicates an abnormal user.

6. The abnormal user detection method based on multi-layer features according to claim 5, It is characterized in that In step S3, for any piece of data u m , feature construction and selection are performed according to the following rules: (1) Personal characteristics: including user_id_length, user_id_num, year, sex, and ip; user_id_length: the length of the nickname, obtained by counting u m The number of characters in the field name is obtained; user_id_num: the proportion of numbers in nicknames, calculated by counting u m The number of characters in the field name is compared with the total number of characters; year: user age, expressed in u m The year field in the middle field is obtained directly or by using the current time and u m The middle field birth is calculated by difference; sex: User gender, via u m The sex field in the middle is obtained directly; ip: via u m The location field in the middle is retrieved and compared with the Chinese postal code table; (2) Tweet features: including publish_hour, is_origion, is_topic, and content_vec; publish_hour: Weibo publishing time, through u m The publish_time field in the middle is directly obtained; is_origin: whether it is an original microblog, through u m The is_origin field in the middle is obtained directly; is_topic: whether it contains a topic, through u m The is_topic field in the middle is obtained directly; content_vec: tensor obtained by text type content, obtained through BERT pre-training model, used as input for subsequent classifiers; (3) Network features: including forward_num, comment_num, like_num, followers_num, and following_num; Network characteristics can be obtained through u m The fields with the same name in are obtained directly; (4) High-dimensional features: High-dimensional features l m " reflects the properties of social network user data that cannot be described by explicit meaning. The subscripts m and u m The m in is the user number. The export of high-dimensional features includes eight steps: 1) Sample a subset U of size k from the cleaned original data set U s , select U from the label set L s The corresponding label set L s ; 2) Obtain the subset U according to the above rules for constructing user portraits s Any user Feature vectors other than high-dimensional features 3) Yes Perform feature fusion to obtain a single input vector for the classifier 4) Using the Matrix As input, its corresponding label [l 1 ,…l k-1 ,l k ] T As output, train the first-layer classifier and retain the classifier parameters. The classifier can be any low-level classifier, including but not limited to naive Bayes classifier, shallow neural network, etc. 5) According to the above rules for constructing user portraits, any user in the set U is obtained Feature vectors other than high-dimensional features 6) Yes Perform feature fusion, see below for the method, and get a single input vector for the classifier 7) Using the input vector As the prediction object, use the trained layer classifier to predict the output prediction value 8) The predicted value of the classifier l m 'After normalization, we get high-dimensional features l m ”; After the user portrait is constructed, a user feature vector containing high-dimensional features is obtained. User feature vector and its corresponding label l m Stored in csv format as dataset U profile ;in User feature vector Contains a single piece of data u m The 15 features obtained from the portrait have a total of 14+768=782 values.

7. The abnormal user detection method based on multi-layer features according to claim 1, It is characterized in that In step S5, a composite neural network model based on an attention mechanism is used for training, which specifically includes the following steps: 1) First, extract the image features from the dataset U profile Divide into training set and test set according to 8:2, assuming that the training set has s data; 2) Take the s data in the training set Perform feature fusion to obtain Then get the input of the model 3) Use CNN to extract features, select ReLU as the activation function for the convolution layer, use the maximum pooling method, and finally get the output through sigmoid activation The representation is as follows: P=max(Z)+b p Among them, Z is the output of a layer of convolution, P is the output of pooling, and W c is the convolutional layer weight, W o is the output layer weight, b c is the convolutional layer bias, b p is the pooling layer bias, b o is the output layer bias; 4) Use LSTM to extract text features and output h t It is expressed as follows: h t =LSTM(O c,t-1 ,O c,t ),t∈[1,i] Among them, O c,t O c The value at time t, i is O c Length; 5) Use the output of LSTM as the input of the attention layer and assign weights in a probabilistic manner. The output of the attention layer is o t It is expressed as follows: e t =utanh(wh t +b) Among them, u and w are weights; b is bias; e is t is the probability distribution; 6) The abnormal user prediction result y is obtained through the sigmoid activation function. y is expressed as follows: y=sigmoid(ws t +b) Among them, w is the weight and b is the bias.

8. An abnormal user detection system based on multi-layer features, used to implement the abnormal user detection method based on multi-layer features according to any one of claims 1 to 7, It is characterized in that include: Data collection module: collects social network data through crawlers. The collected content includes user homepage information, social network information and tweet information. The collected content is integrated to form a social network user data set used for training; Data cleaning module: performs data cleaning operations such as deduplication, link removal, expression removal, and deletion of useless data on the data in the social network user data set; Build user portrait module: summarize the cleaned data into four levels of user features: personal features, network features, tweet features, and high-dimensional features, and build user portraits; Feature fusion module: fuses the user features at four levels; Abnormal user detection module: The fused feature matrix is ​​input into the classifier for training to complete abnormal user detection based on multi-layer features.

Citation Information

Patent Citations

  • Detection method for abnormal user in social network based on network mapping

    CN107835113A

  • Social robot detection method and system capable of blending user behaviors with text information

    CN108763319A

  • Microblog user attribute analysis method based on multiple features

    CN111125486A

  • Social network user region identification method based on weak supervision enhancement

    CN113505307A

  • Webpage user behavior detection method and system based on improved machine learning

    CN114169540A