Public opinion heat prediction method based on lightweight ensemble model

By deploying lightweight integrated models on the server and browser respectively, the problems of insufficient prediction accuracy and network delay in public opinion heat prediction are solved, public opinion heat prediction with high real-time and data security is achieved, and user experience and system adaptability are improved.

CN119047645BActive Publication Date: 2025-09-26SICHUAN JIUZHOU SOFTWARE CO LTD
View PDF 1 Cites 0 Cited by

Patent Information

Application Number
CN202411199383.X
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2024-08-29
Publication Date
2025-09-26
Estimated Expiration
2044-08-29

AI Technical Summary

Technical Problem

Existing technologies have problems with public opinion heat prediction, such as insufficient prediction accuracy, network latency, and data privacy and security issues. It is especially difficult to achieve high real-time and high-precision predictions in resource-constrained browser environments.

Method used

A lightweight integrated model is adopted, and the model is deployed on the server and browser respectively. The powerful computing power of the server is used for training, and the lightweight model is deployed on the browser to realize localized reasoning of the model and ensure uniformity and consistency in different environments.

Benefits of technology

It improves the response speed of the prediction system, meets high real-time requirements, reduces data transmission risks, enhances the privacy and security protection of user data, and improves the adaptability and flexibility of the system.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119047645B_ABST
    Figure CN119047645B_ABST
Patent Text Reader

Abstract

The present invention discloses a method for predicting the heat of public opinion based on a lightweight integrated model, comprising the steps of: constructing a public opinion heat prediction model based on a recurrent neural network; deploying the public opinion heat prediction model to a server side and a browser side respectively through a deep learning framework to obtain a complete prediction model and a lightweight integrated model; completing the training of the complete prediction model using a training set, and loading the model parameters of the trained complete prediction model into the lightweight integrated model; obtaining the public opinion data to be predicted, inputting the complete prediction model or the lightweight integrated model, and obtaining the public opinion heat prediction result. By deploying a lightweight public opinion heat prediction model on the browser side, the present invention realizes localized reasoning of the model, avoids the network delay problem caused by relying on the server side for real-time prediction, significantly improves the response speed of the prediction system, meets the needs of high real-time application scenarios, and reduces the need to transmit user data to the server side.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of big data processing technology, and in particular to a method for predicting public opinion heat based on a lightweight integrated model. Background Art

[0002] In an era of information explosion, with the rapid development of social media, news media, and other digital platforms, public interest in various events, topics, and entities is growing. Public opinion intensity has become a key indicator for measuring this level of attention, and its accurate prediction is of great significance to government agencies, businesses, news media, and social media platforms. Accurate public opinion intensity prediction not only helps relevant organizations stay informed of social hot topics but also provides strong support for policymaking, brand management, and marketing.

[0003] Traditional methods for predicting the impact of public opinion heat mainly rely on statistical analysis or shallow machine learning models. These methods often perform poorly when dealing with high-dimensional data or complex nonlinear relationships, resulting in insufficient prediction accuracy and difficulty meeting the needs of practical applications. In recent years, with the rapid development of deep learning technology, its powerful feature extraction and model generalization capabilities have been widely used in public opinion heat prediction, especially in the field of natural language processing (NLP), where models based on the Transformer framework have demonstrated excellent performance. However, these deep learning models typically require large amounts of training data and computing resources, which are difficult to implement in many practical application scenarios, especially in resource-constrained environments.

[0004] In order to avoid network latency issues and improve real-time response capabilities, public opinion heat prediction models often need to be deployed in the client's browser to achieve localized reasoning of the model. However, due to the limited computing power of the browser, it is obviously unable to support the training of complex models. Therefore, existing technologies usually choose to deploy the prediction model on the server side, relying on communication between the browser and the server to obtain prediction results. On the one hand, this traditional deployment method is susceptible to network latency or network instability, resulting in reduced response speed, unable to meet high real-time application requirements, and may reduce the user experience; on the other hand, transmitting data to the server for processing may cause data privacy and security issues. In particular, when processing sensitive information, there is a risk of user data being intercepted or leaked during transmission. Summary of the Invention

