Abnormal content detection method and device and electronic equipment
By converting feature data into a preset number system and using a coding network to generate representation vectors, the problem of reduced preprocessing speed in the existing technology is solved, faster abnormal content detection is achieved, and user experience is improved.
Patent Information
- Application Number
- CN202411898732.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-12-20
- Publication Date
- 2025-01-24
- Estimated Expiration
- 2044-12-20
AI Technical Summary
When using neural network detection models for abnormal content detection, the speed of the preprocessing phase decreases due to the increase in the embedding matrix dimension, resulting in the slowing of the user's acquisition of detection results.
By converting numerical types of feature data to preset data, and using pre -training coding networks to encode the transformed feature data, generate the exponential vector input detection model for abnormal content detection.
This method improves the speed of abnormal content detection and user experience by reducing the dimension of the representation matrix of feature data.
Smart Images

Figure CN119357641A_ABST
Abstract
Description
Technical Field
[0001] This document belongs to the field of data processing technology, and specifically relates to a method, device and electronic equipment for detecting abnormal content. Background Art
[0002] In the fields of industrial production, network security, financial risk control, etc., the use of detection models composed of neural networks is a common solution for detecting abnormal content. Before the detection model is built, the feature data of numerical type that does not infringe on user privacy will be preprocessed. This preprocessing often includes bucketing (or binning) the feature data.
[0003] Generally, several numerical intervals are divided according to equal frequency or equal width, and each numerical interval is regarded as a bucket. Assuming that there are m buckets in total and the feature data falls into the nth bucket, the nth row can be selected from the initialized m*d embedding matrix (i.e., embedding matrix) as the representation of the feature data, and then the representation of the feature data can be input into the detection model for abnormal content detection.
[0004] However, the speed of preprocessing often decreases rapidly as the dimension of the embedding matrix increases, which greatly reduces the speed at which users obtain the detection results output by the detection model. Therefore, it is necessary to provide a better abnormal content detection solution to increase the speed at which users obtain detection results for abnormal content, thereby improving user experience. Summary of the invention
[0005] The embodiments of this specification provide a method, an apparatus, and an electronic device for detecting abnormal content, so as to provide an abnormal content detection solution.
[0006] In a first aspect, an embodiment of the present specification provides a method for detecting abnormal content, the method comprising: obtaining feature data of a numerical type of a target user, and converting the feature data into data of a preset number system; determining a representation matrix corresponding to the converted feature data based on a preset representation vector corresponding to the digits of each data bit in the data of the preset number system in a preset representation matrix; encoding the representation matrix corresponding to the feature data using a pre-trained encoding network to obtain a representation vector corresponding to the feature data; inputting the representation vector corresponding to the feature data into a detection model for abnormal content detection to obtain a detection result of abnormal content for the target user.
[0007] In a second aspect, an embodiment of the present specification provides a device for detecting abnormal content, comprising: a number system conversion module, used to obtain feature data of a numerical type of a target user, and convert the feature data into data of a preset number system; a representation matrix module, used to determine a representation matrix corresponding to the converted feature data based on a preset representation vector corresponding to the digital number of each data bit in the data of the preset number system in the preset representation matrix; a representation vector module, used to use a pre-trained encoding network to encode the representation matrix corresponding to the feature data, and obtain a representation vector corresponding to the feature data; a detection result module, used to input the representation vector corresponding to the feature data into a detection model for abnormal content detection, and obtain a detection result of abnormal content for the target user.
[0008] In a third aspect, an embodiment of the present specification provides an electronic device, comprising: a processor, and a memory arranged to store computer executable instructions, wherein when the executable instructions are executed, the processor can: obtain feature data of a numerical type of a target user, and convert the feature data into data of a preset number system; determine a representation matrix corresponding to the converted feature data based on a preset representation vector corresponding to the digits of each data bit in the data of the preset number system in a preset representation matrix; use a pre-trained encoding network to encode the representation matrix corresponding to the feature data to obtain a representation vector corresponding to the feature data; input the representation vector corresponding to the feature data into a detection model for abnormal content detection to obtain a detection result of abnormal content for the target user.
[0009] In a fourth aspect, an embodiment of the present specification provides a storage medium for storing a computer program, which can be executed by a processor to implement the following process: obtaining feature data of a numerical type of a target user, and converting the feature data into data of a preset number system; determining a representation matrix corresponding to the converted feature data based on a preset representation vector corresponding to the digits of each data bit in the data of the preset number system in a preset representation matrix; using a pre-trained encoding network to encode the representation matrix corresponding to the feature data to obtain a representation vector corresponding to the feature data; inputting the representation vector corresponding to the feature data into a detection model for abnormal content detection to obtain a detection result of abnormal content for the target user.
[0010] In a fifth aspect, an embodiment of the present specification provides a computer program product, including a computer program, which implements the following process when executed by a processor: obtaining feature data of a numerical type of a target user, and converting the feature data into data of a preset number system; determining a representation matrix corresponding to the converted feature data based on a preset representation vector corresponding to the digits of each data bit in the data of the preset number system in a preset representation matrix; using a pre-trained encoding network to encode the representation matrix corresponding to the feature data to obtain a representation vector corresponding to the feature data; inputting the representation vector corresponding to the feature data into a detection model for abnormal content detection to obtain a detection result of abnormal content for the target user. BRIEF DESCRIPTION OF THE DRAWINGS
[0011] In order to more clearly illustrate one or more embodiments of this specification 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 recorded in one or more embodiments of this specification. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative work.
[0012] Figure 1 It is a flowchart of a method for detecting abnormal content provided by an embodiment of this specification; Figure 2 This is a schematic diagram of an application scenario of a method for detecting abnormal content provided by an embodiment of this specification; Figure 3 It is a structural schematic diagram of a device for detecting abnormal content provided by an embodiment of this specification; Figure 4 It is a structural diagram of an electronic device provided in an embodiment of this specification. DETAILED DESCRIPTION
[0013] The following will be combined with the drawings in the embodiments of this specification to clearly and completely describe the technical solutions in the embodiments of this specification. Obviously, the described embodiments are part of the embodiments of this specification, not all of the embodiments. Based on the embodiments in this specification, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of this document.
[0014] The terms "first", "second", etc. in the specification and claims of this document are used to distinguish similar objects, and are not used to describe a specific order or sequence. It should be understood that the data used in this way can be interchangeable where appropriate, so that the embodiments of this specification can be implemented in an order other than those illustrated or described herein, and the objects distinguished by "first", "second", etc. are generally of the same type, and the number of objects is not limited. For example, the first object can be one or more. In addition, "and / or" in the specification and claims means at least one of the connected objects, and the character " / " generally indicates that the objects associated with each other are in an "or" relationship.
[0015] The method, device and electronic device for detecting abnormal content provided by the embodiments of this specification are described in detail below with reference to the accompanying drawings through specific embodiments and their application scenarios.
[0016] Figure 1 A method for detecting abnormal content provided by an embodiment of the present invention is shown. The method can be executed by an electronic device, and the electronic device may include: a server and / or a terminal device, wherein the terminal device may be, for example, a vehicle-mounted terminal or a mobile phone terminal. In other words, the method can be executed by software or hardware installed in the aforementioned electronic device, and the method for detecting abnormal content includes the following steps: Step S102: Acquire characteristic data of a target user in a numerical type, and convert the characteristic data into data in a preset numerical system.
[0017] The target user is the user to be detected for abnormal content, and the corresponding feature data is the data collected according to the detection target. For example, when the detection target is abnormal transactions, the feature data can be the historical transaction data and / or current transaction data of the target user (such as a transaction user, etc.); when the detection target is abnormal grades, the feature data can be the data related to the grades of the target user (such as a student, etc.). The detection target is not specifically limited in this specification and can be determined according to actual conditions.
[0018] The preset number system is a preset method for representing numerical values, which may include data bit information (which may be 32 bits, 64 bits, etc.), data storage method (which may be integer, floating point type) and number system information (which may be binary, octal, decimal, etc.). The preset number system is not specifically limited in this specification and may be determined according to actual conditions. Binary is the basis for processing data inside a computer. In one example, float32 (32-bit floating point binary) or float64 (64-bit floating point binary) may be selected as the preset number system, and after acquiring the feature data, the feature data may be uniformly converted into data of the preset number system to realize the mining of information in the feature data. In order to better illustrate the embodiments in this specification and highlight the main purpose of this specification, the specific embodiments of this specification take float32 as the description object. Those skilled in the art should understand that this specification can also be implemented for other number systems.
[0019] Specifically, after obtaining the preset numerical values, the data storage methods of each preset numerical value can be unified according to the data storage method in the preset number system (usually converted from integer to floating point); and then the base information and data bit information in the preset number system can be unified.
[0020] Step S104: determining a representation matrix corresponding to the converted feature data based on a preset representation vector corresponding to a digital number of each data bit in the data of the preset number system in the preset representation matrix.
[0021] Among them, the preset characterization vector is the embedding vector that constitutes the preset characterization matrix (embedding matrix) determined according to the preset number system. The embedding matrix can be initialized with a standard normal distribution (that is, the mean is 0 and the standard deviation is 1). The number of preset characterization vectors that constitute the preset characterization matrix is the same as the sum of the number of digits contained in each data bit in the preset number system.
[0022] A digit is a different number symbol that represents the size of a basic value in a number system. For example, the decimal system has 10 digits: 0, 1, 2, 3, 4, 5, 6, 7, 8, 9; the binary system has 2 digits: 0 and 1. When the default number system is in float32 format, there are 32 data bits, and each data bit of digit 0 or digit 1 corresponds to an embedding vector (i.e., the default representation vector) in the initialized embedding matrix. Assuming that the dimension of the embedding vector is d1, the dimension of the embedding matrix corresponding to the default number system float32 is 64*d1.
[0023] The bucketing scheme can be to bucket each type of feature data separately. The numerical distribution of each feature is different and each feature must be bucketed separately. For example, each type of feature can be divided into 100 buckets, each bucket corresponds to a representation vector. If there are 100 types of features, there will be 10,000 representation vectors in the end. That is to say, when the dimension of each representation vector is d1, the dimension of the embedding matrix is 100*100*d1 (i.e. n*m*d1, n is the feature category, and m is the number of buckets for each type of feature). In this way, the dimension of the embedding matrix in the bucketing scheme will increase rapidly with the increase in the number of feature categories (usually in the thousands or tens of thousands) and / or the number of buckets for each feature.
[0024] In response to the above-mentioned bucketing scheme, this specification provides a different bucketing scheme. In this bucketing scheme, the dimension of the preset representation matrix corresponds to the preset number system and will not change with the change in the number of feature types. Moreover, since the dimension 64*d1 of the preset representation matrix is much smaller than the dimension n*m*d1 of the embedding matrix in the aforementioned bucketing scheme, the dimension of the preset representation matrix in this bucketing scheme is greatly reduced compared with the dimension of the embedding matrix in the aforementioned bucketing scheme and can express rich feature data.
[0025] After initializing the embedding matrix, the preset representation vector corresponding to the value of each data bit in the converted feature data can be determined from the embedding matrix, and then the preset representation vector corresponding to each data bit in the feature data can be concatenated to determine the representation matrix. For float32 feature data, there are 32 data bits. After finding the corresponding preset representation vector f1, f2, ..., f32 in the embedding matrix for the value corresponding to each data bit in the feature data, a 32 * d1 representation matrix R can be finally obtained.
[0026] Step S106: Use the pre-trained encoding network to encode the representation matrix corresponding to the feature data to obtain a representation vector corresponding to the feature data.
[0027] Among them, the encoding (encoder) network is a network that converts the representation matrix into a representation vector. The encoding network can be composed of a neural network, which can be a recurrent neural network (RNN), a convolutional neural network (CNN) and / or a neural network (transformer) based on a self-attention mechanism, etc. In order to realize the transformation of feature data from a matrix to a vector, the encoding network can include an L2 norm normalization layer at the end of the network structure.
[0028] After initializing the encoding network, you can use the data set consisting of the representation matrix for pre-training, and then input the representation matrix corresponding to the feature data into the pre-trained encoding network (at this time, the parameters are frozen), and you can get the representation vector corresponding to the feature data. For float32 feature data, the dimension of the representation matrix R is 32 * d1, and the pre-trained encoding network can output a representation vector r with a dimension of d2.
[0029] Step S108: inputting the representation vector corresponding to the feature data into a detection model for abnormal content detection to obtain a detection result of abnormal content for the target user.
[0030] The detection model is a model used to detect abnormal content in input data, and the detection model can be trained using training data collected according to the detection target. The representation vector corresponding to the feature data determined above is input into the trained detection model to obtain the detection result of abnormal content for the target user.
[0031] In the embodiment of the present specification, the preset characterization vector corresponding to the digital number of each data bit in the preset characterization matrix is used to determine the characterization matrix corresponding to the feature data converted into the preset number system, and the characterization matrix corresponding to the feature data is encoded using the encoding network to obtain the characterization vector used to determine the abnormal content detection result. This process realizes a new data bucketing scheme by sharing the same preset characterization matrix to determine the characterization matrix corresponding to each feature data. Since the preset characterization matrix corresponds to the preset number system, the dimension of the preset characterization matrix is fixed and small, which can improve the speed of using the preset characterization matrix to determine the detection result for abnormal content, thereby improving the user experience.
[0032] Figure 2 A schematic diagram of an application scenario of an abnormal content detection method is provided, such as Figure 2 As shown, the user sends a service request to the server through a terminal such as a mobile phone, and the service request includes: performing a target task of abnormal content detection for the target user based on the characteristic data of the target user provided by the user. After receiving the service request, the server uses the abnormal content detection method in this specification to obtain the detection result of the abnormal content for the target user, and sends the abnormal content detection result to the terminal for the user's reference.
[0033] In one implementation, step S104 may be performed as the following steps A1-A3: Step A1, determining the target digital number corresponding to the value of each data bit in the converted characteristic data from the digital numbers of each data bit in the data of the preset digital system; Step A2, determining a preset representation vector corresponding to the target digital number from the preset representation matrix; Step A3, performing a concatenation operation on the preset representation vectors of the target digital code corresponding to each data bit in the feature data to obtain a representation matrix of the feature data.
[0034] The target digital number is the digital number corresponding to the value on the data bit in the feature data. Specifically, the process of determining the representation matrix corresponding to the feature data according to the preset representation matrix can be: first determine the data bit corresponding to each data bit in the converted feature data in the preset number system; determine the target digital number corresponding to the value in the data bit in the feature data from the digital number of the corresponding data bit; determine the preset representation vector corresponding to the target digital number from the preset representation matrix; and perform a splicing operation on the preset representation vectors corresponding to each data bit in the feature data to obtain the representation matrix corresponding to the feature data.
[0035] Binary is the basis for processing data inside a computer. In one example, the default number system is binary. Step A1 can be executed as follows: Steps B1-B2: Step B1, when the value corresponding to the target data bit in the converted characteristic data is 0, the digital number 0 corresponding to the target data bit in the preset number system is used as the target digital number of the target data bit; Step B2, when the value corresponding to the target data bit in the converted characteristic data is 1, the digital number 1 corresponding to the target data bit in the preset number system is used as the target digital number of the target data bit.
[0036] The target data bit is one of the data bits in the converted characteristic data. When the preset number system is binary, the digital number includes 0 and 1. Therefore, for the same data bit (i.e., the target data bit) of the converted characteristic data and the preset value, when the value of the converted characteristic data and the digital number of the preset value are the same (both 0 or 1), the digital number of the preset value can be used as the target digital number of the converted data. For example, for the target data and the target data bit of the preset value after the conversion, when the value of the target data is 0, the digital number 0 of the preset value can be used as the target digital number of the target data bit; when the value of the target data is 1, the digital number 1 of the preset value can be used as the target digital number of the target data bit.
[0037] Similar to the process of constructing the representation matrix corresponding to the converted feature data, the process of determining the preset representation matrix corresponding to the preset number system can be performed as follows: steps C1-C2: Step C1, obtaining the digits of each data bit in the data in the preset number system, and determining the preset representation vector corresponding to the digit according to the digit and the data bit corresponding to the digit; Step C2, concatenating the preset representation vectors corresponding to the respective digits in the preset number system to obtain a preset representation matrix corresponding to the preset numerical value.
[0038] Specifically, for the digits of each data bit in the data of the preset number system, the preset characterization vector of each digit in the data bit can be determined according to the digits and the data bits corresponding to the digits, and then the preset characterization vectors corresponding to different digits in each data bit in the preset value can be spliced to obtain a preset characterization matrix. As mentioned above, the dimension of the preset characterization matrix corresponding to the preset number system float32 is 64*d1. Among them, the preset characterization vector can be initialized by a standard normalized distribution (mean is 0, standard deviation is 1).
[0039] In the above process, since the dimension of the preset characterization matrix is fixed and small, the process of determining the characterization matrix corresponding to the converted feature data based on the corresponding preset characterization vector in the preset characterization matrix can greatly reduce the determination time of the characterization matrix of the feature data, thereby improving the speed of determining the detection results for abnormal content using the preset characterization matrix.
[0040] In one implementation, the pre-training process of the encoding network can be performed as follows: Step D1, obtaining randomly generated sample data contained in the data set, and converting the sample data into data of a preset number system; Step D2, determining a representation matrix corresponding to the converted sample data based on a preset representation vector corresponding to a digital number of each data bit in the data of the preset number system in the preset representation matrix; Step D3, using a coding network to encode the representation matrix corresponding to the sample data to obtain a representation vector corresponding to the sample data; Step D4, sequentially and randomly extracting two sample data from the data set each time to construct a plurality of bigrams, and constructing a first loss according to the similarity between the representation vectors corresponding to the two sample data in the bigram; Step D5, pre-training the encoding network according to the first loss to obtain a pre-trained encoding network.
[0041] The data set is used to pre-train the encoding network, and each data contained in the data set is sample data, and the sample data in the data set can be randomly generated data. After obtaining the data set, each sample data in the data set can be converted into data of a preset number system (such as float32).
[0042] Similar to the determination process of the aforementioned representation matrix, the preset representation vector corresponding to the value of each data bit in the converted sample feature data can be determined from the embedding matrix, and then the preset representation vectors corresponding to each data bit in the sample feature data can be concatenated to determine the sample representation matrix. For float32 sample feature data, a 32 * d1 representation matrix R can be obtained.
[0043] After initializing the encoding network, the encoding network can be used to determine the representation vector corresponding to the sample data. For float32 sample feature data, the dimension of the sample representation matrix R is 32 * d1, and the dimension of the representation vector r corresponding to the sample data output by the encoding network is d2.
[0044] After determining the characterization vector corresponding to the sample data, the first loss can be determined based on the similarity between the dimensions of the characterization vectors corresponding to the various sample data in the data set, and then the encoding network can be pre-trained according to the first loss. In one example, the first loss can be constructed using contrastive learning. Specifically, for the target sample data as any sample data in the data set, the positive and negative examples of the target sample data can be determined based on the absolute value of the difference between other sample data and the target sample data. The positive example is the sample data with a smaller absolute value of the difference between the target sample data, and the negative example is the sample data with a larger absolute value of the difference between the target sample data. The first loss can be constructed based on the characterization vectors of the positive and negative examples, and then the encoding network can be trained according to the first loss.
[0045] In addition to the above-mentioned comparative learning method, step D5 can be executed as the following steps E1-E2: Step E1, constructing a second loss according to the difference between two sample data in the binary group; Step E2: pre-training the encoding network according to the first loss and the second loss to obtain a pre-trained encoding network.
[0046] In addition to constructing the first loss based on the similarity between the representation vectors corresponding to the two sample data in the binary, the similarity and difference can be combined to pre-train the encoding network. Specifically, two sample data num1 and num2 in the data set can be randomly extracted to construct a binary (num1, num2), and the second loss can be constructed based on the difference between the two sample data in the binary. Then, the encoding network can be trained based on the first loss and the second loss.
[0047] Specifically, after encoding the binary group (num1, num2), two representation matrices R1 and R2 can be obtained, and then these two representation matrices are input into the encoding network to obtain two representation vectors r1 and r2. Then, according to the similarity between the representation vectors r1 and r2, the first loss can be constructed, and according to the difference between num1 and num2, the second loss can be constructed.
[0048] In this way, the loss for training the encoding network includes, in addition to the first loss, a second loss that expresses the difference between the sample data, so that the representation vector corresponding to the feature data output by the encoding network trained according to the first loss and the second loss can express the gap between the original feature data to a certain extent, and then the detection model can more easily learn the information in the representation vector corresponding to the feature data, thereby increasing the probability of detecting abnormal content of the target user and improving the accuracy of abnormal content detection.
[0049] Since the range of similarity and difference is (-1, 1), the first loss can be determined by taking the absolute value of the similarity, and the second loss can be determined by taking the absolute value of the difference. In addition, step E2 can be executed as the following steps F1-F3: Step F1, mapping the first loss into a target value range to obtain a mapped first loss, and mapping the second loss into a target value range to obtain a mapped second loss; Step F2, determining a distance loss representing the distance between two sample data in a binary group according to the extreme value point of the target value range and the mapped first loss; Step F3, pre-training the encoding network according to the distance loss and the mapped second loss to obtain a pre-trained encoding network.
[0050] Since the values of similarity and difference can be positive or negative, the first loss and the second loss can be positive or negative. For the convenience of calculation, the target value range can be (0,1). Specifically, the first loss and the second loss can be mapped to the target value range by taking the absolute value or squaring, retaining the values of similarity and difference, and discarding the direction.
[0051] When the target value range can be (0, 1), the preset extreme point can be 1. At this time, according to the difference between the preset extreme point of the target value range and the mapped first loss, the distance loss representing the distance between the representation vectors corresponding to the two sample data in the binary group can be obtained.
[0052] Since the difference between two sample data in a binary group represents the distance between the two sample data in the binary group, the difference between the two sample data can be determined according to the difference between the two sample data in the binary group, and the difference can be mapped to the target value range to obtain the mapped second loss, and then the difference between the mapped second loss and the distance loss is used as the total loss of the encoding network, so as to train the encoding network according to the total loss. Specifically, the training goal of the training process can be to make the difference between the mapped second loss and the distance loss close to 0.
[0053] In one implementation, step E1 may be performed as the following steps G1-G2: Step G1, using a preset activation function to perform an activation operation on the difference between two sample data in the binary group to obtain the activation difference between the two sample data in the binary group; Step G2, construct the second loss based on the activation difference between the two sample data in the bigram.
[0054] The distance loss represents the loss of the distance between two sample data in a binary, while the second loss represents the difference between two sample data in a binary. Therefore, the association between the distance loss and the second loss can be established, and the total loss of the encoding network can be constructed through the difference between the two. In the process of constructing the second loss based on the difference between two sample data in a binary, since the value range of the distance loss constructed based on the similarity between the representation vectors corresponding to the two sample data in the binary is (0,1), in order to establish the association between the distance loss and the second loss, an activation function (such as tanh) can be used to activate the difference between the two sample data in the binary to obtain the activation difference.
[0055] When the activation function is tanh, the range of the activation difference determined by the activation function tanh is (-1, 1). The activation difference is used as the second loss and is mapped to the target range by squaring or taking the absolute value to obtain the mapped second loss. The mapped second loss has the same range as the distance loss, both of which are (0, 1). At this point, the association between the target loss and the second loss is established. The total loss of the encoding network can be constructed based on the distance loss and the mapped second loss, and the encoding network can be trained based on the total loss.
[0056] Formula 1 shows the process of determining the total loss of the encoding network: loss = ((1-dot(r1,r2) 2 )-tanh(num1-num2) 2 ) 2 (Formula 1) Among them, loss is the total loss of the encoding network, num1 and num2 are the values of the two sample data in each binary group, r1 and r2 are the representation vectors corresponding to the two sample data in the binary group, and dot(r1, r2) 2 is the first loss, (1-dot(r1, r2) 2 ) is the distance loss, tanh(num1-num2) 2 The second loss.
[0057] It can be understood that the above-mentioned various method embodiments mentioned in this specification can be combined with each other to form a combined embodiment without violating the principle logic. Due to space limitations, they will not be repeated in this specification. Those skilled in the art can understand that in the above-mentioned method of the specific implementation method, the specific execution order of each step should be determined according to its function and possible internal logic.
[0058] It should be noted that the method for abnormal content detection provided in the embodiments of this specification may be performed by a device for abnormal content detection, or a control module in the device for abnormal content detection for performing the method for abnormal content detection. In the embodiments of this specification, the method for abnormal content detection performed by a device for abnormal content detection is taken as an example to illustrate the device for abnormal content detection provided in the embodiments of this specification.
[0059] Figure 3 is a schematic diagram of the structure of an apparatus for detecting abnormal content according to an embodiment of the present invention. Figure 3 As shown, the device 300 for detecting abnormal content includes: A number system conversion module 310 is used to obtain characteristic data of a target user in a numerical type and convert the characteristic data into data of a preset number system; A characterization matrix module 320, for determining a characterization matrix corresponding to the converted feature data based on a preset characterization vector corresponding to a digital number of each data bit in the data of the preset number system in the preset characterization matrix; A representation vector module 330 is used to encode the representation matrix corresponding to the feature data using a pre-trained encoding network to obtain a representation vector corresponding to the feature data; The detection result module 340 is used to input the representation vector corresponding to the feature data into a detection model for abnormal content detection to obtain a detection result of abnormal content for the target user.
[0060] In one embodiment, the characterization matrix module 320 includes: The target digital unit is used to determine the target digital corresponding to the value of each data bit in the converted characteristic data from the digital of each data bit in the data of the preset digital system; A representation vector unit, used to determine a preset representation vector corresponding to a target digital number from a preset representation matrix; The characterization matrix unit is used to perform a splicing operation on the preset characterization vectors of the target digital number corresponding to each data bit in the characteristic data to obtain a characterization matrix of the characteristic data.
[0061] In one embodiment, the default number system is binary, and the target digital unit is used for: When the value corresponding to the target data bit in the converted characteristic data is 0, the digital number 0 corresponding to the target data bit in the preset number system is used as the target digital number of the target data bit; When the value corresponding to the target data bit in the converted characteristic data is 1, the digital number 1 corresponding to the target data bit in the preset number system is used as the target digital number of the target data bit.
[0062] In one embodiment, the process of determining the preset representation matrix corresponding to the preset number system includes: Obtaining the digital number of each data bit in the data of the preset number system, and determining the preset representation vector corresponding to the digital number according to the digital number and the data bit corresponding to the digital number; The preset representation vectors corresponding to the respective digits in the preset number system are concatenated to obtain a preset representation matrix corresponding to the preset number system.
[0063] In one embodiment, the pre-training process of the encoding network includes: Obtain randomly generated sample data contained in the data set, and convert the sample data into data in a preset number system; Determine the representation matrix corresponding to the converted sample data based on the preset representation vector corresponding to the digital number of each data bit in the data of the preset number system in the preset representation matrix; Use the encoding network to encode the representation matrix corresponding to the sample data to obtain the representation vector corresponding to the sample data; Sequentially and randomly extracting two sample data from the data set each time to construct multiple bigrams, and constructing a first loss according to the similarity between the representation vectors corresponding to the two sample data in the bigram; According to the first loss, the encoding network is pre-trained to obtain a pre-trained encoding network.
[0064] In one embodiment, the encoding network is pre-trained according to the first loss to obtain the pre-trained encoding network, including: Construct the second loss based on the difference between the two sample data in the binary group; The encoding network is pre-trained according to the first loss and the second loss to obtain a pre-trained encoding network.
[0065] In one embodiment, the encoding network is pre-trained according to the first loss and the second loss to obtain the pre-trained encoding network, including: Mapping the first loss into the target value range to obtain the mapped first loss, and mapping the second loss into the target value range to obtain the mapped second loss; Determine the distance loss representing the distance between the representation vectors corresponding to the two sample data in the binary group according to the extreme value point of the target value range and the first loss after mapping; The encoding network is pre-trained according to the distance loss and the second loss after mapping to obtain a pre-trained encoding network.
[0066] In one embodiment, a second loss is constructed according to the difference between two sample data in a binary group, including: Using a preset activation function to perform an activation operation on the difference between two sample data in the binary group, to obtain the activation difference between the two sample data in the binary group; The second loss is constructed based on the activation difference between the two sample data in the bigram.
[0067] It should be noted that the embodiment of the device for abnormal content detection in this specification and the embodiment of the method for abnormal content detection in this specification are based on the same inventive concept, so the specific implementation of this embodiment can refer to the implementation of the corresponding method for abnormal content detection mentioned above, and the repeated parts will not be repeated.
[0068] Each module in the above-mentioned abnormal content detection device can be implemented in whole or in part by software, hardware and a combination thereof. Each of the above-mentioned modules can be embedded in or independent of the processor in the terminal device or the processor on the server side in the form of hardware, or can be stored in the memory in the terminal device or the memory on the server side in the form of software, so that the processor can call and execute the corresponding operations of each of the above modules.
[0069] Further, corresponding to the above-described abnormal content detection method, based on the same technical concept, one or more embodiments of this specification also provide an electronic device, which is used to execute the above-described abnormal content detection method. Figure 4 A schematic diagram of the structure of an electronic device provided for one or more embodiments of this specification.
[0070] Based on the same idea, one or more embodiments of this specification also provide an electronic device, such as Figure 4As shown. The electronic device may have relatively large differences due to different configurations or performances, and may include one or more processors 401 and memory 402, and the memory 402 may store one or more storage applications or data. Among them, the memory 402 may be a temporary storage or a permanent storage. The application stored in the memory 402 may include one or more modules (not shown in the figure), and each module may include a series of computer executable instructions in the electronic device. Furthermore, the processor 401 can be configured to communicate with the memory 402 to execute a series of computer executable instructions in the memory 402 on the electronic device. The electronic device may also include one or more power supplies 403, one or more wired or wireless network interfaces 404, one or more input and output interfaces 405, and one or more keyboards 406.
[0071] In a specific embodiment, the electronic device includes a memory and one or more programs, wherein the one or more programs are stored in the memory, and the one or more programs may include one or more modules, and each module may include a series of computer executable instructions for the electronic device, and the one or more programs configured to be executed by one or more processors include the following computer executable instructions: Acquire the target user's numerical feature data and convert the feature data into data in a preset number system; Determine the representation matrix corresponding to the converted feature data based on the preset representation vector corresponding to the digital number of each data bit in the data of the preset number system in the preset representation matrix; Use the pre-trained encoding network to encode the representation matrix corresponding to the feature data to obtain the representation vector corresponding to the feature data; The representation vector corresponding to the feature data is input into a detection model for abnormal content detection to obtain a detection result of abnormal content for the target user.
[0072] It should be noted that the embodiment of the electronic device in this specification and the embodiment of the method for detecting abnormal content in this specification are based on the same inventive concept, so the specific implementation of this embodiment can refer to the implementation of the corresponding method for detecting abnormal content, and the repeated parts will not be repeated.
[0073] Furthermore, corresponding to the method for detecting abnormal content described above, based on the same technical concept, one or more embodiments of this specification further provide a storage medium for storing computer executable instructions. In a specific embodiment, the storage medium may be a USB flash drive, an optical disk, a hard disk, etc. When the computer executable instructions stored in the storage medium are executed by the processor, the following process can be implemented: Acquire the target user's numerical feature data and convert the feature data into data in a preset number system; Determine the representation matrix corresponding to the converted feature data based on the preset representation vector corresponding to the digital number of each data bit in the data of the preset number system in the preset representation matrix; Use the pre-trained encoding network to encode the representation matrix corresponding to the feature data to obtain the representation vector corresponding to the feature data; The representation vector corresponding to the feature data is input into a detection model for abnormal content detection to obtain a detection result of abnormal content for the target user.
[0074] It should be noted that the embodiment of the storage medium in this specification and the method for detecting abnormal content in this specification are based on the same inventive concept, so the specific implementation of this embodiment can refer to the implementation of the corresponding method for detecting abnormal content, and the repeated parts will not be repeated.
[0075] Furthermore, corresponding to the method for detecting abnormal content described above, based on the same technical concept, one or more embodiments of this specification further provide a computer program product, the computer program product including a computer program, which can implement the following process when executed by a processor: Acquire the target user's numerical feature data and convert the feature data into data in a preset number system; Determine the representation matrix corresponding to the converted feature data based on the preset representation vector corresponding to the digital number of each data bit in the data of the preset number system in the preset representation matrix; Use the pre-trained encoding network to encode the representation matrix corresponding to the feature data to obtain the representation vector corresponding to the feature data; The representation vector corresponding to the feature data is input into a detection model for abnormal content detection to obtain a detection result of abnormal content for the target user.
[0076] It should be noted that the embodiment of the computer program product in this specification and the embodiment of the method for detecting abnormal content in this specification are based on the same inventive concept, so the specific implementation of this embodiment can refer to the implementation of the corresponding method for detecting abnormal content, and the repeated parts will not be repeated.
[0077] The above is a description of a specific embodiment of the specification. Other embodiments are within the scope of the appended claims. In some cases, the actions or steps recorded in the claims can be performed in an order different from that in the embodiments and still achieve the desired results. In addition, the processes depicted in the drawings do not necessarily require the specific order or continuous order shown to achieve the desired results. In some embodiments, multitasking and parallel processing are also possible or may be advantageous.
[0078] In the 1990s, it was very clear whether the improvement of a technology was hardware improvement (for example, improvement of the circuit structure of diodes, transistors, switches, etc.) or software improvement (improvement of the method flow). However, with the development of technology, many improvements of the method flow today can be regarded as direct improvements of the hardware circuit structure. Designers almost always obtain the corresponding hardware circuit structure by programming the improved method flow into the hardware circuit. Therefore, it cannot be said that the improvement of a method flow cannot be implemented with a hardware entity module. For example, a programmable logic device (PLD) (such as a field programmable gate array (FPGA)) is such an integrated circuit whose logical function is determined by the user's programming of the device. Designers can "integrate" a digital system on a PLD by programming themselves, without having to ask chip manufacturers to design and make dedicated integrated circuit chips. Moreover, nowadays, instead of manually making integrated circuit chips, this kind of programming is mostly implemented by "logic compiler" software, which is similar to the software compiler used when developing and writing programs, and the original code before compilation must also be written in a specific programming language, which is called hardware description language (HDL). There is not only one kind of HDL, but many kinds, such as ABEL (Advanced Boolean Expression Language), AHDL (Altera Hardware Description Language), Confluence, CUPL (Cornell University Programming Language), HDCal, JHDL (Java Hardware Description Language), Lava, Lola, MyHDL, PALASM, RHDL (Ruby Hardware Description Language), etc. The most commonly used ones are VHDL (Very-High-Speed Integrated Circuit Hardware Description Language) and Verilog. Those skilled in the art should also know that it is only necessary to program the method flow slightly in the above-mentioned hardware description languages and program it into the integrated circuit, and then it is easy to obtain the hardware circuit that implements the logic method flow.
[0079] The controller may be implemented in any suitable manner, for example, the controller may take the form of a microprocessor or processor and a computer-readable medium storing a computer-readable program code (e.g., software or firmware) executable by the (micro)processor, a logic gate, a switch, an application-specific integrated circuit (ASIC), a programmable logic controller, and an embedded microcontroller, examples of which include but are not limited to the following microcontrollers: ARC 625D, Atmel AT91SAM, Microchip PIC18F26K20, and Silicone Labs C8051F320, and the memory controller may also be implemented as part of the control logic of the memory. It is also known to those skilled in the art that, in addition to implementing the controller in a purely computer-readable program code manner, the controller may be implemented in the form of a logic gate, a switch, an application-specific integrated circuit, a programmable logic controller, and an embedded microcontroller by logically programming the method steps. Therefore, such a controller may be considered as a hardware component, and the devices for implementing various functions included therein may also be considered as structures within the hardware component. Or even, the devices for implementing various functions may be considered as both software modules for implementing the method and structures within the hardware component.
[0080] The systems, devices, modules or units described in the above embodiments may be implemented by computer chips or entities, or by products with certain functions. A typical implementation device is a computer. Specifically, the computer may be, for example, a personal computer, a laptop computer, a cellular phone, a camera phone, a smart phone, a personal digital assistant, a media player, a navigation device, an email device, a game console, a tablet computer, a wearable device, or a combination of any of these devices.
[0081] For the convenience of description, the above devices are described in terms of functions and are divided into various units. Of course, when implementing the embodiments of this specification, the functions of each unit can be implemented in the same or multiple software and / or hardware.
[0082] It should be understood by those skilled in the art that one or more embodiments of the present specification may be provided as a method, system or computer program product. Therefore, one or more embodiments of the present specification may take the form of a complete hardware embodiment, a complete software embodiment, or an embodiment combining software and hardware. Moreover, the present specification may take the form of a computer program product implemented on one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) containing computer-usable program code.
[0083] This specification is described with reference to the flowcharts and / or block diagrams of the methods, devices (systems), and computer program products according to the embodiments of this specification. It should be understood that each process and / or block in the flowchart and / or block diagram, as well as the combination of processes and / or blocks in the flowchart and / or block diagram, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, a special-purpose computer, an embedded processor, or other programmable data processing device to produce a machine, so that the instructions executed by the processor of the computer or other programmable data processing device generate instructions for implementing the processes in the flowchart and / or block diagram. Figure 1 A process or multiple processes and / or boxes Figure 1 A device that provides the functions specified in a block or multiple blocks.
[0084] These computer program instructions may also be stored in a computer-readable memory capable of directing a computer or other programmable data processing device to operate in a specific manner, so that the instructions stored in the computer-readable memory produce an article of manufacture comprising an instruction device, which implements the process Figure 1 A process or multiple processes and / or boxes Figure 1 A function specified in one or more boxes.
[0085] These computer program instructions can also be loaded onto a computer or other programmable data processing device so that a series of operating steps are executed on the computer or other programmable device to produce a computer-implemented process, thereby providing instructions for implementing the process. Figure 1 A process or multiple processes and / or boxes Figure 1 A step that specifies a function in one or more boxes.
[0086] In a typical configuration, a computing device includes one or more processors (CPU), input / output interfaces, network interfaces, and memory.
[0087] Memory may include non-permanent storage in a computer-readable medium, random access memory (RAM) and / or non-volatile memory in the form of read-only memory (ROM) or flash RAM. Memory is an example of a computer-readable medium.
[0088] Computer readable media include permanent and non-permanent, removable and non-removable media that can be implemented by any method or technology to store information. Information can be computer readable instructions, data structures, program modules or other data. Examples of computer storage media include, but are not limited to, phase change memory (PRAM), static random access memory (SRAM), dynamic random access memory (DRAM), other types of random access memory (RAM), read-only memory (ROM), electrically erasable programmable read-only memory (EEPROM), flash memory or other memory technology, compact disk read-only memory (CD-ROM), digital versatile disk (DVD) or other optical storage, magnetic cassettes, magnetic disk storage or other magnetic storage devices or any other non-transmission media that can be used to store information that can be accessed by a computing device. As defined in this article, computer readable media does not include temporary computer readable media (transitory media), such as modulated data signals and carrier waves.
[0089] It should also be noted that the terms "include", "comprises" or any other variations thereof are intended to cover non-exclusive inclusion, so that a process, method, commodity or device including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, commodity or device. In the absence of more restrictions, the elements defined by the sentence "comprises a ..." do not exclude the existence of other identical elements in the process, method, commodity or device including the elements.
[0090] One or more embodiments of the present specification may be described in the general context of computer-executable instructions executed by a computer, such as program modules. Generally, program modules include routines, programs, objects, components, data structures, etc. that perform specific tasks or implement specific abstract data types. One or more embodiments of the present specification may also be practiced in distributed computing environments where tasks are performed by remote processing devices connected through a communication network. In a distributed computing environment, program modules may be located in local and remote computer storage media, including storage devices.
[0091] Each embodiment in this specification is described in a progressive manner, and the same or similar parts between the embodiments can be referred to each other, and each embodiment focuses on the differences from other embodiments. In particular, for the system embodiment, since it is basically similar to the method embodiment, the description is relatively simple, and the relevant parts can be referred to the partial description of the method embodiment.
[0092] The above description is only an embodiment of this document and is not intended to limit this document. For those skilled in the art, this document may have various changes and variations. Any modification, equivalent replacement, improvement, etc. made within the spirit and principle of this document should be included in the scope of the claims of this document.
Claims
1. A method for detecting abnormal content, comprising: Acquire characteristic data of a target user in a numerical type, and convert the characteristic data into data in a preset numerical system; Determine the representation matrix corresponding to the converted feature data based on the preset representation vector corresponding to the digital number of each data bit in the data of the preset number system in the preset representation matrix; Using a pre-trained encoding network to encode the representation matrix corresponding to the feature data, to obtain a representation vector corresponding to the feature data; The representation vector corresponding to the feature data is input into a detection model for abnormal content detection to obtain a detection result of abnormal content for the target user.
2. The method according to claim 1, wherein the determining the representation matrix corresponding to the converted feature data based on the preset representation vector corresponding to the digital number of each data bit in the data of the preset number system in the preset representation matrix comprises: Determine the target digital number corresponding to the value of each data bit in the converted characteristic data from the digital number of each data bit in the data of the preset digital system; Determining a preset characterization vector corresponding to the target digital number from the preset characterization matrix; The preset characterization vectors of the target digital number corresponding to each data bit in the characteristic data are concatenated to obtain a characterization matrix of the characteristic data.
3. The method according to claim 2, wherein the preset number system is binary, and the step of determining the target number corresponding to the value of each data bit in the converted feature data from the number of each data bit in the data of the preset number system comprises: When the value corresponding to the target data bit in the converted characteristic data is 0, the digital number 0 corresponding to the target data bit in the preset number system is used as the target digital number of the target data bit; When the value corresponding to the target data bit in the converted characteristic data is 1, the digital number 1 corresponding to the target data bit in the preset number system is used as the target digital number of the target data bit.
4. The method according to claim 3, wherein the process of determining the preset representation matrix corresponding to the preset number system comprises: Obtaining the digital number of each data bit in the data of the preset number system, and determining the preset representation vector corresponding to the digital number according to the digital number and the data bit corresponding to the digital number; The preset representation vectors corresponding to the respective digits in the preset number system are concatenated to obtain a preset representation matrix corresponding to the preset number system.
5. According to the method of claim 1, the pre-training process of the encoding network comprises: Obtain randomly generated sample data contained in the data set, and convert the sample data into data in a preset number system; Determine the representation matrix corresponding to the converted sample data based on the preset representation vector corresponding to the digital number of each data bit in the data of the preset number system in the preset representation matrix; Using the encoding network to encode the representation matrix corresponding to the sample data, to obtain the representation vector corresponding to the sample data; Sequentially and randomly extracting two sample data from the data set each time to construct a plurality of bigrams, and constructing a first loss according to the similarity between the representation vectors corresponding to the two sample data in the bigram; The encoding network is pre-trained according to the first loss to obtain the pre-trained encoding network.
6. The method according to claim 5, wherein the pre-training the encoding network according to the first loss to obtain the pre-trained encoding network comprises: Constructing a second loss according to the difference between two sample data in the binary group; The encoding network is pre-trained according to the first loss and the second loss to obtain the pre-trained encoding network.
7. The method according to claim 6, wherein the pre-training the encoding network according to the first loss and the second loss to obtain the pre-trained encoding network comprises: Mapping the first loss into a target value range to obtain a mapped first loss, and mapping the second loss into the target value range to obtain a mapped second loss; Determine, according to the extreme value point of the target value range and the mapped first loss, a distance loss representing the distance between the characterization vectors corresponding to the two sample data in the binary group; The encoding network is pre-trained according to the distance loss and the mapped second loss to obtain the pre-trained encoding network.
8. The method according to claim 6, wherein constructing the second loss according to the difference between the two sample data in the binary group comprises: Using a preset activation function to perform an activation operation on the difference between the two sample data in the binary group to obtain an activation difference between the two sample data in the binary group; The second loss is constructed according to the activation difference between two sample data in the bigram.
9. A device for detecting abnormal content, comprising: A number system conversion module, used to obtain characteristic data of a target user in a numerical type and convert the characteristic data into data of a preset number system; A characterization matrix module, used to determine a characterization matrix corresponding to the converted feature data based on a preset characterization vector corresponding to a digital number of each data bit in the data of the preset number system in the preset characterization matrix; A representation vector module, used to encode the representation matrix corresponding to the feature data using a pre-trained encoding network to obtain a representation vector corresponding to the feature data; The detection result module is used to input the representation vector corresponding to the feature data into a detection model for abnormal content detection to obtain a detection result of abnormal content for the target user.
10. An electronic device, comprising: processor, and a memory arranged to store computer executable instructions which, when executed, cause the processor to: Acquire characteristic data of a target user in a numerical type, and convert the characteristic data into data in a preset numerical system; Determine the representation matrix corresponding to the converted feature data based on the preset representation vector corresponding to the digital number of each data bit in the data of the preset number system in the preset representation matrix; Using a pre-trained encoding network to encode the representation matrix corresponding to the feature data, to obtain a representation vector corresponding to the feature data; The representation vector corresponding to the feature data is input into a detection model for abnormal content detection to obtain a detection result of abnormal content for the target user.
Citation Information
Patent Citations
Network traffic classification method based on self-attention mechanism, medium and terminal equipment
CN111355671A
Network training method, risk user identification method, device, equipment and medium
CN112967134A
Data processing method and device, equipment, storage medium and computer program product
CN116932657A
Click rate prediction method of decoupling attention network based on information sharing
CN116976505A
Feature perception pre-training method and system for time sequence anomaly detection
CN118708932A