A cigarette correlation analysis method and system based on graph neural network
By constructing a knowledge graph and a graph neural network for semi-supervised learning, the complex problem of calculating the similarity of new cigarettes was solved, fast and efficient similarity analysis was achieved, the market sales of new cigarettes were predicted, and risks were reduced.
Patent Information
- Application Number
- CN202310343583.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2023-03-28
- Publication Date
- 2025-09-26
- Estimated Expiration
- 2043-03-28
AI Technical Summary
In the existing technology, the similarity calculation of new cigarettes is complex, making it difficult to quickly and effectively determine their market conditions and sales risks.
A graph neural network-based method is used to construct a knowledge graph, and the graph neural network is trained using semi-supervised learning to obtain a similarity classification model between cigarettes. By obtaining the adjacency matrix, label matrix and feature matrix for training, the similarity calculation between new cigarettes and other cigarettes is realized.
Quickly and efficiently obtain the similarity between new cigarettes and cigarettes of different specifications to help predict market sales trends and avoid risks.
Smart Images

Figure CN116383672B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of cigarette analysis, and in particular to a cigarette correlation analysis method and system based on graph neural network. Background Art
[0002] Based on high-quality tobacco leaves and other raw materials, companies need to devote significant manpower to continuous market research to grasp market demand and guide the development and production of new cigarettes. Consequently, the cost of launching new cigarettes is high. Sales of new cigarettes are influenced by numerous factors and are uncertain, making the launch of new cigarettes both costly and risky. Therefore, technology is needed to predict and mitigate these risks. However, current research on cigarettes focuses primarily on analyzing and predicting factors influencing sales. However, there is limited research on how to understand the market trends of new cigarettes and provide a reference for large-scale production.
[0003] In recent years, driven by deep learning technology, artificial intelligence has rapidly developed, achieving significant results and widespread application. However, in real-world scenarios, a large amount of data is in non-Euclidean space, significantly limiting the application of deep neural networks. Graph neural networks, as an emerging intelligent algorithm, combine deep learning and graph computing algorithms, leveraging their strengths to overcome their weaknesses. They can handle complex graph data with irregular non-Euclidean structures. Graph neural network algorithms are used in some aspects of cigarette data analysis. However, due to the wide variety of cigarette sizes and the complexity of similarity calculation, determining similarity between cigarettes of different sizes is difficult using conventional supervised learning methods, which is complex and cumbersome. Summary of the Invention
[0004] The purpose of the present invention is to provide a cigarette correlation analysis method and system based on graph neural network to solve the problem of complex similarity calculation of new cigarettes in the prior art.
[0005] To achieve the above object, the present invention is implemented by adopting the following technical solutions:
[0006] A cigarette correlation analysis method based on graph neural network, comprising:
[0007] Obtain cigarette data;
[0008] Build a knowledge graph based on cigarette data; the main node of the knowledge graph is the cigarette brand, the child nodes are the cigarette specifications, and the tail node is the cigarette profile information and attribute characteristics;
[0009] Obtain the adjacency matrix, label matrix and corresponding feature matrix based on the knowledge graph;
[0010] Using a semi-supervised learning approach, the adjacency matrix, label matrix, and corresponding feature matrix are input into the graph neural network for training to obtain a similarity classification model.
[0011] The new cigarette data is input into the similarity classification model to obtain the similarity between the new cigarette and other cigarettes.
[0012] Furthermore, obtaining the adjacency matrix, label matrix and corresponding feature matrix according to the knowledge graph includes:
[0013] Based on existing experience, several groups of cigarettes of different specifications with different similarities are selected, and the cosine similarity is calculated using the characteristic attributes of the cigarettes;
[0014] Based on the edge relationship between child nodes in the knowledge graph and the cosine similarity classification, the adjacency matrix and label matrix are created, and the feature matrix is obtained based on the tail node corresponding to the child node.
[0015] Furthermore, the expression of the cosine similarity is:
[0016]
[0017] in, and The n-dimensional vectors represent the characteristic attributes of the two cigarettes respectively; when the cosine similarity is 0-0.5, it is dissimilar; when the cosine similarity is 0.5-0.7, it is relatively similar; when the cosine similarity is 0.7-0.9, it is similar; and when the cosine similarity is 0.9-1.0, it is extremely similar.
[0018] Furthermore, the obtaining of the similarity classification model comprises the following steps:
[0019] The adjacency matrix, label matrix, and feature matrix are input into the graph neural network as the initial training set for iterative training until the loss function converges, and the link classifier and prediction output matrix of the graph neural network are obtained;
[0020] The softmax function is used to obtain the confidence of the link classifier for the similar category to which each edge belongs. The classification result with the highest confidence is selected and added to the label matrix to obtain a new label matrix.
[0021] Continue to iteratively train the link classifier of the graph neural network according to the new label matrix until the label matrix is filled and the final similarity classification model is obtained.
[0022] Furthermore, the expression of the softmax function is:
[0023]
[0024] Among them, z i is the output value of the i-th node, and C is the number of classification categories.
[0025] Furthermore, the loss function is expressed as:
[0026]
[0027] Among them, y i and f(x i ) represent the true value and predicted value of the i-th sample, and m is the number of samples.
[0028] Furthermore, the graph neural network is a structural graph neural network using a double-layer GCN, and its expression is:
[0029]
[0030] Among them, A is the adjacency matrix, X is the feature matrix, is the normalized adjacency matrix, W (0) ∈R M×H and W (1) ∈R H ×F is the weight matrix of the two graph convolution layers, σ is the Relu activation function.
[0031] Furthermore, obtaining cigarette data includes:
[0032] Collect cigarette information from inside and outside the cigarette company;
[0033] Extracting keywords from cigarette information and merging features, the keywords including cigarette brand, cigarette specifications, brief information, and attribute features;
[0034] The merged cigarette information is processed to obtain digital features, the digital features are standardized and bad data are eliminated to obtain cigarette data.
[0035] A cigarette correlation analysis system based on graph neural network, comprising a processor and a storage medium;
[0036] The storage medium is used to store instructions;
[0037] The processor is configured to operate according to the instructions to execute the steps of any one of the methods of the first aspect.
[0038] A computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, implements the steps of any one of the methods described in the first aspect.
[0039] According to the above technical solution, the beneficial effects of the present invention are as follows: the present invention constructs a knowledge graph processed by a graph neural network based on cigarette data, uses a graph neural network to process complex and non-Euclidean cigarette data, and uses a semi-supervised approach to train the graph neural network with a small number of labels to obtain a similarity classification model with node correlation. By inputting new cigarette data into the similarity classification model, the similarity between new cigarettes and cigarettes of different specifications can be obtained quickly and efficiently. BRIEF DESCRIPTION OF THE DRAWINGS
[0040] Figure 1 It is the overall flow chart of the present invention;
[0041] Figure 2 This is a structural diagram of the graph neural network in the present invention;
[0042] Figure 3 This is a flowchart of the semi-supervised learning method for training graph neural networks in the present invention. DETAILED DESCRIPTION
[0043] In order to make the technical means, creative features, objectives and effects achieved by the present invention easier to understand, the present invention is further described below in conjunction with specific implementation methods.
[0044] The present invention uses historical cigarette data and new cigarette products to perform correlation analysis, and judges the sales situation of the new cigarette products in the market according to the size of the correlation.
[0045] In a cigarette graph, the central node represents the brand, the child nodes represent the specifications, and the tail node represents the attributes of the child nodes (i.e., cigarette properties), including tar content, length, thickness, and historical sales data. This graph is generated from a non-Euclidean domain and represented as a graph with complex relationships and interdependencies between objects. This complexity and irregularity make it difficult to successfully train traditional neural networks. However, graph neural networks can efficiently leverage the structural attributes of cigarette samples, fully tapping into the rich information contained in the data and effectively expressing the relationships between different samples, thereby maximizing the use of the structural characteristics of the graph data.
[0046] Based on this, the present invention designs a cigarette correlation analysis method based on a semi-supervised graph neural network. By constructing a knowledge graph, obtaining cigarette graph data, and using a semi-supervised method to train a graph neural network model to predict the correlation between cigarettes, it helps to judge the similarity between new cigarettes and other cigarettes, and predict the sales trend of new cigarettes in the market.
[0047] Example 1
[0048] A cigarette association analysis method based on a graph neural network comprises: obtaining cigarette data; constructing a knowledge graph based on the cigarette data; wherein the main node of the knowledge graph is the cigarette brand, the child nodes are the cigarette specifications, and the tail node is the cigarette profile information and attribute characteristics; obtaining an adjacency matrix, a label matrix, and a corresponding feature matrix based on the knowledge graph; using a semi-supervised learning method, inputting the adjacency matrix, label matrix, and corresponding feature matrix into the graph neural network for training to obtain a similarity classification model; and inputting new cigarette data into the similarity classification model to obtain the similarity between the new cigarette and other cigarettes.
[0049] The present invention constructs a knowledge graph processed by a graph neural network based on cigarette data, uses the graph neural network to process complex and non-Euclidean cigarette data, and uses a semi-supervised approach to train the graph neural network with a small number of labels to obtain a similarity classification model with node correlation. By inputting new cigarette data into the similarity classification model, the similarity between new cigarettes and cigarettes of different specifications can be quickly and efficiently obtained.
[0050] The technical concept of the present invention is to obtain the similarity of other edges by using a small number of similar labels in a semi-supervised learning edge classification manner, thereby achieving the purpose of statistically analyzing the similarity between new and old cigarettes.
[0051] First, internal and external cigarette data is acquired and collected. Keywords are then extracted from comments, introductions, and other data, and merged with other standardized attribute features. A knowledge graph is then constructed based on neo4j, with the main node being the cigarette brand, the child node being the cigarette specification, and the tail node being the introduction feature. Several pairs of similar cigarette specifications are then selected, and their cosine similarity is calculated to determine the degree of similarity. This is used as the edge value, i.e., the similarity size, and the adjacency matrix, label matrix, and feature matrix are constructed accordingly. Finally, the obtained adjacency matrix, label matrix, and feature matrix are input into the graph neural network, and the adjacency matrix is completed based on a semi-supervised learning method to obtain the similarity between all cigarettes.
[0052] The present application is described below through a specific embodiment.
[0053] Step 1: Cigarette data collection and preprocessing.
[0054] Taking Liqun as an example, the collected external data of Liqun and the decrypted internal data of Liqun are pre-processed.
[0055] TextRank is used to extract keywords and key phrases during the collection of external data from Liqun Cigarettes. First, the original introduction text is split into words using the Jieba word segmentation algorithm. After filtering and removing duplicates, each word is used as a node in the graph. The edges connecting the nodes are constructed using the n-gram algorithm. When a word is associated with other nearby words, an undirected edge is established between the associated words. In this scenario, a weighted graph G = (V, E) is constructed with similarity as the edge weight, where V is the set of candidate keyword nodes. After constructing the sentence graph, it is iteratively calculated according to the TextRank formula to calculate the weight of each node:
[0056]
[0057] Among them, WS(V i ) represents node V i The weight value, I n (V i ) represents node V i The predecessor node set, out(V i ) represents node V i The successor node set, d is the damping coefficient, which is 0.85, w ji Indicates the similarity between two candidate keywords, WS(V j ) represents the node V from the last iteration j The weight value of each candidate keyword is obtained, and finally the node weights are sorted to obtain the most important keywords.
[0058] Then, internal and external data are integrated, and operations such as data cleaning, data integration, data standardization, and data reduction are performed to eliminate anomalies in the raw data, adapt the data to the model, and match the model's requirements. One-hot encoding is then used to factorize the text features. One-hot encoding, also known as single-bit effective encoding, primarily uses an N-bit state register to encode N states. Each state has its own independent register bit, and only one bit is valid at any given time. For example, the gender of male or female can be represented by "[1,0], [0,1]", where male corresponds to [1,0] and female corresponds to [0,1]. One-hot encoding of features solves the problem of classifiers having difficulty handling discrete data and also serves to expand features to a certain extent.
[0059] Step 2: Build a knowledge graph based on Neo4j
[0060] In the constructed knowledge graph, the central node represents the cigarette brand, the child nodes are cigarette specifications, such as Hongli Group and Yangguang Liqun, and the tail node represents the characteristic attributes of each Liqun cigarette, including whether it is a premium cigarette or a high-priced cigarette. Node relationships, such as attributes and descriptions, are added.
[0061] Step 3: Obtain the adjacency matrix, label matrix and corresponding attribute features.
[0062] Based on the constructed knowledge graph and internal known information, several groups of similar specifications of Liqun cigarettes are selected, such as Liqun (slim casual cigarettes) and Liqun (cloud casual cigarettes). The cosine similarity is calculated based on their attribute characteristics. The expression is as follows:
[0063]
[0064] in, and The n-dimensional vectors representing the characteristic attributes of the two cigarettes are determined according to the cosine similarity obtained, where 0-0.5 is dissimilar, 0.5-0.7 is relatively similar, 0.7-0.9 is similar, and 0.9-1.0 is extremely similar, and are represented by 4, 3, 2, and 1 respectively.
[0065] Then create a label matrix A based on its similarity classification target (no label, i.e. the median value of the matrix is 0) and the adjacency matrix A with all values 1 indicates that all cigarette nodes are connected, and then the feature matrix X is obtained based on the attribute characteristics of cigarettes of different specifications.
[0066] Step 4: Train the graph neural network based on pseudo-label semi-supervised learning to obtain a similarity classification model.
[0067] The graph neural network used in this invention is a double-layer GCN structure, such as Figure 2 As shown in Figure 2, this structure can extract and fuse node features and structural information in the graph, embedding each node into a high-dimensional vector space. The specific operation is as follows:
[0068]
[0069] Among them, A represents the adjacency matrix of the graph, X is the feature matrix, represents the normalized adjacency matrix, I N is the identity matrix, Is the degree matrix of the nodes in the graph, which is a diagonal matrix, and its i-th diagonal element A∈R N×N , X∈R N×M , W (0) ∈R M×H and W (1) ∈R H×Fis the weight matrix of the two-layer graph convolution layer, Z∈R N×F is the hidden layer feature of each node output by the graph convolution layer, N represents the number of nodes contained in the graph, H represents the dimension of the hidden layer, and F represents the dimension of the output node embedding vector. σ is the Relu activation function. Its expression is as follows:
[0070] f(x)=max(0,x) (4)
[0071] A Dropout layer with a probability of 0.8 is set in the graph neural network. During each generation of training, there is a probability of 0.2 to actively and temporarily ignore some hidden nodes to speed up model training and prevent overfitting. The result is output by the softmax function, and its expression is as follows:
[0072]
[0073] Among them, z i is the output value of the i-th node, C is the number of output probabilities, that is, the number of classification categories, which is 4 categories in this application. Sum the output values of all nodes. Use the Softmax function to obtain the confidence level of each similarity classification between cigarettes. Convert the output values of the four categories into a probability distribution in the range [0, 1] and with a value of 1 to obtain the prediction result.
[0074] The loss function uses the mean square error (MSE) to calculate the average value of the square of the distance between the model prediction value and the true value of the sample. Its expression is as follows:
[0075]
[0076] Among them, y i and f(x i ) represent the true value and predicted value of the i-th sample, m is the number of samples, that is, the label matrix A target With the output matrix A Pre The model optimizer uses the stochastic gradient descent method with momentum, which is expressed as:
[0077]
[0078] θ i =θ i-1 -v i
[0079] Among them, α represents the momentum parameter, η is the learning rate, is the gradient value obtained by taking the partial derivative of the loss function with respect to the parameter θ, θ i-1 and θ i Represent the model parameters before and after the update respectively.
[0080] Pseudo-label semi-supervised learning is used to train graph neural networks, such as Figure 3 As shown, there are mainly the following steps:
[0081] Step 4.1, initialize the adjacency matrix A and label matrix A target And the feature matrix X is used as the initial training set. According to the training set, iterative training is carried out until the loss function converges to obtain an initial graph neural network link classifier C int And the predicted output matrix A Pre .
[0082] Step 4.2: Obtain the confidence of the classifier for the similar category of each edge using formula (5), select the classification result with the highest confidence, and add it to the label matrix A. target , and obtain the new label matrix.
[0083] Step 4.3: Continue iteratively training the graph neural network link classifier based on the new label matrix to obtain the predicted output matrix. Repeat steps 2 to 3 until the label matrix A target is filled to obtain the final cigarette similarity classification model.
[0084] When calculating the similarity between a new product and other cigarettes, it is only necessary to add the edge relationship and characteristic attributes of the new cigarette to the adjacency matrix and feature matrix respectively, and input them into the final cigarette similarity classification model. The similarity between the new cigarette and other specifications of cigarettes can be obtained, providing a reference for its production improvement and risk avoidance.
[0085] Example 2
[0086] Those skilled in the art will appreciate that the embodiments of the present application can be provided as methods, systems, or computer program products. Therefore, the present application can adopt the form of a complete hardware embodiment, a complete software embodiment, or an embodiment in combination with software and hardware. Moreover, the present application can adopt the form of a computer program product implemented on one or more computer-usable storage media (including but not limited to magnetic disk storage, CD-ROM, optical storage, etc.) that contain computer-usable program code.
[0087] The present application 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 the present application. It should be understood that each process and / or box in the flowchart and / or block diagram, as well as the combination of the processes and / or boxes 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 steps in the process. 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.
[0088] These computer program instructions may also be stored in a computer readable memory that can direct a computer or other programmable data processing device to work 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 The function specified in one or more boxes.
[0089] These computer program instructions can also be loaded onto a computer or other programmable data processing device so that a series of operational steps are executed on the computer or other programmable device to produce a computer-implemented process, thereby providing the instructions executed on the computer or other programmable device 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.
[0090] The processor is used to read and run the computer program instructions corresponding to the cigarette correlation analysis method based on graph neural network stored in the memory, and execute the cigarette correlation analysis method provided in the embodiment of the present application.
[0091] A processor may be an integrated circuit chip with signal processing capabilities. The processor may be a general-purpose processor, including a central processing unit (CPU) or a network processor (NP); or a digital signal processor (DSP), discrete gate or transistor logic devices, or discrete hardware components.
[0092] It is understood from common technical knowledge that the present invention may be implemented by other embodiments that do not depart from its spirit or essential features. Therefore, the embodiments disclosed above are, in all respects, merely illustrative and not exclusive. All modifications within the scope of the present invention or equivalent to the scope of the present invention are intended to be encompassed by the present invention.
Claims
1. A cigarette correlation analysis method based on graph neural network, characterized in that: include: Obtain cigarette data; Build a knowledge graph based on cigarette data; the main node of the knowledge graph is the cigarette brand, the child nodes are the cigarette specifications, and the tail node is the cigarette profile information and attribute characteristics; Obtain the adjacency matrix, label matrix and corresponding feature matrix based on the knowledge graph; Using a semi-supervised learning approach, the adjacency matrix, label matrix, and corresponding feature matrix are input into the graph neural network for training to obtain a similarity classification model. Inputting new cigarette data into a similarity classification model to obtain the similarity between the new cigarette and other cigarettes; Wherein, obtaining the similarity classification model comprises the following steps: The adjacency matrix, label matrix, and feature matrix are input into the graph neural network as the initial training set for iterative training until the loss function converges, and the link classifier and prediction output matrix of the graph neural network are obtained; The softmax function is used to obtain the confidence of the link classifier for the similar category to which each edge belongs. The classification result with the highest confidence is selected and added to the label matrix to obtain a new label matrix. Continue to iteratively train the link classifier of the graph neural network according to the new label matrix until the label matrix is filled and the final similarity classification model is obtained.
2. The cigarette correlation analysis method according to claim 1, characterized in that: The step of obtaining the adjacency matrix, the label matrix, and the corresponding feature matrix according to the knowledge graph includes: Based on existing experience, several groups of cigarettes of different specifications with different similarities are selected, and the cosine similarity is calculated using the characteristic attributes of the cigarettes; Based on the edge relationship between child nodes in the knowledge graph and the cosine similarity classification, the adjacency matrix and label matrix are created, and the feature matrix is obtained based on the tail node corresponding to the child node.
3. The cigarette correlation analysis method according to claim 2, characterized in that: The expression of cosine similarity is: ; in, and Represents the characteristic attributes of two cigarettes dimensional vector; when the cosine similarity is 0-0.5, it is dissimilar; when the cosine similarity is 0.5-0.7, it is relatively similar; when the cosine similarity is 0.7-0.9, it is similar; when the cosine similarity is 0.9-1.0, it is extremely similar.
4. The cigarette correlation analysis method according to claim 1, characterized in that: The expression of the softmax function is: ; in, is the output value of the i-th node, is the number of categories for classification.
5. The cigarette correlation analysis method according to claim 1, characterized in that: The expression of the loss function is: ; in, and They represent the true value and predicted value of the i-th sample respectively, and m is the number of samples.
6. The cigarette correlation analysis method according to claim 1, characterized in that: The graph neural network is a structural graph neural network using a double-layer GCN, and its expression is: ; in, is the adjacency matrix, is the feature matrix, is the normalized adjacency matrix, and is the weight matrix of the two graph convolution layers, is the Relu activation function.
7. The cigarette correlation analysis method according to claim 1, characterized in that: Obtaining cigarette data includes: Collect cigarette information from inside and outside the cigarette company; Extracting keywords from cigarette information and merging features, the keywords including cigarette brand, cigarette specifications, brief information, and attribute features; The merged cigarette information is processed to obtain digital features, the digital features are standardized and bad data are eliminated to obtain cigarette data.
8. A cigarette correlation analysis system based on graph neural network, characterized in that: including processor and storage medium; The storage medium is used to store instructions; The processor is configured to operate according to the instructions to execute the steps of the method according to any one of claims 1 to 7.
9. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the program is executed by a processor, the steps of the method according to any one of claims 1 to 7 are implemented.
Citation Information
Patent Citations
Graph neural network model construction method, system and device, diagnosis and treatment scheme recommendation method, system and device
CN113434692A