[0005] To address the shortcomings of the aforementioned prior art, the present invention aims to provide a method for predicting public opinion heat based on a lightweight integrated model. By deploying the model on both the server and browser sides, combining the advantages of both, the method leverages the powerful computing power of the server side for efficient model training, while also achieving flexible real-time prediction capabilities by deploying the lightweight model on the browser side. The model parameters trained on the server side can be directly loaded into the browser side, ensuring the uniformity and consistency of the model across multiple terminals, and meeting the multiple requirements for prediction accuracy and real-time performance in different application scenarios.

[0006] In order to achieve the above-mentioned object of the invention, the technical solution provided by the present invention includes:

[0007] The method for predicting the heat of public opinion based on a lightweight integrated model includes the following steps:

[0008] Constructing a public opinion heat prediction model based on a recurrent neural network, the public opinion heat prediction model includes several parallel basic networks and a multi-head attention layer that converts the output of the basic network into a two-dimensional matrix form as input;

[0009] The public opinion heat prediction model is deployed to the server and browser respectively through a deep learning framework to obtain a complete prediction model and a lightweight integrated model;

[0010] Use the training set to complete the training of the complete prediction model, and load the model parameters of the trained complete prediction model into the lightweight integrated model;

[0011] Obtain the public opinion data to be predicted, input the complete prediction model or lightweight integrated model, and obtain the public opinion heat prediction results.

[0012] Preferably, the basic network includes several groups of basic models whose structural complexity is proportional to the length of the time window during data extraction, and the basic models with the same time window length have the same structure.

[0013] Preferably, the method of converting the output of the basic network into a two-dimensional matrix form includes:

[0014] The basic network includes N groups of basic models for N time window lengths, each group includes M basic models; the output of the basic network is constructed as an M×N two-dimensional matrix.

[0015] Preferably, the method of inputting the two-dimensional matrix into the multi-head attention layer includes: performing a linear transformation on the two-dimensional matrix, converting it into a query matrix, a key matrix and a value matrix respectively, and inputting them into the multi-head attention layer.

[0016] Preferably, the training set and the public opinion data to be predicted need to be preprocessed after being obtained, and the preprocessing method includes:

[0017] Store the data to be processed in chronological order;

[0018] Dividing the data to be processed by topic popularity to obtain x sets of first data sets for x topics; the characteristic data of the first data sets include: the number of forwarding, commenting, likes, reading, number of entities associated with the topic, number of favorites, and number of media;

[0019] The data in the first data set are divided into a number of time windows to obtain y pieces of first data; the label of the data in each time window is the label of the next time step after the last time step of the current time window.

[0020] Preferably, the deployment method of the entire prediction model and the lightweight integration model includes:

[0021] The public opinion heat prediction model is deployed to the server side through the Tensorflow framework to obtain a complete prediction model; the public opinion heat prediction model is deployed to the browser side through the Tensorflow.js framework to obtain a lightweight integrated model; the complete prediction model and the lightweight integrated model have the same structure.

[0022] Beneficial effects

[0023] 1. The present invention realizes localized reasoning of the model by deploying a lightweight public opinion heat prediction model on the browser side, avoids the network delay problem caused by relying on the server side for real-time prediction, significantly improves the response speed of the prediction system, meets the needs of high real-time application scenarios, reduces the need to transmit user data to the server side, thereby reducing the risk of interception or leakage of data during transmission, enhances the privacy and security protection of user data, and avoids the response delay problem caused by network instability, ensuring that users can obtain timely feedback during use, thereby significantly improving the user experience.

[0024] 2. The present invention has good portability. By deploying models of the same structure on the server side and the browser side respectively, the unified application of the model on multiple terminals is realized, so that the system can run efficiently in different scenarios, enhancing the adaptability and flexibility of the system. BRIEF DESCRIPTION OF THE DRAWINGS

