Public opinion prediction method and system based on long and short memory neural network

By applying the long-term and short-term memory neural network (LSTM) model in public opinion prediction, the problems of low feature extraction efficiency and poor accuracy in the existing technology are solved, and more efficient and accurate public opinion prediction is achieved.

CN119918712APending Publication Date: 2025-05-02JINGGANGSHAN UNIVERSITY
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202411692858.9
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-11-25
Publication Date
2025-05-02

AI Technical Summary

Technical Problem

When predicting the spread of social media public opinion, the prior art relies on artificial construction of features, resulting in low feature extraction efficiency, poor accuracy and long time-consuming.

Method used

The public opinion prediction method based on long-term memory neural network (LSTM) is adopted, and through data collection, preprocessing, feature extraction and modeling, the LSTM model is used to capture the long-term dependencies in time series data and conduct public opinion prediction.

Benefits of technology

Effectively capture long-term dependencies in time series data, improve the accuracy and efficiency of public opinion prediction, and reduce the time and resource consumption of manual feature extraction.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119918712A_ABST
    Figure CN119918712A_ABST
Patent Text Reader

Abstract

The invention belongs to the technical field of public opinion prediction, and particularly relates to a public opinion prediction method and system based on a long and short memory neural network, and the method comprises the steps: S1, data collection, S2, data preprocessing, S3, feature extraction, S4, modeling and prediction, S5, prediction evaluation, model performance evaluation through indexes such as accuracy, recall rate, F1-score and the like, classification effect visualization by using a confusion matrix, and cross validation. The stability and generalization ability of the model are ensured by using a K-fold cross validation method and the like, the sentiment tendency and attitude change process of the public to specific events, topics or brands is predicted by using a data analysis technology, the long-term dependency relationship in time sequence data can be effectively captured, the characteristics of dynamic change of public opinions are adapted, and the method is suitable for popularization and application. Adjustment and optimization are carried out in combination with actual conditions in the implementation process, individuals and organizations are helped to better understand and cope with public opinion changes through effective data analysis and prediction technologies, and the accuracy and efficiency of public opinion prediction are improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the technical field of public opinion prediction, and in particular to a public opinion prediction method and system based on a long short-term memory neural network. Background Art

[0002] With the rapid development of smart mobile devices and the Internet in recent years, online social media has become the main tool for information dissemination in the current society. Unlike traditional media such as newspapers and television, the threshold for information release on social platforms is low. Users can easily share their views and opinions, and other users can comment on and forward the information. Such interaction makes the information on social platforms spread faster than traditional media.

[0003] The spread of public opinion in social media is to predict the future spread of information based on the law of dissemination. It is a hot topic in current research. In addition, predicting the spread of information can help the government monitor and control public opinion in a timely manner. After capturing hot information, it is easy to further judge the authenticity of the information. If it is false or deliberately incited by certain groups, it can be quickly stopped after monitoring. Therefore, facing the massive amount of content generated daily in social networks, how to accurately detect topics and predict the spread of public opinion has become an important research topic;

[0004] Traditional prediction models are mostly based on feature extraction methods. This method extracts various relevant features of events, such as user features, content features, time series features, and structural features. After manually extracting features, this type of method verifies its effectiveness through experiments and obtains some features that are effective for information popularity prediction tasks. However, when constructing features manually, it is often based on experience, which means that some features can only achieve good results under specific data and scenarios. In addition, manual feature extraction requires a lot of time, which will result in a large consumption of manpower and resources, and the extraction accuracy is poor. Summary of the invention

[0005] The purpose of this section is to summarize some aspects of the embodiments of the present invention and briefly introduce some preferred embodiments. Some simplifications or omissions may be made in this section and the specification abstract and the invention title of this application to avoid blurring the purpose of this section, the specification abstract and the invention title, and such simplifications or omissions cannot be used to limit the scope of the present invention.

[0006] Therefore, the purpose of the present invention is to provide a public opinion prediction method and system based on long short-term memory neural network, which uses data analysis technology to predict the public's emotional tendencies and attitude changes towards specific events, topics or brands. It can effectively capture the long-term dependencies in time series data, adapt to the characteristics of dynamic changes in public opinion, and make adjustments and optimizations in combination with actual conditions during implementation. Through effective data analysis and prediction technology, it helps individuals and organizations better understand and respond to changes in public opinion and improves the accuracy and efficiency of public opinion prediction.

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

[0008] The public opinion prediction method and system based on long short-term memory neural network includes the following steps:

[0009] S1. Data collection:

[0010] Data source: Obtain relevant text, voice and video data through social media, news websites, and forum channels:

[0011] API crawling: Use API interfaces to crawl data and extract data from web pages through crawler technology;

[0012] S2. Data preprocessing:

[0013] Cleaning: remove irrelevant information, duplicate data, and noise, such as HTML tags and punctuation marks;

