International relation sentiment analysis method, system and device and storage medium
By using multimodal data processing and deep learning techniques, an international relations sentiment analysis model is constructed, which solves the problems of time-consuming and labor-intensive methods and single-modal analysis in existing technologies. It achieves efficient and accurate analysis of international relations sentiment and provides comprehensive and scientific predictive capabilities.
Patent Information
- Application Number
- CN202411175483.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-08-26
- Publication Date
- 2026-02-10
AI Technical Summary
Existing methods for sentiment analysis in international relations mainly rely on manual analysis, which is time-consuming, labor-intensive, and subject to subjective bias. Moreover, most studies only deal with single-modal data, which cannot comprehensively reflect the sentiment in international relations and are difficult to accurately capture the complexity of word meaning and subtle changes in sentiment.
This study employs a combination of multimodal data processing, deep learning, and transfer learning. By collecting text, audio, and video data, and using natural language processing techniques to extract semantic and sentiment information, an international relations sentiment analysis model is constructed. Transfer learning, multi-task learning, and graph neural networks are then used for training and prediction.
It enables efficient and accurate sentiment analysis of multimodal international relations data, improving the comprehensiveness and accuracy of the analysis, and providing a better understanding and prediction of complex international relations dynamics, offering scientifically rigorous prediction results.
Smart Images