[0025] Figure 1 This is a flow chart of a method for predicting the heat of public opinion based on a lightweight integrated model in a preferred embodiment of the present invention;

[0026] Figure 2 This is a schematic diagram of the relationship between various models and the signal transmission direction in the public opinion heat prediction method based on a lightweight integrated model in a preferred embodiment of the present invention;

[0027] Figure 3 Schematic diagram of the structure of a public opinion heat prediction model in another preferred embodiment of the present invention; DETAILED DESCRIPTION

[0028] In order to make the objectives, technical solutions and advantages of the present invention more clear, the present invention is further described below with reference to the accompanying drawings. In the description of the present invention, it should be understood that the terms "upper", "lower", "front", "back", "left", "right", "top", "bottom", "inner", "outer", etc., indicating directions or positional relationships, are based on the directions or positional relationships shown in the accompanying drawings and are only for the convenience of describing the present invention and simplifying the description. They do not indicate or imply that the devices or components referred to must have a specific direction, be constructed and operate in a specific direction. Therefore, they should not be understood as limiting the present invention.

[0029] Example

[0030] like Figure 1-Figure 2 As shown, this embodiment provides a method for predicting the popularity of public opinion based on a lightweight integrated model, including the following steps:

[0031] S1. Construct a public opinion heat prediction model based on a recurrent neural network. The public opinion heat prediction model includes several parallel basic networks and a multi-head attention layer that converts the output of the basic network into a two-dimensional matrix form as input.

[0032] The Recurrent Neural Network (RNN) is an artificial neural network structure used to process sequence data. This series of networks includes basic RNN (Recurrent Neural Network), Long Short-Term Memory (LSTM) and Gated Recurrent Unit (GRU) network structures. Since this type of network has great advantages in processing time series, this invention uses it as the basis, such as Figure 3 As shown, the present invention does not further limit the specific type to be selected, but in order to achieve the purpose of the present invention, the public opinion heat prediction model needs to include several parallel basic networks and a multi-head attention layer that converts the output of the basic network into a two-dimensional matrix form as input.

[0033] In this embodiment, in order to effectively extract data features when processing time windows of different lengths, the design of the basic network needs to flexibly adapt to changes in the length of the time window. Therefore, in some preferred embodiments, the basic network comprises several groups of basic models whose structural complexity is proportional to the length of the time window during data extraction, that is, the longer the time window, the more complex the structure of the basic model. The basic models with the same time window length have the same structure. Specifically, the structural complexity of the basic model is mainly reflected in hyperparameters such as the number of network layers and the number of hidden nodes. For the basic models that process the same time window length, their structural design is unified to ensure that the model can extract data features stably and efficiently under a specific time window length. At the same time, since the data features corresponding to different time window lengths have different complexities and information volumes, the basic model needs to be adjusted based on these differences to ensure prediction accuracy throughout the entire data processing process.

[0034] A key advantage of this design is that it can adapt to different data processing requirements by adjusting the complexity of the base model, thereby avoiding unnecessary computational overhead while maintaining high prediction accuracy. This not only improves the flexibility and adaptability of the model, but also makes it more suitable for application in resource-constrained environments. In addition, this basic network composed of multiple groups of base models also has good scalability. When faced with new data features or changing time window requirements, optimization can be achieved by adjusting or increasing the number of groups or complexity of the base model without significantly modifying the entire network structure.

[0035] When processing data in time windows of varying lengths, the outputs of the base network may have different shapes. To unify these outputs and facilitate input into the multi-head attention layer, the outputs of the base network are considered to be converted into a two-dimensional matrix. In some preferred embodiments, considering that data features are extracted across time windows of varying lengths, a preferred two-dimensional matrix conversion method is provided. Specifically, the base network comprises N groups of base models for N different time window lengths. Each group of base models specializes in processing a time window of a specific length to capture data features within that time window length. Each group of base models comprises M base models with the same network structure. The outputs of the base network are constructed as an M x N two-dimensional matrix. In this matrix, each row (M) represents the output of a group of base models, and each column (N) corresponds to the feature extraction results for different time window lengths. Specifically, each row of the matrix contains the outputs of the same group of base models for different time windows, while each column contains the outputs of different groups of base models for the same time window length. This arrangement ensures that the feature information contained in the matrix is ​​comprehensive and representative.