[0014] Word segmentation and encoding: Segment the text, convert the text into a sequence of words, and use word embedding technology such as Word2Vec and GloVe to convert the words into vectors;

[0015] S3. Feature extraction:

[0016] Sentiment analysis: Use sentiment lexicon and machine learning algorithms, such as support vector machine and naive Bayes, to classify the sentiment of text, speech and video, including positive, negative and neutral;

[0017] Topic modeling: using algorithms such as LDA to identify the main topics in the data and extract potential features;

[0018] S4. Modeling and prediction:

[0019] Traditional machine learning: Use traditional machine learning models, such as logistic regression, decision trees, and random forests, to predict public opinion;

[0020] Deep learning: Apply the LSTM recurrent neural network model to capture dependencies in time series data;

[0021] Ensemble learning: Combining multiple models, such as Boosting and Bagging, to improve prediction accuracy;

[0022] S5. Prediction and evaluation:

[0023] Model evaluation: Evaluate model performance through indicators such as accuracy, recall, and F1-score, and use confusion matrix to visualize classification results:

[0024] Cross-validation: Use methods such as K-fold cross-validation to ensure the stability and generalization ability of the model.

[0025] As a preferred solution of the public opinion prediction method based on long short-term memory neural network described in the present invention, wherein: in the step S4, the LSTM model modeling includes a forget gate, an input gate, a unit state update and an output gate.

[0026] As a preferred solution of the public opinion prediction method based on long short-term memory neural network described in the present invention, the forget gate determines how much information from the previous time step is retained:

[0027] Input, current x t and the previous hidden state h t-1 ;

[0028] Output, a value between 0 and 1, 1 means completely retained, 0 means completely discarded;

[0029] f t =σ(W f ·[h t-1 ,x t ]+b f )1).

[0030] As a preferred solution of the public opinion prediction method based on long short-term memory neural network described in the present invention, wherein: the input gate determines how much new information is stored in the unit state;

[0031] Input, current input x t and the previous hidden state h t-1 ;

[0032] It consists of two parts: one for determining the update ratio and the other for generating new candidate values;

[0033] i t =σ(W i ·[h i-1 ,x t ]+b i )2);

[0034]

[0035] As a preferred solution of the public opinion prediction method based on long short-term memory neural network described in the present invention, wherein: the unit state update combines the forget gate and the input gate to update the unit state C t ;

[0036]

[0037] As a preferred solution of the public opinion prediction method based on long short-term memory neural network described in the present invention, wherein: the output gate determines the output of the current unit;

[0038] Input, current input x t and the previous hidden state h t-1 ;

[0039] Output, generate a new hidden state h based on the cell state t ;

[0040] o t =σ(W o ·[h t-1 ,x t ]+b o ) 5);

[0041] h t =o t tanh(C t ) 6).

[0042] As a preferred solution of the public opinion prediction method based on long short-term memory neural network described in the present invention, the LSTM recurrent neural network model includes the following actions:

[0043] Information flow: At each time step, LSTM controls the flow of information through the forget gate, input gate, and output gate;

[0044] State update: LSTM maintains two states, cell state C t and the hidden state h t , the cell state is responsible for storing information, while the hidden state is used for output;

[0045] Sequence processing: When LSTM processes sequence data, it makes more accurate predictions based on historical information.

[0046] The public opinion prediction system based on long short-term memory neural network includes the following modules:

[0047] Data collection module: responsible for capturing data from multiple channels in real time and storing it in the database;

[0048] Data processing module: cleaning, word segmentation, feature extraction and other processing of the collected data;

[0049] Analysis and modeling module: Use machine learning or deep learning models to analyze and predict public opinion;

[0050] Visualization module: provides a visualization interface for public opinion monitoring results, including sentiment trends, public opinion hotspots, etc.;

[0051] Early warning system: Send public opinion early warning notifications in a timely manner based on the set thresholds.

[0052] Compared with the prior art, the present invention has the following beneficial effects:

[0053] Using data analysis technology to predict the public's emotional tendencies and attitude changes towards specific events, topics or brands can effectively capture the long-term dependencies in time series data, adapt to the characteristics of dynamic changes in public opinion, and make adjustments and optimizations based on actual conditions during implementation. Through effective data analysis and prediction technology, it can help individuals and organizations better understand and respond to changes in public opinion and improve the accuracy and efficiency of public opinion prediction. BRIEF DESCRIPTION OF THE DRAWINGS

[0054] In order to more clearly illustrate the technical solutions of the embodiments of the present invention, the present invention will be described in detail below in combination with the accompanying drawings and detailed embodiments. Obviously, the drawings described below are only some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without creative labor. Among them:

[0055] Figure 1 This is a schematic diagram of the structure of the public opinion prediction step of the present invention;