Figure CN121503484A_ABST
Abstract
Description
Technical Field
[0001] This invention belongs to the field of machine learning, and more specifically relates to a method, system, device and storage medium for sentiment analysis of international relations. Background Technology
[0002] International relations sentiment analysis is a unique approach to studying sentiment biases within diplomatic contexts. It helps policymakers understand the complex relationships between different countries and formulate appropriate strategies. The most common method in this field is manual analysis, relying on professionals' in-depth reading and understanding of international relations literature to manually assign sentiment labels. The drawback of this method is that it is time-consuming, labor-intensive, and susceptible to the subjective biases of the analysts.
[0003] In recent years, with the development of text mining and natural language processing (NLP) technologies, many studies have begun to attempt to use these technologies to automate the analysis of international relations. However, most studies are still based on single-modal data analysis, such as sentiment analysis only on text data, without considering multimodal data such as audio, video, and social networks. This cannot fully reflect the actual situation of international relations.
[0004] Furthermore, most sentiment analysis methods are insufficient in handling the complexity and ambiguity of word meanings, making it difficult to accurately capture subtle changes in sentiment. Additionally, most sentiment analysis models are supervised learning models, requiring large amounts of labeled data for training, which is often difficult to obtain in practice. Summary of the Invention
[0005] This invention provides a method for sentiment analysis in international relations, capable of processing multimodal data. Furthermore, through techniques such as deep learning and transfer learning, it can better understand and extract deep semantic information from text, thereby improving the accuracy of sentiment analysis. To achieve the above objectives, this invention employs the following technical solution: The method includes:
[0006] Collect, clean, and standardize multimodal data, including text, audio, video, and international relations interaction data.
[0007] Natural language processing techniques are used to process and extract semantic and sentiment information from the multimodal data;
[0008] An international relations sentiment analysis model is constructed using a deep learning model that combines transfer learning, multi-task learning, and graph neural networks.
[0009] Model training is performed using extracted semantic and sentiment information and a constructed international relations sentiment analysis model.
[0010] Apply the model to new data for prediction and evaluation, including model performance evaluation and result analysis.
[0011] In one approach, the collection of multimodal data includes:
[0012] Collect multimodal data including text, audio, and video from news websites, social media, government announcements, and diplomatic meeting minutes; collect data on interactions between countries, including trade data and diplomatic interaction data;
[0013] Data preprocessing includes denoising, stop word removal, stemming, and part-of-speech tagging of text data; speech recognition for audio and video data to convert it into text data for analysis; and standardization and normalization for numerical international relations interaction data.
[0014] In one approach, the use of natural language processing techniques to process and extract semantic and sentiment information from the multimodal data includes:
[0015] Semantic information extraction involves first segmenting the text data into words, then using the word embedding model GloVe to convert the segmented words into vectors, which are then input into a deep learning model.
[0016] Emotional information extraction: Emotional information is extracted using an emotional dictionary.
[0017] In one approach, the construction of an international relations sentiment analysis model includes:
[0018] (1) Using the transfer learning method, semantic and sentiment information of the text is obtained through the pre-trained semantic model BERT; the obtained semantic and sentiment information is used as features for the next steps;
[0019] (2) Semantic and sentiment information is fed into a multi-task learning model, and multiple objectives are set according to the actual task, including sentiment prediction and relationship classification.
[0020] (3) Structure the international relations data into a heterogeneous network and process it using a graph neural network. Nodes represent entities, such as countries and people, and edges represent relationships between entities, such as allies, conflicts, and cooperation. Each layer of the graph neural network is regarded as a process of "information dissemination".
[0021] Aggregate information on the neighboring nodes of a node. If there are N nodes in the graph, the initial feature representation of each node is X = [x1, x2, ..., x...]. N ] T Let the adjacency matrix of the graph be A, and then one information propagation of the GNN can be represented as:
[0022] X' = σ(A*X*W);
[0023] Here, "*" represents matrix multiplication, σ is a non-linear activation function such as ReLU, and W is the parameter learned. This process is repeated multiple times, allowing information to continuously propagate and aggregate on the graph.
[0024] (4) Use the learned features to perform sentiment analysis and predict the interaction attitudes between countries, such as friendliness or conflict; the output of the model is the probability of each type of sentiment, and finally select the sentiment with the highest probability as the prediction result.
[0025] In one approach, the model training includes:
[0026] 1) Initialize model parameters, including those for the BERT model, multi-task learning model, and graph neural network model;
[0027] 2) Input data: First, the semantic and sentiment vectors obtained from the word embedding model GloVe are used as input and fed into the BERT model; the resulting feature vectors are used as input and fed into the multi-task learning model and the graph neural network model; specifically as follows:
[0028] The extracted semantic and sentiment vectors are X = [x1, x2, ..., x n The corresponding label is y = [y1, y2, ..., y]. n If the input is [h1, h2, ..., h], then it is fed into the BERT model to obtain the feature vector H = BERT(X), where H = [h1, h2, ..., h]. n ];
[0029] 3) Model training: The learned features H and their corresponding labels y are used to train the model.
[0030] For a multi-task learning model, there are m tasks, and the loss function for each task is L. i (.), i = 1, 2, ..., m, is the Softmax loss function. The training objective is to minimize the weighted sum of losses for all tasks, i.e.:
[0031]
[0032] Where Θ represents the model parameters, w i Weights for each task;
[0033] For the graph neural network model, the international relations data are first constructed into a graph, and the feature vector of each node is h. i i = 1, 2, ..., N, where N is the number of nodes in the graph. The graph neural network is trained by analyzing the structure of the graph and the characteristics of the nodes.
[0034] In a graph neural network, the forward propagation of each layer is expressed as:
[0035]
[0036] Here, A is the adjacency matrix, D is the degree matrix, H(l) represents the node representation of the l-th layer, W(l) is the weight matrix of the l-th layer, and σ represents the nonlinear activation function;
[0037] 5) Parameter update: Based on the model's loss, the backpropagation algorithm is used to update the model's parameters. This process is iterated until the model's loss converges.
[0038] In one approach, the prediction and evaluation include:
[0039] For new input data, convert it into a format that the model can accept;
[0040] Use the same methods as in the training phase to extract features from new data, including semantic and sentiment information;
[0041] The extracted features are input into the trained model to obtain the prediction results;
[0042] Model evaluation: Measures the predictive performance of the model, including prediction accuracy, recall, and F1 score.
[0043] In one approach, the sentiment information extraction is as follows: Text T contains n words, where the sentiment score of the i-th word is s(i). If the word is in the sentiment dictionary, then s(i) takes the corresponding score of that word in the sentiment dictionary; otherwise, s(i) is 0. Therefore, the sentiment score S(T) of text T is expressed as: ; The sentiment score of a text is calculated using a sentiment lexicon, thereby reflecting the text's sentiment orientation.
[0046] Furthermore, a system for sentiment analysis of international relations using machine learning, the system being applicable to the method described, the system comprising:
[0047] The data collection module gathers multimodal data from news websites, social media, government announcements, and diplomatic meeting minutes, including text, audio, video, and international relations interaction data.
[0048] The data preprocessing module cleans and standardizes the collected multimodal data;
[0049] The natural language processing module extracts semantic and sentiment information from the data;
[0050] The model building module uses transfer learning, multi-task learning, and graph neural networks to construct an international relations sentiment analysis model.
[0051] The model training module uses the extracted features and the constructed model for training.
[0052] The prediction and evaluation module applies the trained model to new data to perform predictions and evaluations.
[0053] On the other hand, an apparatus includes a processor and a memory, the memory storing computer-readable instructions that, when executed by the processor, implement the method for sentiment analysis of international relations using machine learning.
[0054] On the other hand, a computer medium storing a computer program, which, when executed by a processor, implements the method for sentiment analysis of international relations using machine learning.
[0055] The beneficial effects of this invention are:
[0056] 1) Effective handling of multimodal data: Data from many international relations processes is diverse, including text, audio, and video. This invention employs a data preprocessing module that effectively cleans and standardizes this multimodal data, enabling it to be correctly identified and processed by the model. Particularly for non-text data, the module can transform it into analyzable text data, which helps to broaden the scope of the analysis and improve its accuracy and comprehensiveness.
[0057] 2) Deep Learning Improves Analysis Efficiency and Accuracy: This invention employs a deep learning model combining transfer learning, multi-task learning, and graph neural networks. Utilizing a pre-trained model, it can extract semantic and sentiment information from the data more deeply, which is particularly important for processing complex and sometimes ambiguous international relations data. While ensuring processing speed, it also significantly improves the accuracy of data processing.
[0058] 3) Targeted Model Training: The model building module of this invention can be customized according to different needs, such as setting different weights or constructing heterogeneous networks of international relations, depending on the data and task. This targeted training method enables the model to better adapt to different tasks and improves its generalization performance.
[0059] 4) Scientific nature of model evaluation and prediction: This invention has strong predictive capabilities, can accurately predict sentiment based on new international relations data, and conducts rigorous scientific evaluation of the model, including prediction accuracy, recall rate, and F1 score, thereby making the model's prediction results more convincing.
[0060] In summary, this invention employs advanced deep learning technology, enabling it to process a wide range of multimodal data and provide accurate and efficient sentiment analysis results in international relations. This has significant application value in the complex and chaotic field of international relations. Attached Figure Description
[0061] Figure 1 This is a flowchart of the method of the present invention;
[0062] Figure 2 Flowchart for constructing an international relations sentiment analysis model for this invention;
[0063] Figure 3 The flowchart shows the training process of the international relations sentiment analysis model constructed using the previously extracted features.
[0064] Figure 4 This is a block diagram of a deep learning model that combines transfer learning, multi-task learning, and graph neural networks in this invention.
[0065] Figure 5 This is a system block diagram for the international relations sentiment analysis of this invention. Detailed Implementation
[0066] To facilitate understanding of the present invention, a more complete description will be given below with reference to the accompanying drawings. Typical embodiments of the invention are shown in the drawings. However, the invention can be implemented in many different forms and is not limited to the embodiments described herein. Rather, these embodiments are provided so that this disclosure will be thorough and complete.
[0067] Unless otherwise defined, all technical and scientific terms used in this invention have the same meaning as understood by one of ordinary skill in the art to which this invention pertains. The terminology used in this specification is for the purpose of describing particular embodiments only and is not intended to be limiting of the invention.
[0068] Example 1:
[0069] like Figure 1 As shown, the method for international relations sentiment analysis includes:
[0070] S1. Collect multimodal data and clean and standardize it. The multimodal data includes text, audio, video and international relations interaction data.
[0071] The collection of multimodal data includes:
[0072] Data source selection: Multimodal data, including text, audio, and video, can be collected from news websites, social media, government announcements, diplomatic meeting minutes, etc. Additionally, data on interactions between countries, such as trade data and diplomatic interaction data, can also be collected.
[0073] Data preprocessing: First, text data undergoes preprocessing steps such as noise reduction, stop word removal, stemming, or part-of-speech tagging. For audio and video data, speech recognition or image recognition is required to convert it into analyzable text data. For numerical international relations interaction data, standardization or normalization is necessary preprocessing steps.
[0074] For stemming text data, the Porter algorithm can be used. The Porter algorithm is a heuristic process that applies approximately 60 rules across six stages to stem English words.
[0075] Data cleaning typically involves methods such as missing value imputation and outlier handling. For example, missing values can be imputed using the mean, median, or mode.
[0076] The formulas involved in data standardization are:
[0077] Z=(X-μ) / σ
[0078] Where Z represents the standardized data, X represents the original data, μ represents the mean of the data, and σ represents the standard deviation of the data.
[0079] S2. Processing and extracting semantic and sentiment information from the multimodal data using natural language processing techniques includes:
[0080] Semantic information extraction: First, the text data is segmented into words, and then the word embedding model GloVe is used to convert the segmented words into vectors so that they can be input into the deep learning model. The basic formula of the word embedding model is as follows:
[0081]
[0082] Where V is the total number of words, f() is the weight function, X_{ij} is the number of times word i and word j co-occur, w is the word vector, and \tilde w is the context word vector.
[0083] Sentiment information extraction primarily relies on sentiment lexicon methods. A sentiment lexicon is a predefined dictionary containing a large number of words and their corresponding sentiment polarities and intensities. Common sentiment lexicons include SentiWordNet and AFINN. An example of using a sentiment lexicon is as follows:
[0084] First, the input text undergoes preprocessing, including word segmentation, stop word removal, and stemming. Then, the processed text entries are matched against a sentiment dictionary to find matching sentiment words, and the sentiment scores for each found word are summed. For example, if "positive" is marked as +1 and "negative" as -1, the word "happy" is found in the sentiment dictionary and marked as +1, while "sad" is found and marked as -1. Finally, the sentiment scores for all found words are summed. A higher final sentiment score indicates a more positive sentiment tendency in the text, and vice versa.
[0085] Suppose a text T contains n words, where the sentiment score of the i-th word is s(i). If the word is in the sentiment dictionary, then s(i) takes the corresponding score of the word in the sentiment dictionary; otherwise, s(i) is 0. Then the sentiment score S(T) of text T can be expressed as: ; In this way, the sentiment score of a text can be calculated using a sentiment dictionary, thereby reflecting the sentiment tendency of the text.
[0088] S3. Construct an international relations sentiment analysis model using a deep learning model that combines transfer learning, multi-task learning, and graph neural networks.
[0089] First, these three models differ in nature and complement each other. Transfer learning, by borrowing knowledge from pre-trained models, can solve the problems of model transferability and training efficiency, while multi-task learning allows models to learn other related tasks while learning one task, which optimizes model performance and prevents overfitting. Graph neural networks are highly expressive in structured data, using node information and connectivity in graphs to encode relationships between entities that are more complex and deeper than simple emotional relationships, such as allies, conflicts, and cooperation.
[0090] Secondly, these three models promote and enhance each other. Transfer learning and multi-task learning can share representation layers, which helps extract more general features. These features can not only be used for training multi-task learning models, but also for feature representations of nodes in graph neural networks, thereby better learning and predicting relationships between entities.
[0091] (1) Integrating transfer learning, multi-task learning, and graph neural networks effectively improves the generalization ability and learning efficiency of the model. Transfer learning can use pre-trained models, reducing model training time and difficulty; multi-task learning allows the model to learn multiple tasks simultaneously, improving the model's efficiency; graph neural networks can effectively process graph-structured data, making them suitable for modeling complex interactions in international relations.
[0092] (2) Applying deep learning models to the field of sentiment analysis in international relations, this model not only processes text information, but also integrates multimodal data such as audio, video and international relations interaction data. This cross-modal research is also innovative.
[0093] (3) Combining the three models together can improve the efficiency and generalization ability of the model, and better handle large-scale and complex international relations data. It can provide more comprehensive and in-depth analysis. Due to the comprehensive processing and analysis of various types of data (text, audio, video and relational data), it can reveal the relationship network and changes in emotional attitudes between countries, and reveal deeper dynamics of international relations. It can improve the accuracy of sentiment analysis. By learning multiple tasks simultaneously and using graph neural networks to model complex relationships, the model can better understand and mine complex and subtle emotional expressions, thereby making more accurate predictions.
[0094] like Figure 2 and Figure 4 As shown, the construction of the international relations sentiment analysis model includes:
[0095] S301. Using transfer learning, semantic and sentiment information of the text is obtained through a pre-trained semantic model BERT; the obtained semantic and sentiment information is used as features in the following steps.
[0096] For the input sentence, some words (e.g., 15%) are randomly selected and masked with a specific symbol. The model then predicts these masked words. For example, the sentence "The cat sat on the mat" is masked as "The cat sat on the [MASK]", and the model needs to predict that the word "mat" should be at the [MASK] position. The objective function for training is to maximize the log-likelihood of this prediction, and the mathematical formula is:
[0097] logP(w(t)|w(1:t-1),w(t+1:T),Θ)
[0098] Where T is the number of training samples, w(t) is the masked word, w(1:t-1) and w(t+1:T) are the context surrounding the word, and Θ is the model parameter.
[0099] S302. Semantic and sentiment information are fed into a multi-task learning model, with multiple objectives set according to the actual task, including sentiment prediction and relation classification. Based on transfer learning, multiple objectives can be set according to the actual task, such as sentiment prediction and relation classification, and these objectives are jointly trained. Assuming there are n tasks, and the loss function for each task is Li(.), the objective can be expressed as:
[0100]
[0101] Where Θ represents the model parameters, w i Weights for each task.
[0102] In S302, the multi-task learning model predicts and classifies sentiment and semantic information. Its output includes the prediction and classification results for each task, such as the prediction of sentiment tendency and the classification of relationships. These prediction and classification results are essentially feature representations of the text data, typically presented in vector form.
[0103] Then, proceeding to S303, these feature representation vectors can be used as input to the graph neural network. During the model building phase, the international relations data is structured into a heterogeneous network, where nodes represent entities (e.g., countries, individuals) and edges represent relationships between entities (e.g., allies, conflicts, cooperation). These feature representation vectors will be used as features for each node, thus assigning each node a vector as a feature identifier in the graph. By loading semantic and sentiment features into the network as nodes, the complex international relations data is transformed into a structured network model, allowing graph neural networks to be used for information propagation and aggregation.
[0104] Therefore, the connection process between S302 and S303 is mainly achieved by using the output of the multi-task learning model (i.e., the feature representation vector) as the input to the node features in the graph neural network. This approach effectively connects the two stages of text information processing and network structure analysis, enabling the model to fully utilize various types of information for sentiment analysis.
[0105] S303. Structure international relations data into a heterogeneous network and process it using a graph neural network. Nodes represent entities, such as countries and people, and edges represent relationships between entities, such as allies, conflicts, and cooperation. Each layer of the graph neural network is regarded as a process of "information dissemination".
[0106] Aggregate information on the neighboring nodes of a node. If there are N nodes in the graph, the initial feature representation of each node is X = [x1, x2, ..., x...]. N ] T Let the adjacency matrix of the graph be A, and then one information propagation of the GNN can be represented as:
[0107] X' = σ(A*X*W);
[0108] Here, "*" represents matrix multiplication, σ is a non-linear activation function such as ReLU, and W is the parameter learned. This process is repeated multiple times, allowing information to continuously propagate and aggregate on the graph.
[0109] S304. Utilize the learned features to perform sentiment analysis and predict the interaction attitudes between countries, including friendliness and conflict; the model outputs the probability of each type of sentiment, and finally selects the sentiment with the highest probability as the prediction result.
[0110] In S304, sentiment analysis is performed on the learned features by analyzing the feature vectors output by the Graph Neural Network (GNN) model. After training the GNN, the final result typically generates a feature vector at each node, which contains textual semantics, sentiment information, and structural information of the node in the graph.
[0111] To perform sentiment classification, a fully connected layer is added at the end of the GNN. The number of output nodes in this fully connected layer should equal the number of categories. For each category, the fully connected layer has an independent output node. The input to the fully connected layer is the output of the GNN, i.e., the feature vector of each node. This feature vector is then processed by the fully connected layer, and each output node receives a numerical value. This value can be seen as the probability that the input feature vector belongs to the category represented by that node. Then, softmax normalization is applied to all output nodes so that the sum of all output node values is 1. The final value of each node can be considered as the predicted probability of its corresponding category.
[0112] The classification results are used to select the category with the highest output probability as the final prediction result.
[0113] This forms a complete sentiment analysis process, from acquiring textual information and extracting features, to information propagation and aggregation through graph neural networks, and finally sentiment classification. The entire process is learned in an end-to-end manner, without the need for manual extraction of complex features, and can effectively conduct sentiment analysis of international relations.
[0114] When constructing the international relations sentiment analysis model, a deep learning model combining transfer learning, multi-task learning, and graph neural networks was used, which has the following advantages:
[0115] 1. Transfer learning can utilize pre-trained models for rapid training, reducing the difficulty and time cost of model training. Furthermore, since pre-trained models are usually trained on large-scale datasets, they have strong generalization ability and can effectively handle new international relations text data.
[0116] 2. Multi-task learning can solve multiple related tasks simultaneously, improving the model's learning efficiency. For example, in this invention, tasks such as sentiment category and country relationship classification can be predicted simultaneously, effectively utilizing shared information and improving the model's learning efficiency and predictive performance.
[0117] 3. Graph neural networks can effectively process structured international relations data, enabling joint learning of the network structure and semantic characteristics of international relations, thereby better understanding and describing the sentiment tendencies of international relations.
[0118] 4. Combining the advantages of deep learning, this model can automatically extract complex features without the need for manual feature design, reducing the workload of relevant researchers. Furthermore, deep learning models typically have high prediction accuracy, which can better meet the needs of sentiment analysis in international relations.
[0119] 5. This model has good scalability, providing options for model improvement and optimization. For example, for specific tasks or data, it is relatively easy to add new network structures or adjust network parameters to adapt to different task requirements.
[0120] S4. Model training: The extracted semantic and sentiment information is used to train the constructed international relations sentiment analysis model.
[0121] like Figure 3 As shown, the model training includes:
[0122] S401. Initialize model parameters, including parameters for the BERT model, multi-task learning model, and graph neural network model.
[0123] 1) BERT Model Parameter Initialization: The main parameters in the BERT model include the parameters of the self-attention matrix in the Transformer structure and the parameters of the fully connected layers. Parameter initialization typically uses a normal distribution for random initialization. Assuming the BERT model contains N Transformer Blocks, and each Block contains M parameters, the BERT parameter initialization can be represented as follows:
[0124] θ BERT ={θ (i) :i=1,...,N}, where θ (i) ={W (i) ,b (i) :j=1,...,M}
[0125] Here θ (i) W represents all parameters of the i-th Transformer Block. (i) and b (i)These are the weight matrix and bias term in the i-th Transformer Block, respectively.
[0126] 2) Initialization of Graph Neural Network Model Parameters: The main parameters in a graph neural network (GNN) are the parameters of the GNN layers. Let the number of GNN layers be L, and the parameters of each layer be W. (l) (l=1,…,L), and typical GNN models use Glorot Uniform or HeUniform methods for parameter initialization:
[0127] θ GNN ={W (l) :l=1,...,L}
[0128] 3) Multi-task learning model parameter initialization: The model parameters for each task are usually processed separately. Assuming the number of tasks is K, the model parameters for the k-th task are... The parameter initialization method can also use normal distribution random initialization. If the model for the k-th task contains P parameters, the parameter initialization of the multi-task learning model can be expressed as:
[0129] in
[0130] Here W k and b k Let be the weight matrix and bias term in the k-th task model.
[0131] S402. Input data: First, the semantic and sentiment vectors obtained from the word embedding model GloVe are used as input to the BERT model; the resulting feature vectors are used as input to the multi-task learning model and the graph neural network model; specifically as follows:
[0132] There is a set of semantic and sentiment vectors X = [x1, x2, ..., x... n The corresponding label is y = [y1, y2, ..., y]. n If the input is [h1, h2, ..., h], then it is fed into the BERT model to obtain the feature vector H = BERT(X), where H = [h1, h2, ..., h]. n ].
[0133] S403. Model training: Use the learned features H and their corresponding labels y to train the model.
[0134] For a multi-task learning model, there are m tasks, and the loss function for each task is L. i (.), i = 1, 2, ..., m, is the Softmax loss function. The training objective is to minimize the weighted sum of losses for all tasks, i.e.:
[0135]
[0136] Where Θ represents the model parameters, w i Weights for each task;
[0137] For the graph neural network model, the international relations data are first constructed into a graph, and the feature vector of each node is h. i i = 1, 2, ..., N, where N is the number of nodes in the graph. The graph neural network is trained by analyzing the structure of the graph and the characteristics of the nodes.
[0138] In a graph neural network, the forward propagation of each layer is expressed as:
[0139]
[0140] Here, A is the adjacency matrix, D is the degree matrix, H(l) represents the node representation of the l-th layer, W(l) is the weight matrix of the l-th layer, and σ represents the nonlinear activation function;
[0141] S404. Parameter Update: Based on the model's loss, the backpropagation algorithm is used to update the model's parameters. This process is iterated until the model's loss converges.
[0142] S5. Apply the model to the new data to perform predictions and evaluations, including model performance evaluation and result analysis. The predictions and evaluations include:
[0143] (1) For new input data, convert it into a format that the model can accept. This requires the same preprocessing steps as for the training data, including data cleaning, standardization, word segmentation of text data, and transcoding of audio and video data.
[0144] (2) Use the same methods as the training phase to extract features from new data, including semantic and sentiment information.
[0145] (3) Input the extracted features into the trained model to obtain the prediction results. Assuming the model is M and the features are F, the prediction process can be represented as:
[0146] y hat =M(F)
[0147] Among them, y hat It is the result of the model prediction.
[0148] (4) Model evaluation: Measure the predictive performance of the model, including prediction accuracy, recall and F1 score.
[0149] Accuracy is the proportion of correctly classified samples out of the total number of samples. It can be calculated using the following formula:
[0150]
[0151] Here, TP (True Positives) represents the number of positive samples correctly predicted as positive samples, TN (True Negatives) represents the number of negative samples correctly predicted as negative samples, FP (False Positives) represents the number of negative samples incorrectly predicted as positive samples, and FN (False Negatives) represents the number of positive samples incorrectly predicted as negative samples.
[0152] Recall, or sensitivity, is the proportion of positive samples predicted as positive out of all actual positive samples. The formula for calculating recall is:
[0153]
[0154] Precision, or accuracy, is the proportion of correctly predicted positive samples out of all samples predicted as positive. The formula for calculating precision is:
[0155]
[0156] F1 score: This is the harmonic mean of precision and recall. Since there is usually a trade-off between precision and recall, the F1 score can be used for a unified evaluation. The formula for calculating the F1 score is:
[0157] F1=2*Precision*Recall / (Precision+Recall).
[0158] Example 2
[0159] like Figure 5 As shown, a system for sentiment analysis of international relations using machine learning is constructed based on Embodiment 1.
[0160] Data Collection Module: This module's primary function is to collect multimodal data from sources such as news websites, social media, government announcements, and diplomatic meeting minutes. This data includes text, audio, video, and data on international relations interactions. This mechanism captures rich and diverse information, ensuring the breadth and accuracy of the analysis results. Its function is to acquire data from various sources through a programming interface (API) and store this data in a database or file system.
[0161] Data preprocessing module: This module cleans and standardizes the collected data. Specifically, for text data, preprocessing steps such as denoising, stop word removal, stemming, or part-of-speech tagging may be required; for audio and video data, speech recognition may be used to convert it into analyzable text; and for numerical international relations interaction data, standardization and normalization may be necessary. The purpose of data preprocessing is to ensure data quality and accuracy, and to reduce the impact of noisy data on model training.
[0162] Natural Language Processing Module: This module's main function is to extract semantic and sentiment information from text data, such as word frequency, word order, and sentiment scores. It primarily extracts semantic information using word embedding models like GloVe and sentiment information using a sentiment dictionary. These extracted vectorized features then serve as input to the deep learning model.
[0163] Model Building Module: This module is used to build an international relations sentiment analysis model using transfer learning, multi-task learning, and graph neural networks. This leading deep learning strategy can deliver higher prediction accuracy and computational efficiency. This module helps us set the model architecture and parameters according to actual needs and performs initial model compilation.
[0164] Model training module: This module is used to train the model using the extracted features and the constructed model. The model is trained by iteratively updating the model parameters until the model's loss converges.
[0165] Prediction and Evaluation Module: This module applies the trained model to new data for prediction and evaluation. Its function is to receive new input data, convert it into a format acceptable to the model, perform predictions using the trained model, and finally evaluate the model's performance by assessing metrics such as accuracy, recall, and F1 score.
[0166] Example 3:
[0167] The following example, using diplomatic interactions between China and the United States, illustrates the specific implementation process of using machine learning for sentiment analysis in international relations:
[0168] 1. Data Collection: Collect textual data on diplomatic interactions between China and the United States from news websites, social media, and government announcements. For example, the Ministry of Foreign Affairs announcement: "The first phase of the trade agreement reached between China and the United States is of great significance for stabilizing global markets." Simultaneously, collect relevant trade data between China and the United States.
[0169] 2. Data Preprocessing: The collected text data undergoes preprocessing steps such as noise reduction, stop word removal, stemming, and part-of-speech tagging. The resulting text is: "The significance of the first phase trade agreement reached between China and the US in stabilizing the global market."
[0170] 3. Using NLP to process and extract semantic and sentiment information: The transformed text data is segmented into words, and the word embedding model GloVe is used to convert the segments into vectors. For example, "stable" is converted into [0.3, -0.2, 0.4, -0.1, 0.5]. At the same time, the sentiment dictionary method is used to extract sentiment information. If a word is in the sentiment dictionary, its corresponding sentiment score is taken. For example, "stable" has a score of +2 in the sentiment dictionary.
[0171] 4. Construct an international relations sentiment analysis model. First, use a pre-trained BERT model to obtain semantic and sentiment information from the text. Then, input this information into a multi-task learning model and a graph neural network model for processing. By repeatedly propagating and fusing the information in the network, the final sentiment analysis result is obtained.
[0172] 5. Model Training: Initialize the model parameters, and then train the model using the feature vectors and labels obtained above. This process involves calculating the loss function and updating the model parameters.
[0173] 6. Prediction and Evaluation: After model training is complete, new data can be input into the model for sentiment analysis and prediction. For example, new text data: "China and the United States have reached a new trade agreement, and the global market has reacted positively." After model calculation, the prediction result is "friendly".
[0174] Performance evaluation: The model's predictive performance is evaluated, including prediction accuracy, recall, and F1 score. The prediction results on the test dataset are compared with the actual results to derive the model's various performance metrics.
[0175] Those skilled in the art will understand that all or part of the processes in the above embodiments can be implemented by a computer program instructing related hardware. The program can be stored in a computer-readable storage medium, and when executed, it can include the processes of the embodiments of the above methods. The storage medium can be a magnetic disk, optical disk, read-only memory (ROM), or random access memory (RAM), etc.
[0176] It should be understood that the above detailed description of the technical solutions of the present invention with reference to preferred embodiments is illustrative and not restrictive. Those skilled in the art can modify the technical solutions described in the embodiments or make equivalent substitutions for some of the technical features based on reading this specification; however, these modifications or substitutions do not cause the essence of the corresponding technical solutions to depart from the spirit and scope of the technical solutions of the embodiments of the present invention.
Claims
1. A method for sentiment analysis in international relations, characterized by: The method includes: Collect, clean, and standardize multimodal data, including text, audio, video, and international relations interaction data; Natural language processing techniques are used to process and extract semantic and sentiment information from the multimodal data; An international relations sentiment analysis model is constructed using a deep learning model that combines transfer learning, multi-task learning, and graph neural networks. Model training: The constructed international relations sentiment analysis model is trained using extracted semantic and sentiment information. Apply the model to new data for prediction and evaluation, including model performance evaluation and result analysis.
2. The method for international relations sentiment analysis according to claim 1, characterized in that: The collection of multimodal data includes: Collect multimodal data including text, audio, and video from news websites, social media, government announcements, and diplomatic meeting minutes; collect data on interactions between countries, including trade data and diplomatic interaction data; Data preprocessing includes denoising, stop word removal, stemming, and part-of-speech tagging of text data; speech recognition for audio and video data to convert it into text data for analysis; and standardization and normalization for numerical international relations interaction data.
3. The method for international relations sentiment analysis according to claim 1, characterized in that: The process of using natural language processing techniques to process and extract semantic and sentiment information from the multimodal data includes: Semantic information extraction involves first segmenting the text data into words, then using the word embedding model GloVe to convert the segmented words into vectors, which are then input into a deep learning model. Emotional information extraction: Emotional information is extracted using an emotional dictionary.
4. The method for international relations sentiment analysis according to claim 1, characterized in that: The aforementioned construction of an international relations sentiment analysis model includes: (1) Using the transfer learning method, semantic and sentiment information of the text is obtained through the pre-trained semantic model BERT; the obtained semantic and sentiment information is used as features for the next steps; (2) Semantic and sentiment information is fed into a multi-task learning model, and multiple objectives are set according to the actual task, including sentiment prediction and relationship classification. (3) Structure the international relations data into a heterogeneous network and process it using a graph neural network. Nodes represent entities, such as countries and people, and edges represent relationships between entities, such as allies, conflicts, and cooperation. Each layer of the graph neural network is regarded as a process of "information dissemination". Aggregate information on the adjacent nodes of a node. If there are N nodes in the graph, the initial feature representation of each node is X = [x1, x2, ..., x]. N ] T Let the adjacency matrix of the graph be A, and then one information propagation of the GNN can be represented as: X' = σ(A*X*W); Here, "*" represents matrix multiplication, σ is a non-linear activation function such as ReLU, and W is the parameter learned. This process is repeated multiple times, allowing information to continuously propagate and aggregate on the graph. (4) Use the learned features to perform sentiment analysis and predict the interaction attitudes between countries, such as friendliness or conflict; the output of the model is the probability of each type of sentiment, and finally select the sentiment with the highest probability as the prediction result.
5. The method for international relations sentiment analysis according to claim 1, characterized in that: The model training includes: 1) Initialize model parameters, including those for the BERT model, multi-task learning model, and graph neural network model; 2) Input data: First, the semantic and sentiment vectors obtained from the word embedding model GloVe are used as input and fed into the BERT model; the resulting feature vectors are used as input and fed into the multi-task learning model and the graph neural network model; specifically as follows: The extracted semantic and sentiment vectors are X = [x1, x2, ..., x n The corresponding label is y = [y1, y2, ..., y]. n If the input is [h1, h2, ..., h], then it is fed into the BERT model to obtain the feature vector H = BERT(X), where H = [h1, h2, ..., h]. n ]; 3) Model training: The learned features H and their corresponding labels y are used to train the model. For a multi-task learning model, there are m tasks, and the loss function for each task is L. i (.), i = 1, 2, ..., m, is the Softmax loss function. The training objective is to minimize the weighted sum of losses for all tasks, i.e.: Where Θ represents the model parameters, w i Weights for each task; For the graph neural network model, the international relations data are first constructed into a graph, and the feature vector of each node is h. i i = 1, 2, ..., N, where N is the number of nodes in the graph. The graph neural network is trained by analyzing the structure of the graph and the characteristics of the nodes. In a graph neural network, the forward propagation of each layer is expressed as: Here, A is the adjacency matrix, D is the degree matrix, H(l) represents the node representation of the l-th layer, W(l) is the weight matrix of the l-th layer, and σ represents the nonlinear activation function; 4) Parameter update: Based on the model's loss, the backpropagation algorithm is used to update the model's parameters. This process is iterated until the model's loss converges.
6. The method for international relations sentiment analysis according to claim 1, characterized in that: The predictions and assessments include: For new input data, convert it into a format that the model can accept; Use the same methods as in the training phase to extract features from new data, including semantic and sentiment information; The extracted features are input into the trained model to obtain the prediction results; Model evaluation: Measures the predictive performance of the model, including prediction accuracy, recall, and F1 score.
7. The method for international relations sentiment analysis according to claim 3, characterized in that: The sentiment information extraction is as follows: Text T contains n words, where the sentiment score of the i-th word is s(i). If the word is in the sentiment dictionary, then s(i) takes the corresponding score of the word in the sentiment dictionary; otherwise, s(i) is 0. Therefore, the sentiment score S(T) of text T is expressed as: The sentiment score of a text is calculated using a sentiment lexicon, thereby reflecting the text's sentiment orientation.
8. A system for sentiment analysis of international relations using machine learning, wherein the system is applicable to the method as described in any one of claims 1-7, characterized in that: The system includes: The data collection module gathers multimodal data from news websites, social media, government announcements, and diplomatic meeting minutes, including text, audio, video, and international relations interaction data; the data preprocessing module cleans and standardizes the collected multimodal data; and the natural language processing module extracts semantic and sentiment information from the data. The model building module uses transfer learning, multi-task learning, and graph neural networks to construct an international relations sentiment analysis model. The model training module uses the extracted features and the constructed model for training. The prediction and evaluation module applies the trained model to new data to perform predictions and evaluations.
9. A device, characterized in that: It includes a processor and a memory, the memory storing computer-readable instructions that, when executed by the processor, implement the method for sentiment analysis of international relations using machine learning as described in any one of claims 1 to 7.
10. A computer medium, characterized in that: It stores a computer program that, when executed by a processor, implements the method for conducting international relations sentiment analysis using machine learning as described in any one of claims 1 to 7.