[0036] Furthermore, in order to match the characteristics of the multi-head attention layer, some preferred embodiments also provide a method for inputting the two-dimensional matrix into the multi-head attention layer, specifically comprising: performing a linear transformation on the two-dimensional matrix, converting it into a query matrix, a key matrix, and a value matrix, respectively, and inputting them into the multi-head attention layer. The linear transformation can be achieved through matrix multiplication, that is, applying different weight matrices to the two-dimensional matrix to generate a new feature representation. The purpose of this process is to map the input two-dimensional matrix to a higher-dimensional space in order to better capture the important features in the data.

[0037] The query matrix (Q) is used to determine the target features that need to be paid attention to in the attention mechanism. The key matrix (K) contains the feature representation of each input element and is used to match it with the query matrix to calculate the relevance. The value matrix (V) stores the feature information that needs to be transmitted and is weighted by the attention weight to obtain the final output. The above matrix is ​​input into the multi-head attention layer, and the importance of each element is calculated through dot product operation and weighted summation to generate the final attention weight.

[0038] Those skilled in the art will appreciate that after the multi-head attention layer processing, the model typically requires further processing via stacking and normalization components and feedforward network layers to produce the final feature output. During this process, the output of the multi-head attention layer is superimposed with the original input via a skip connection and then subjected to normalization (e.g., Layer Norm) to ensure model stability and efficient training. After these processing steps, the key information in the feature output is further enhanced, while noise or unimportant features are effectively suppressed, allowing the model to focus more on the most valuable parts of the data. Next, the feature output passes through a feedforward network layer (typically comprising one or more fully connected layers) to further extract and combine high-order features, enhancing the model's predictive capabilities. Finally, the processed feature output is processed using an activation function (e.g., ReLU, Swish, etc.) to introduce nonlinear factors, enabling the model to capture more complex feature relationships. The choice of activation function can be adjusted based on specific application requirements to optimize model performance. After these processing steps, the model ultimately generates a prediction result. Those skilled in the art can design the specific structure and parameter configuration of the output component based on their existing technical knowledge and specific application scenarios. The present invention does not further limit the design of the output part, and allows flexible adjustment to adapt to different needs and conditions.

[0039] S2. Deploy the public opinion heat prediction model to the server and browser respectively through a deep learning framework to obtain a complete prediction model and a lightweight integrated model.

[0040] A deep learning framework refers to a software tool or library used to design, train, and deploy deep learning models. These frameworks provide a series of predefined functions, modules, and APIs, allowing developers to efficiently build complex neural network models without having to implement underlying mathematical operations or optimization algorithms from scratch. In the present invention, the deployment of the public opinion heat prediction model mainly considers cross-platform deployment capabilities, that is, deploying the same model architecture in different computing environments. On the server side, its powerful computing power is used to process large-scale data and perform complex training tasks; on the browser side, it is necessary to run a lightweight model to achieve real-time reasoning and localized computing, avoiding network delays. In some preferred embodiments, it is considered to deploy the public opinion heat prediction model to the server side through the Tensorflow framework to obtain a complete prediction model; and to deploy the public opinion heat prediction model to the browser side through the Tensorflow.js framework to obtain a lightweight integrated model; the structures of the complete prediction model and the lightweight integrated model are the same. Among them, TensorFlow and TensorFlow.js are deep learning frameworks developed and maintained by Google, and the two have good compatibility. TensorFlow can perform efficient model training on the server side, while TensorFlow.js allows model reasoning on the browser side. Specifically, TensorFlow.js provides an API specifically optimized for the JavaScript environment, which can directly load models trained by TensorFlow and perform reasoning operations in the browser, which is very important for applications that require real-time response on the client side. This seamless cross-platform support enables the model to be deployed and run in a variety of environments, meeting the requirements of the present invention for multi-terminal applications. It should be understood that the present invention can also use other deep learning frameworks such as PyTorch and MXNet to implement this step, and its specific framework selection and implementation method can be reasonably designed by those skilled in the art based on its user manual and the purpose of the present invention.