[0056] Figure 2 This is a structural diagram of the LSTM recurrent neural network model of the present invention. DETAILED DESCRIPTION

[0057] In order to make the above-mentioned objects, features and advantages of the present invention more obvious and easy to understand, the specific embodiments of the present invention are described in detail below with reference to the accompanying drawings.

[0058] In the following description, many specific details are set forth to facilitate a full understanding of the present invention, but the present invention may also be implemented in other ways different from those described herein, and those skilled in the art may make similar generalizations without violating the connotation of the present invention. Therefore, the present invention is not limited to the specific embodiments disclosed below.

[0059] Secondly, the present invention is described in detail with reference to schematic diagrams. When describing the embodiments of the present invention in detail, for the sake of convenience, the cross-sectional diagrams showing the device structure will not be partially enlarged according to the general scale, and the schematic diagrams are only examples, which should not limit the scope of protection of the present invention. In addition, in actual production, the three-dimensional dimensions of length, width and depth should be included.

[0060] To make the objectives, technical solutions and advantages of the present invention more clear, the embodiments of the present invention will be further described in detail below with reference to the accompanying drawings.

[0061] The present invention provides a public opinion prediction method and system based on a long short-term memory neural network, comprising the following steps:

[0062] S1. Data collection:

[0063] Data source: Obtain relevant text, voice and video data through social media, news websites, and forum channels:

[0064] API crawling: Use API interfaces to crawl data and extract data from web pages through crawler technology;

[0065] S2. Data preprocessing:

[0066] Cleaning: remove irrelevant information, duplicate data, and noise, such as HTML tags and punctuation marks;

[0067] Word segmentation and encoding: Segment the text, convert the text into a sequence of words, and use word embedding technology such as Word2Vec and GloVe to convert the words into vectors;

[0068] S3. Feature extraction:

[0069] Sentiment analysis: Use sentiment lexicon and machine learning algorithms, such as support vector machine and naive Bayes, to classify the sentiment of text, speech and video, including positive, negative and neutral;

[0070] Topic modeling: using algorithms such as LDA to identify the main topics in the data and extract potential features;

[0071] S4. Modeling and prediction:

[0072] Traditional machine learning: Use traditional machine learning models, such as logistic regression, decision trees, and random forests, to predict public opinion;

[0073] Deep learning: Apply the LSTM recurrent neural network model to capture dependencies in time series data;

[0074] Ensemble learning: Combining multiple models, such as Boosting and Bagging, to improve prediction accuracy;

[0075] S5. Prediction and evaluation:

[0076] Model evaluation: Evaluate model performance through indicators such as accuracy, recall, and F1-score, and use confusion matrix to visualize classification results:

[0077] Cross-validation: Use methods such as K-fold cross-validation to ensure the stability and generalization ability of the model;

[0078] In step S4, the LSTM model modeling includes a forget gate, an input gate, a unit state update and an output gate.

[0079] The forget gate determines how much information from the previous time step to retain:

[0080] Input, current x t and the previous hidden state h t-1 ;

[0081] Output, a value between 0 and 1, 1 means completely retained, 0 means completely discarded;

[0082] f t =σ(W f ·[h t-1 ,x t ]+b f )1)

[0083] The input gate determines how much new information is stored in the cell state;

[0084] Input, current input x t and the previous hidden state h t-1 ;

[0085] It consists of two parts: one for determining the update ratio and the other for generating new candidate values;

[0086] i t =σ(W i ·[h i-1 ,x t ]+b i )2)

[0087]

[0088] The cell state is updated by combining the forget gate and the input gate to update the cell state C t ;

[0089]

[0090] The output gate determines the output of the current unit;

[0091] Input, current input x t and the previous hidden state h t-1 ;

[0092] Output, generate a new hidden state h based on the cell state t ;

[0093] o t =σ(W o ·[h t-1 ,x t ]+b o ) 5)

[0094] h t =o t tanh(C t ) 6)

[0095] The LSTM recurrent neural network model includes the following actions:

[0096] Information flow: At each time step, LSTM controls the flow of information through the forget gate, input gate, and output gate;

[0097] State update: LSTM maintains two states, cell state C t and the hidden state h t , the cell state is responsible for storing information, while the hidden state is used for output;

[0098] Sequence processing: When LSTM processes sequence data, it makes more accurate predictions based on historical information.

[0099] The public opinion prediction system based on long short-term memory neural network includes the following modules:

[0100] Data collection module: responsible for capturing data from multiple channels in real time and storing it in the database;

[0101] Data processing module: cleaning, word segmentation, feature extraction and other processing of the collected data;

[0102] Analysis and modeling module: Use machine learning or deep learning models to analyze and predict public opinion;

[0103] Visualization module: provides a visualization interface for public opinion monitoring results, including sentiment trends, public opinion hotspots, etc.;

[0104] Early warning system: Send public opinion early warning notifications in a timely manner according to the set thresholds;

[0105] Using data analysis technology to predict the public's emotional tendencies and attitude changes towards specific events, topics or brands can effectively capture the long-term dependencies in time series data, adapt to the characteristics of dynamic changes in public opinion, and make adjustments and optimizations based on actual conditions during implementation. Through effective data analysis and prediction technology, it can help individuals and organizations better understand and respond to changes in public opinion and improve the accuracy and efficiency of public opinion prediction.

[0106] Although the present invention has been described above with reference to the embodiments, various modifications may be made thereto and parts thereof may be replaced by equivalents without departing from the scope of the present invention. In particular, as long as there is no structural conflict, the various features in the embodiments disclosed in the present invention may be used in combination with each other in any manner, and the fact that these combinations are not exhaustively described in this specification is only for the sake of omitting space and saving resources. Therefore, the present invention is not limited to the specific embodiments disclosed herein, but includes all technical solutions falling within the scope of the claims.

Claims

1. The public opinion prediction method based on long short-term memory neural network is characterized by: The steps include: S1. Data collection: Data source: Obtain relevant text, voice and video data through social media, news websites, and forum channels: API crawling: Use API interfaces to crawl data and extract data from web pages through crawler technology; S2. Data preprocessing: Cleaning: remove irrelevant information, duplicate data, and noise, such as HTML tags and punctuation marks; Word segmentation and encoding: Segment the text, convert the text into a sequence of words, and use word embedding technology such as Word2Vec and GloVe to convert the words into vectors; S3. Feature extraction: Sentiment analysis: Use sentiment lexicon and machine learning algorithms, such as support vector machine and naive Bayes, to classify the sentiment of text, speech and video, including positive, negative and neutral; Topic modeling: using algorithms such as LDA to identify the main topics in the data and extract potential features; S4. Modeling and prediction: Traditional machine learning: Use traditional machine learning models, such as logistic regression, decision trees, and random forests, to predict public opinion; Deep learning: Apply the LSTM recurrent neural network model to capture dependencies in time series data; Ensemble learning: Combining multiple models, such as Boosting and Bagging, to improve prediction accuracy; S5. Prediction and evaluation: Model evaluation: Evaluate model performance through indicators such as accuracy, recall, and F1-score, and use confusion matrix to visualize classification results: Cross-validation: Use methods such as K-fold cross-validation to ensure the stability and generalization ability of the model.

2. The method for public opinion prediction based on long short-term memory neural network according to claim 1 is characterized in that: In step S4, the LSTM model modeling includes a forget gate, an input gate, a unit state update and an output gate.

3. The method for public opinion prediction based on long short-term memory neural network according to claim 2 is characterized in that: The forget gate determines how much information from the previous time step is retained: Input, current x t and the previous hidden state h t-1 ; Output, a value between 0 and 1, 1 means completely retained, 0 means completely discarded; f t =σ(W f ·[h t-1 ,x t ]+b f )1)。 4. The method for public opinion prediction based on long short-term memory neural network according to claim 3 is characterized in that: The input gate determines how much new information is stored in the cell state; Input, current input x t and the previous hidden state h t-1 ; It consists of two parts: one for determining the update ratio and the other for generating new candidate values; i t =σ(W i ·[h i-1 ,x t ]+b i )2); 5. The method for public opinion prediction based on long short-term memory neural network according to claim 4 is characterized in that: The cell state is updated by combining the forget gate and the input gate to update the cell state C t ; 6. The method for public opinion prediction based on long short-term memory neural network according to claim 5 is characterized in that: The output gate determines the output of the current unit; Input, current input x t and the previous hidden state h t-1 ; Output, generate a new hidden state h based on the cell state t ; the t =σ(W o ·[h t-1 ,x t ]+b o )5); h t =o t ·tanh(C t )6)。 7. The method for public opinion prediction based on long short-term memory neural network according to claim 6 is characterized in that: The LSTM recurrent neural network model includes the following actions: Information flow: At each time step, LSTM controls the flow of information through the forget gate, input gate, and output gate; State update: LSTM maintains two states, cell state C t and the hidden state h t , the cell state is responsible for storing information, while the hidden state is used for output; Sequence processing: When LSTM processes sequence data, it makes more accurate predictions based on historical information.

8. The public opinion prediction system based on long short-term memory neural network is characterized by: Includes the following modules: Data collection module: responsible for capturing data from multiple channels in real time and storing it in the database; Data processing module: cleaning, word segmentation, feature extraction and other processing of the collected data; Analysis and modeling module: Use machine learning or deep learning models to analyze and predict public opinion; Visualization module: provides a visualization interface for public opinion monitoring results, including sentiment trends, public opinion hotspots, etc.; Early warning system: Send public opinion early warning notifications in a timely manner based on the set thresholds.