[0041] S3. Complete the training of the complete prediction model using the training set, and load the model parameters of the trained complete prediction model into the lightweight integrated model.

[0042] The training of various models in the present invention can be carried out in accordance with the existing technology in the field, and the present invention has no intention of further limiting the training process. Those skilled in the art will know that the key prerequisite for model training is the preparation of the training set. In some preferred embodiments, in order to better collect training data that meets the characteristics of public opinion prediction and ensure effective preliminary screening of the data to be predicted in practical applications, the following example of a training set processing method is proposed. It should be pointed out that the data processing method proposed below is not only applicable to the preparation of training sets, but also to the preparation of data to be predicted. Therefore, the subsequent description will no longer distinguish between the processing processes of training sets and data to be predicted.

[0043] S31. Select at least one social media platform as a public opinion collection platform to collect public opinion-related data. The social media platform includes mainstream platforms such as Weibo, WeChat, Twitter, and Facebook. The collected data includes, but is not limited to, the number of forwarding, commenting, likes, and reading of articles or topics per unit time, the number of entities associated with the topic, the number of favorites, the number of media outlets, and the topic popularity ranking. Preferably, the data is collected based on historical hot topics.

[0044] S32. Store the data to be processed in chronological order.

[0045] S33. Using the topic popularity ranking as label data, the data to be processed is divided according to the topic popularity to obtain x groups of first data sets about x topics, that is, each group of first data sets includes data of one topic.

[0046] S34. Divide the data in the first dataset into several time windows to obtain y pieces of first data; wherein the time windows may be of different lengths, and the label of the data in each time window is the label of the time step following the last time step of the current time window. A time window refers to a portion of data captured from a time series. When processing a time series, data is divided into multiple time windows, each containing a set of consecutive time steps. The label is the target of the model prediction and is the value predicted at a certain point in the future.

[0047] The last time step of the current time window is: assuming a time window contains data from time points t1 to tn, then the last time step of the current time window is tn. The label of the next time step is: assuming the time series from t1 to tn+1 is continuous, then the next time step is the label corresponding to tn+1, that is, the value of tn+1.

[0048] This step means that for all feature data within a time window (from t1 to tn), the corresponding label (or target value) is the value at the next time point tn+1 immediately after the end of the time window. The model learns to predict this future value (label) from the data (feature data) within the time window.

[0049] Furthermore, the lightweight ensemble model on the browser side doesn't undergo model training, relying instead on the full prediction model on the server. After training, the model parameters of the full prediction model are retained and loaded into the lightweight ensemble model. Because the full prediction model and the lightweight ensemble model share the same structure, this consistency enables seamless transfer of model parameters from the server to the browser side. Specifically, parameter loading can be achieved through methods such as API calls.

[0050] S4. Obtain the public opinion data to be predicted, input the complete prediction model or lightweight integrated model, and obtain the public opinion heat prediction result.

[0051] It should be understood that the complete prediction model is deployed on the server side. When the prediction task requires high precision, or requires processing large amounts of data, or requires updating and training the public opinion heat prediction model, it is possible to consider inputting the public opinion data to be predicted into the complete prediction model. Leveraging the powerful computing power and abundant resources of the server, the complete prediction model can handle more complex computing tasks, thereby providing more accurate prediction results. In addition, server-side model updates and training can also be carried out efficiently in this environment to ensure that the model is always in an optimal state.

[0052] The lightweight integrated model is deployed on the browser side and is suitable for scenarios requiring immediate feedback or real-time predictions. When inputting data into the lightweight integrated model, since it runs locally on the client, it significantly improves response speed and provides rapid prediction results. This local processing also effectively avoids network latency and data leakage issues that may occur during data transmission, thereby enhancing data privacy and security.

[0053] Therefore, users can flexibly choose between a full prediction model and a lightweight integrated model based on their specific needs. For tasks requiring high precision and complex computation, a full prediction model is appropriate; whereas for scenarios emphasizing real-time performance and data privacy, a lightweight integrated model is a more ideal choice. This flexibility ensures the applicability and practicality of this invention in diverse application scenarios.

[0054] The basic principles, main features, and advantages of the present invention are shown and described above. Those skilled in the art should understand that the present invention is not limited to the foregoing embodiments. The foregoing embodiments and descriptions are merely illustrative of the principles of the present invention. Various changes and modifications may be made to the present invention without departing from the spirit and scope of the present invention. Such changes and modifications are intended to fall within the scope of the present invention. The scope of protection claimed in the present invention is defined by the appended claims and their equivalents.

Claims

1. The public opinion heat prediction method based on lightweight integrated model is characterized by: Including steps: Constructing a public opinion heat prediction model based on a recurrent neural network, the public opinion heat prediction model includes several parallel basic networks and a multi-head attention layer that converts the output of the basic network into a two-dimensional matrix form as input; The public opinion heat prediction model is deployed to the server and browser respectively through a deep learning framework to obtain a complete prediction model and a lightweight integrated model; Use the training set to complete the training of the complete prediction model, and load the model parameters of the trained complete prediction model into the lightweight integrated model; Obtain the public opinion data to be predicted, input it into the complete prediction model or lightweight integrated model, and obtain the public opinion heat prediction results; The basic network includes several groups of basic models whose structural complexity is proportional to the length of the time window when the data is extracted, and the basic models with the same time window length have the same structure; The method of converting the output of the basic network into a two-dimensional matrix form includes: the basic network includes N groups of basic models for N time window lengths, each group includes M basic models; constructing the output of the basic network into an M x N two-dimensional matrix; The method for obtaining public opinion data includes: Select at least one social platform to collect public opinion-related data. The collected data includes: the number of reposts, comments, likes, and readings of articles or topics within a unit of time, the number of entities associated with the topic, the number of favorites, the number of media, and the topic popularity ranking.

2. The method for predicting public opinion heat based on a lightweight integrated model according to claim 1, characterized in that: The method of inputting the two-dimensional matrix into the multi-head attention layer includes: performing a linear transformation on the two-dimensional matrix, converting it into a query matrix, a key matrix and a value matrix respectively, and inputting them into the multi-head attention layer.

3. The method for predicting public opinion heat based on a lightweight integrated model according to claim 1, characterized in that: After the training set and the public opinion data to be predicted are obtained, they need to be preprocessed. The preprocessing method includes: Store the data to be processed in chronological order; Dividing the data to be processed by topic popularity to obtain x sets of first data sets for x topics; the characteristic data of the first data sets include: the number of forwarding, commenting, likes, reading, number of entities associated with the topic, number of favorites, and number of media; The data in the first data set are divided into a number of time windows to obtain y pieces of first data; the label of the data in each time window is the label of the next time step after the last time step of the current time window.

4. The method for predicting public opinion heat based on a lightweight integrated model according to claim 1, characterized in that: The deployment method of the entire prediction model and the lightweight integration model includes: The public opinion heat prediction model is deployed to the server side through the Tensorflow framework to obtain a complete prediction model; the public opinion heat prediction model is deployed to the browser side through the Tensorflow.js framework to obtain a lightweight integrated model; the complete prediction model and the lightweight integrated model have the same structure.

Citation Information

Patent Citations

  • Time sequence prediction method based on news public opinions

    CN110222149A