Method and system for predicting personalized public demand based on knowledge graph

CN122886891APending Publication Date: 2026-10-09SHANDONG SHANKE DIGITAL ECONOMY RES INST CO LTD +3
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202611203481.5
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2026-08-10
Publication Date
2026-10-09

AI Technical Summary

Technical Problem

[0006]为克服上述现有技术的不足,本发明提供了基于知识图谱的个性化公众需求预测方法及系统,旨在解决现有技术中存在的异构数据复杂拓扑关系深层挖掘能力不足、缺乏动态时效性建模和细粒度个性化能力表征不足的问题

Benefits of technology

本发明提供的基于知识图谱的个性化公众需求预测方法及系统,通过构建动态政务知识图谱,将公众画像、地理区域、时间、政务事件、职能部门和政务服务等多源异构政务数据统一组织为结构化图谱数据,能够建立跨部门、跨区域、跨事件之间的关联路径,增强对政务事件连锁传导关系和隐性衍生需求的挖掘能力,减少传统扁平化预测模型存在的需求预测盲区。

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN122886891A_ABST
    Figure CN122886891A_ABST
Patent Text Reader

Abstract

The application relates to the technical field of personalized public demand prediction, and provides a personalized public demand prediction method and system based on a knowledge graph, which constructs a static government affair knowledge graph; dynamically updates the static government affair knowledge graph based on real-time government affair flow data to obtain a dynamic government affair knowledge graph; processes the dynamic government affair knowledge graph by using a graph neural network, and carries out nonlinear aggregation of node features by using a dynamic attention mechanism combined with a time decay factor to generate low-dimensional time condition embedding vectors of public nodes and government service nodes; calculates the connection probability of the public nodes and the government service nodes by using a link prediction model to the normalized low-dimensional time condition embedding vectors to obtain a personalized public demand prediction result. The application improves the accuracy of personalized public demand prediction by constructing a knowledge graph, introducing a time decay factor, a relationship mapping matrix and a bias term based on activity and popularity.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of personalized public demand forecasting technology, and in particular to a method and system for personalized public demand forecasting based on knowledge graphs. Background Technology

[0002] The statements in this section are merely background information related to the present invention and do not necessarily constitute prior art.

[0003] With the profound transformation of digital government construction from "process digitization" to "governance intelligence," and the comprehensive implementation of the "data element ×" and "artificial intelligence +" strategies, government service platforms have accumulated massive data resources covering multiple dimensions such as public demands, IoT sensing, approval processes, and macroeconomics. However, current demand forecasting and analysis technologies in the government sector still mainly rely on flat statistical models (such as ARIMA and random forests) or single-time-dimensional sequence deep learning models (such as LSTM and GRU).

[0004] Faced with increasingly complex urban governance scenarios, traditional technologies suffer from several shortcomings. First, they lack the ability to deeply mine the complex topological relationships between heterogeneous data. Government affairs events have typical chain transmission characteristics; a single emergency can generate multiple public demands across departments and fields. However, traditional models use isolated feature processing methods, blocking the information connection paths between government entities, failing to uncover implicit derived demands, and creating predictive blind spots. Second, they lack dynamic and timely modeling mechanisms. Public demands in government affairs are characterized by suddenness and time-varying features, and the impact of events decays exponentially over time. Traditional time-series models suffer from the gradient vanishing problem, and standard attention mechanisms cannot distinguish the timeliness differences of historical information, easily leading to problems such as interference from outdated information and delayed prediction updates, making them difficult to adapt to dynamic government affairs scenarios. Third, they lack fine-grained personalized representation capabilities. Existing prediction methods mostly focus on macro-regional total demand statistics, failing to deeply characterize individual public profiles, behavioral characteristics, and group-specific attributes, thus failing to achieve accurate demand predictions tailored to each individual.

[0005] Therefore, existing technologies are insufficient to meet the needs of precise government governance and lack accuracy in predicting personalized public needs. Summary of the Invention

[0006] To overcome the shortcomings of the prior art, this invention provides a personalized public demand prediction method and system based on knowledge graphs, aiming to solve the problems of insufficient deep mining capability of complex topological relationships of heterogeneous data, lack of dynamic timeliness modeling, and insufficient fine-grained personalization capability representation in the prior art.

[0007] To achieve the above objectives, the technical solution provided by the present invention is as follows: In a first aspect, the present invention provides a personalized public demand prediction method based on knowledge graphs, including: Acquire historical government data from multiple sources and construct a static government knowledge graph; Acquire real-time government affairs flow data, and dynamically update the static government affairs knowledge graph based on the real-time government affairs flow data to obtain a dynamic government affairs knowledge graph; A graph neural network is used to process the dynamic government knowledge graph, and a dynamic attention mechanism combined with a time decay factor is used to perform nonlinear aggregation of node features to generate low-dimensional time-conditional embedding vectors for public nodes and government service nodes. By using the link prediction model to calculate the connection probability between public nodes and government service nodes from the normalized low-dimensional time conditional embedding vector, personalized public demand prediction results are obtained.

[0008] As a further technical solution, the static government knowledge graph includes nodes and edges. The types of nodes include public profile nodes, geographical region nodes, time nodes, government event nodes, functional department nodes, and government service nodes. The types of edges include ownership relationships, triggering relationships, handling relationships, processing relationships, demand relationships, and time concurrency relationships.

[0009] As a further technical solution, the dynamic government knowledge graph is processed using a graph neural network, and a dynamic attention mechanism incorporating a time decay factor is used for nonlinear aggregation of node features to generate low-dimensional time-conditional embedding vectors for public nodes and government service nodes, represented as follows: ; in, Represents a node In the The low-dimensional temporal conditional embedding vector of the layer; This represents the Sigmoid activation function; This represents a vector concatenation operation, used to concatenate feature vectors output from multiple attention heads. Represents a node In the The low-dimensional temporal conditional embedding vector of the layer; j represents any neighboring node of node i; Represents a node The set of neighboring nodes; and Represents the weight matrix; This represents the dynamic attention weight between node i and node j, which incorporates a time decay factor.

[0010] As a further technical solution, the weight calculation of the dynamic attention mechanism combined with the time decay factor is expressed as follows: ; in, This represents the dynamic attention weight between node i and node j, which incorporates a time decay factor. This represents the activation function of the linear unit with leakage correction; Represents the learnable attention parameter vector Transpose of; This represents the feature transformation weight matrix used to calculate the attention score; This represents the current layer feature representation of node i; This represents the current layer feature representation of node j; Indicates a splicing operation; This represents the time interval at which the relationship between node i and node j was last updated; This is a time decay hyperparameter used to control the rate at which historical correlations decay as time intervals increase; Represents a node The set of neighboring nodes; Represents a node The set of neighboring nodes Any neighboring node in the normalization summation process is used as the traversal variable. Represents a node With nodes The time interval at which the relationship between them was last updated.

[0011] As a further technical solution, the connection probability between public nodes and government service nodes is calculated using the link prediction model on the normalized low-dimensional time conditional embedding vector, expressed as: ; in, This represents the public nodes predicted by the model. At any moment For government service nodes Probability of generating demand Represents the normalized public nodes u The low-dimensional time-conditional embedding vector at time t; Represents the normalized government service nodes s The low-dimensional time-conditional embedding vector at time t; Indicates the transpose operation; Represents the relational mapping matrix; Indicates the overall bias term; This represents the Sigmoid activation function.

[0012] As a further technical solution, the relationship mapping matrix is ​​initialized based on the difference between the historical positive sample feature interaction matrix and the negative sample interaction matrix, and is expressed in a low-rank decomposition form as follows: ; Where r represents the relation type; This represents a relational mapping matrix, used to characterize the matching relationship between the feature dimensions of public nodes and the feature dimensions of government service nodes; and Represents the low-rank mapping parameter matrix; Indicates the transpose operation; Represents a diagonal function; This represents the diagonal correction vector corresponding to relation type r, used to supplement the direct matching relationship between features of the same dimension.

[0013] As a further technical solution, the comprehensive bias term is expressed as follows: ; in, Indicates the overall bias term; This indicates a bias in the activity level of public nodes; This indicates the popularity bias of government service nodes; , , This represents the weighting coefficient.

[0014] Secondly, this invention provides a personalized public demand prediction system based on knowledge graphs, comprising: Data acquisition module: used to acquire multi-source historical government data and construct a static government knowledge graph; The knowledge graph dynamic update module is used to acquire real-time government affairs flow data and dynamically update the static government affairs knowledge graph based on the real-time government affairs flow data to obtain a dynamic government affairs knowledge graph. Graph Neural Network Module: Used to process dynamic government knowledge graphs using graph neural networks, and to perform nonlinear aggregation of node features using a dynamic attention mechanism combined with a time decay factor to generate low-dimensional time-conditional embedding vectors for public nodes and government service nodes. Link prediction module: Used to calculate the connection probability between public nodes and government service nodes by using the link prediction model on the normalized low-dimensional time conditional embedding vector, so as to obtain personalized public demand prediction results.

[0015] Thirdly, the present invention provides an electronic device including a processor and a memory, wherein the memory is used to store a computer program, the computer program being loaded and executed by the processor to implement the knowledge graph-based personalized public demand prediction method as described in the first aspect above.

[0016] Fourthly, the present invention provides a computer-readable storage medium for storing a computer program, which, when executed by a processor, implements the knowledge graph-based personalized public demand prediction method as described in the first aspect above.

[0017] As can be seen from the above technical solutions, the present invention has the following beneficial effects: The present invention provides a personalized public demand prediction method and system based on knowledge graphs. By constructing a dynamic government knowledge graph, it unifies multi-source heterogeneous government data such as public profiles, geographical regions, time, government events, functional departments, and government services into structured graph data. It can establish correlation paths between departments, regions, and events, enhance the ability to mine the chain transmission relationship of government events and implicit derivative demands, and reduce the demand prediction blind spots existing in traditional flat prediction models.

[0018] Meanwhile, this invention introduces a dynamic attention mechanism that incorporates a time decay factor during the node aggregation process of the graph neural network. The influence weight of neighboring nodes is dynamically adjusted according to the update time of the node association relationship, which weakens the interference of long-standing historical information on the current prediction results, strengthens the role of recent highly relevant government events and service interaction information, and improves the model's responsiveness and prediction accuracy to sudden and time-varying public needs.

[0019] Furthermore, this invention characterizes the matching relationship between different types of public profile features and different government service attributes by setting a low-rank decomposition form of the relation mapping matrix, and constructs a comprehensive bias term by combining the activity of public nodes and the popularity of government service nodes, thereby separating and modeling the individual demand tendency of the public, the basic popularity of services, and the personalized matching relationship between the two, thereby further improving the accuracy, stability and interpretability of personalized public demand prediction. Attached Figure Description

[0020] To more clearly illustrate the technical solutions in the embodiments of the present invention or the prior art, the drawings used in the description of the embodiments or the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present invention. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.

[0021] Figure 1 The flowchart illustrates the personalized public demand prediction method based on knowledge graphs provided in Embodiment 1 of the present invention.

[0022] Figure 2 This is an architecture diagram of a knowledge graph-based personalized public demand prediction system provided in Embodiment 2 of the present invention. Detailed Implementation

[0023] It should be noted that the following detailed descriptions are exemplary and intended to provide further illustration of the invention. Unless otherwise specified, all technical and scientific terms used herein have the same meaning as commonly understood by one of ordinary skill in the art to which this invention pertains.

[0024] It should be noted that the terminology used herein is for the purpose of describing particular embodiments only and is not intended to limit the exemplary embodiments of the present invention. As used herein, unless the context clearly indicates otherwise, the singular form is intended to include the plural form as well. Furthermore, it should be understood that the terms "comprising," "having," and any variations thereof are intended to cover non-exclusive inclusion, for example, a process, method, system, product, or apparatus that comprises a series of steps or units is not necessarily limited to those steps or units explicitly listed, but may include other steps or units not explicitly listed or inherent to such processes, methods, products, or apparatus.

[0025] Where there is no conflict, the embodiments and features in the embodiments of the present invention can be combined with each other.

[0026] All data acquisition in this embodiment is carried out in accordance with laws and regulations and with user consent, and the data is used legally.

[0027] Terminology Explanation: A Government Knowledge Graph (GKG) is a semantic network that uses a graph structure to describe and organize entities and their relationships in the physical and digital worlds of government affairs. It extracts, cleanses, and merges heterogeneous government data (such as population information, legal entity information, geospatial data, macroeconomic data, and government events) to form a multi-dimensional topological structure composed of "nodes (entities)" and "edges (relationships)." This structure breaks down data silos across departments, enabling semantic interoperability and knowledge reasoning within government data.

[0028] Graph Neural Networks (GNNs) are a class of deep learning models specifically designed for processing graph-structured data. Unlike traditional neural networks that process grid-like data (such as images) or sequential data (such as text), GNNs can directly perform message passing and feature aggregation at the nodes and edges of the graph, effectively capturing the topological dependencies between nodes.

[0029] Time-Decay Mechanism: A mathematical modeling method that simulates the physical and social laws of the real world. In political events, the impact of a sudden event (such as a rainstorm or power outage) on public demand gradually weakens over time. The time-decay mechanism dynamically adjusts historical characteristics or attention weights by introducing a decay factor that decreases exponentially or linearly, giving higher weight to recent events.

[0030] Link prediction is a core task in complex network analysis. It aims to predict the probability of a connection (i.e., a relationship) forming between two currently unconnected nodes in a network, based on known node attributes and network topology. In this invention, it specifically refers to predicting the probability of future demand between "public nodes" and "government service nodes."

[0031] Example 1 like Figure 1 As shown, this embodiment provides a personalized public demand prediction method based on knowledge graphs, including: Step 1: Obtain historical government data from multiple sources and construct a static government knowledge graph; Step 2: Obtain real-time government affairs flow data, and dynamically update the static government affairs knowledge graph based on the real-time government affairs flow data to obtain a dynamic government affairs knowledge graph; Step 3: Process the dynamic government knowledge graph using a graph neural network, and use a dynamic attention mechanism combined with a time decay factor to perform nonlinear aggregation of node features to generate low-dimensional time-conditional embedding vectors for public nodes and government service nodes. Step 4: Calculate the connection probability between public nodes and government service nodes using the link prediction model on the normalized low-dimensional time conditional embedding vector to obtain personalized public demand prediction results.

[0032] The following content will provide a more detailed introduction to the knowledge graph-based personalized public demand prediction method provided in this embodiment.

[0033] In step 1, multi-source historical government data is acquired, and a static government knowledge graph is constructed.

[0034] To address the issue of inconsistent spatiotemporal granularity in multi-source data, this invention employs a standard geospatial grid coding system (Geohash) in the spatial dimension. This system maps all entities carrying location information, such as sensor latitude and longitude coordinates and street addresses reported by the public, to gridded area nodes with a fixed resolution, achieving spatial benchmark unification. In the temporal dimension, all heterogeneous timestamps are converted to Unix timestamps in a standard time zone, and a sliding time window with a one-hour step is set. Within this window, moving average pooling is performed on high-frequency sensor data to remove noise, while cubic spline interpolation is used to fill in missing data, thereby ensuring the continuity and integrity of the time-series data.

[0035] In one specific implementation, the static government knowledge graph includes nodes and edges. The types of nodes include public profile nodes, geographical region nodes, time nodes, government event nodes, functional department nodes, and government service nodes. The types of edges include ownership relationships, triggering relationships, handling relationships, processing relationships, demand relationships, and time-concurrency relationships.

[0036] Specifically, the multi-source government historical data consists of unstructured hotline texts, such as 12345 citizen complaint work order records, semi-structured government service hall approval and processing logs, and basic public profile data that has been anonymized. The profile data includes information such as the community, age group, and occupation category.

[0037] For unstructured text from 12345, a pre-trained language model and conditional random field are used to identify government entity names. Dependency parsing and multi-head self-attention mechanism are used to extract relationships between entities, and the unstructured text is transformed into a triple form of (head entity, relation, tail entity) and stored in a graph database.

[0038] Specifically, public profile nodes are used to describe group characteristics, geographic area nodes are used to depict spatial attributes, time nodes are used to mark holidays or specific seasons, government event nodes cover water and power outages, rainstorms and traffic accidents, functional department nodes include functional department nodes of the Water Resources Bureau, Transportation Bureau and Civil Affairs Bureau, and government service nodes include bulky garbage collection and home-based elderly care services.

[0039] Specifically, the attribution relationship describes the affiliation between public profile nodes and geographical region nodes, connecting the public and the region; the triggering relationship describes the causal chain between different government events, connecting event A and event B; the handling relationship describes the response and handling responsibilities of functional departments to government events, connecting functional department nodes and government event nodes; the processing relationship describes the acceptance, transfer, approval, and completion relationship of public demands or government service items, connecting public profile nodes, government service nodes, and functional department nodes; the demand relationship describes the historical or potential demand of the public for a certain type of government service item in a specific time and region, connecting public profile nodes and government service nodes; and the time concurrency relationship describes the correlation of multiple government events, public demands, or service processing items occurring simultaneously within the same time window, connecting time nodes and government event nodes or government service nodes.

[0040] In addition, the inherent attributes of nodes in the static government knowledge graph are transformed into initial feature vectors. ( The initial embedding dimension is used. For categorical attributes (such as occupation and event type), a learnable embedding layer is used for encoding. For continuous numerical attributes (such as temperature and rainfall), mean-variance normalization is performed and the data is then concatenated to form a complete initial feature representation.

[0041] In step 2, real-time government affairs flow data is obtained, and the static government affairs knowledge graph is dynamically updated based on the real-time government affairs flow data to obtain the dynamic government affairs knowledge graph.

[0042] Specifically, real-time government data streams are time-series data transmitted back from urban IoT sensors, such as water depth on main roads, traffic congestion index at intersections, power grid load rate, and real-time weather warnings issued by meteorological departments, ensuring high-frequency data updates and immediate response capabilities.

[0043] The continuous feature matrix of existing nodes in the static government knowledge graph is continuously updated based on real-time government data flow to ensure that entity representations can reflect the latest business status in real time. Simultaneously, to capture temporal evolution patterns, a temporal association record is established for each edge, accurately tracking the timestamp of its last interaction or state change. Based on this, by calculating the current time... The difference from that historical point in time = This generates a benchmark scalar for measuring the timeliness of information, thus providing a key basis for subsequent attention calculations that incorporate a time decay mechanism. This enables the model to automatically reduce the weight of long-standing interactions and focus on dynamic features with high relevance in the near future.

[0044] In step 3, a graph neural network is used to process the dynamic government knowledge graph, and a dynamic attention mechanism combined with a time decay factor is used to perform nonlinear aggregation of node features to generate low-dimensional time-conditional embedding vectors for public nodes and government service nodes.

[0045] This step aims to aggregate topological features across departments and spaces, while also conforming to the objective physical law that the impact of an event diminishes over time.

[0046] In one specific implementation, the dynamic government knowledge graph is processed using a graph neural network, and a dynamic attention mechanism incorporating a time decay factor is used for nonlinear aggregation of node features to generate low-dimensional time-conditional embedding vectors for public nodes and government service nodes, represented as follows: ; in, Represents a node In the The low-dimensional temporal conditional embedding vector of the layer; This represents the Sigmoid activation function; This represents a vector concatenation operation, used to concatenate feature vectors output from multiple attention heads. Represents a node In the The low-dimensional temporal conditional embedding vector of the layer; j represents any neighboring node of node i; Represents a node The set of neighboring nodes; and Represents the weight matrix; This represents the dynamic attention weight between node i and node j, which incorporates a time decay factor.

[0047] In one specific implementation, the weight calculation of the dynamic attention mechanism incorporating the time decay factor is expressed as follows: ; in, This represents the dynamic attention weight between node i and node j, which incorporates a time decay factor. This represents the activation function of the linear unit with leakage correction; Represents the learnable attention parameter vector Transpose of; This represents the feature transformation weight matrix used to calculate the attention score; This represents the current layer feature representation of node i; This represents the current layer feature representation of node j; Indicates a splicing operation; This represents the time interval at which the relationship between node i and node j was last updated; This is a time decay hyperparameter used to control the rate at which historical correlations decay as time intervals increase; Represents a node The set of neighboring nodes Any neighboring node in the normalization summation process is used as the traversal variable. Represents a node With nodes The time interval at which the relationship between them was last updated.

[0048] Time decay factor Make the older the event The larger the value, the closer its weight in current demand forecasting becomes to zero, and the model adaptively achieves noise filtering.

[0049] In the In layered network propagation, the attention weight of target node i to its neighbor node j depends not only on the spatial similarity of their current layer feature representations, but also on the strict constraints of the time span.

[0050] After completing the graph neural network propagation, the public nodes are obtained. At any moment Low-dimensional temporal conditional embedding vector and government service nodes At any moment Low-dimensional temporal conditional embedding vector .

[0051] In step 4, the connection probability between public nodes and government service nodes is calculated using the link prediction model on the normalized low-dimensional time conditional embedding vector to obtain personalized public demand prediction results.

[0052] This step is to avoid distortion of the direct dot product caused by different types of nodes being in heterogeneous semantic spaces.

[0053] In one specific implementation, the connection probability between public nodes and government service nodes is calculated using a link prediction model on the normalized low-dimensional time conditional embedding vector to obtain a personalized public demand prediction result, expressed as follows: ; in, This represents the public nodes predicted by the model. At any moment For government service nodes Probability of generating demand Represents the normalized public nodes u The low-dimensional time-conditional embedding vector at time t; Represents the normalized government service nodess The low-dimensional time-conditional embedding vector at time t; Indicates the transpose operation; Represents the relational mapping matrix; Indicates the overall bias term; This represents the Sigmoid activation function.

[0054] Furthermore, public nodes At any moment Low-dimensional temporal conditional embedding vector and government service nodes At any moment Low-dimensional temporal conditional embedding vector The normalization is expressed as: ; ; in, Represents the normalized public nodes u The low-dimensional time-conditional embedding vector at time t; Represents the normalized government service nodes s The low-dimensional time-conditional embedding vector at time t; The second norm of a vector; This represents a constant used to prevent the denominator from being zero.

[0055] In one specific implementation, the relationship mapping matrix is ​​initialized based on the difference between the historical positive sample feature interaction matrix and the negative sample interaction matrix, and is expressed in a low-rank decomposition form as follows: ; Where r represents the relation type; This represents a relational mapping matrix, used to characterize the matching relationship between the feature dimensions of public nodes and the feature dimensions of government service nodes; and Represents the low-rank mapping parameter matrix; Indicates the transpose operation; Represents a diagonal function; This represents the diagonal correction vector corresponding to relation type r, used to supplement the direct matching relationship between features of the same dimension.

[0056] For example, when the node embedding vector dimension is The low-rank dimension is and hour, and These are used to map public node features and government service node features to a lower-dimensional relational interaction space, respectively. Used to capture cross-matching relationships between different feature dimensions; Used to supplement direct matching relationships between the same feature dimensions. Taking the "consulting services" relationship type as an example, the relationship mapping matrix... It can learn the matching strength between public profile characteristics such as age group, region, and historical consultation frequency and the attributes of consultation-type government services, thereby improving the accuracy of connection probability calculation between public nodes and government service nodes.

[0057] Let the historical training sample set be: ; in, This represents the training sample set containing both positive and negative samples. This represents the set of positive samples that have actually occurred in history regarding public-service interactions. This represents the set of negative samples for which no public-service interaction has historically occurred. For any historical sample... , Indicates public node At a historical moment For government service nodes There was demand. Indicates public node At a historical moment For government service nodes No demand was generated.

[0058] This invention first calculates the relationship type based on historical positive and negative samples. The following feature interaction statistics matrix: ; ; in, Representing relation type The following is the positive sample feature interaction statistics matrix calculated from the positive sample set; Representing relation type The following is the negative sample feature interaction statistics matrix calculated from the negative sample set; Representing relation type The corresponding set of positive samples; Representing relation type The corresponding set of negative samples; Historical Sample The corresponding sample weights; and These are the weight normalization coefficients for positive and negative samples, respectively; Indicates public node At a historical moment The low-dimensional temporal conditional embedding vector; Indicates government service nodes At a historical moment The low-dimensional temporal conditional embedding vector; This indicates the time when the interaction occurred corresponding to the historical sample, used to distinguish the time when the historical training sample occurred.

[0059] This yields the initial values ​​for the relational mapping matrix: ; in, Representing relation type The corresponding initial values ​​of the relational mapping matrix; Used to limit the range of values ​​for matrix elements to prevent extreme samples from causing the matrix parameters to become too large; Representing relation type The following is the positive sample feature interaction statistics matrix calculated from the positive sample set; Representing relation type The following is the negative sample feature interaction statistics matrix calculated from the negative sample set.

[0060] During model training, The gradient update method is as follows: (This is followed by a description of a process involving a binary cross-entropy loss function and its gradient update mechanism.) Wherein, the relational mapping matrix The update rules are as follows: ; in, The learning rate is the value of the relation mapping matrix. The regularization coefficients of the relation mapping matrix; For the public nodes predicted by the model At any moment For government service nodes The probability of generating demand; For public nodes At any moment For government service nodes The true labels that generate demand; Represents the normalized public nodes At any moment The low-dimensional temporal conditional embedding vector; Represents the normalized government service nodes At any moment The low-dimensional temporal conditional embedding vector; Representing relation type The corresponding relational mapping matrix; Representing relation type The corresponding initial values ​​of the relational mapping matrix.

[0061] Relationship mapping matrix Instead of being a vague "learnable parameter," it is a relationship mapping matrix initialized with historical public node-government service node interaction samples and continuously corrected during end-to-end training. This relationship mapping matrix can express whether there is a demand matching relationship between a certain type of public profile feature and a certain type of government service attribute.

[0062] In government service scenarios, some service nodes naturally attract high public attention, such as social security, housing provident fund, medical insurance, and traffic violations. Simultaneously, some public nodes also exhibit high historical activity, such as those with frequent inquiries, processing, or complaints. If relying solely on bilinear interaction scores, the model may misclassify high-frequency services as potentially needed by all members of the public, or overlook the genuine needs and preferences of active users.

[0063] Therefore, this invention introduces a comprehensive bias term based on the inherent popularity or activity of nodes. The model separates the "basic occurrence probability of a node" from the "personalized matching degree between public nodes and government service nodes" into separate models.

[0064] In one specific implementation, the comprehensive bias term is expressed as: ; in, Indicates the overall bias term. This indicates a bias in the activity level of public nodes. This indicates the popularity bias of government service nodes. , , This represents the weighting coefficient.

[0065] For public nodes Calculate its historical activity level: ; in, Indicates public node At any moment Previous historical activity level, superscript Indicates public node Starting from the government service nodes Historical request interactions; This is a set of interaction edges representing the historical public nodes and government service nodes. For public nodes With government service nodes At a historical moment The weight of recorded requests and interactions; Indicates the time when historical demand interactions occurred; Indicates the current prediction time; This indicates that only historical interaction records that have occurred before the current prediction time will be counted.

[0066] Perform smooth normalization on all public nodes: ; in, Represents the public nodes after smooth normalization. Historical activity level; Indicates public node At any moment Previous original historical activity level; Represents the set of public nodes; Represents the set of public nodes Any node in the expression is used as the summation symbol. The traversal variable is used to accumulate the historical activity of all public nodes; Represents the set of public nodes The total number of nodes in; represents the Laplace smoothing coefficient, which aims to avoid instability in the normalization results caused by zero-interaction nodes by introducing tiny counts; This indicates the number of elements in the set.

[0067] The public node activity bias is: ; in, This indicates a bias in the activity level of public nodes. Represents the public nodes after smooth normalization. Historical activity This represents a constant used to prevent the denominator from being zero.

[0068] Targeting government service nodes Calculate its historical popularity: ; in, Indicates government service nodes At any moment Previous historical popularity; superscript Indicates government service nodes For the endpoint to receive public nodes The number of times a request has been made in the history of request interactions; This represents the set of interaction edges between historical public nodes and government service nodes. For public nodes With government service nodes At a historical moment The weight of recorded requests and interactions; Indicates the time when historical demand interactions occurred; Indicates the current prediction time; This indicates that only historical interaction records that have occurred before the current prediction time will be counted.

[0069] Smoothly normalize all government service nodes: ; in, Indicates government service nodes At any moment Historical popularity after smoothing and normalization; For government service nodes At any moment Previous popularity of the original history Represents a set of government service nodes. A collection of government service nodes Any node in the array is used for traversal and summation; Represents the set of government service nodes The total number of nodes in the system The Laplace smoothing coefficient is designed to avoid instability in the normalization results caused by low-frequency or zero-interaction service nodes by introducing a small count. This indicates the number of elements in the set.

[0070] The popularity bias of government service nodes is: ; in, This indicates the popularity bias of government service nodes. Indicates government service nodes At any moment Historical popularity after smoothing and normalization This represents a constant used to prevent the denominator from being zero.

[0071] The sample set construction strategy balances real-world data mining and hard example learning, aiming to improve the model's discriminative ability. The positive sample set is directly derived from real "public-service" interaction records in historical logs, ensuring a factual basis for the training data. Regarding the construction of the negative sample set, considering the large number of unconnected, isolated node pairs in the government service graph, simply using global random sampling often results in overly simplistic negative samples, leading to low model learning efficiency. Therefore, this invention introduces a Random Walk with Restart (RWR) algorithm, which delves deeply into the graph topology to specifically select government service nodes that are structurally close to public nodes but have not yet generated substantial demand in real-world business. These identified nodes constitute high-quality "hard negative samples," forcing the model to learn more subtle structural differences and semantic boundaries, thereby significantly improving its prediction accuracy and generalization ability in complex scenarios.

[0072] Construct a joint loss function that includes binary cross-entropy and L2 regularization: ; in, Represents the joint loss function; This represents the training sample set containing both positive and negative samples. and These represent public nodes and government service nodes, respectively. For public nodes For government service nodes The true label that generates demand For the public nodes predicted by the model For government service nodes The probability of generating demand; Representing relation type The corresponding relational mapping matrix; This represents the initial value of the relation mapping matrix corresponding to relation type r; Denotes the square of the Frobenius norm of a matrix; This represents all learnable parameters in the model (including at least those in the graph neural network). , , and in the link prediction layer , , wait); and These represent the weight coefficients of the L2 regularization term of the model parameters and the deviation of the relation mapping matrix from the initial value regularization term, respectively.

[0073] During training, the model employs the AdamW optimizer and performs small-batch backpropagation training based on dynamic government service graph samples constructed from historical time windows. The parameters of each network layer are continuously updated iteratively until the loss function converges, thus obtaining the optimal personalized demand prediction model finally deployed on the government cloud.

[0074] Example 2 like Figure 2 As shown, this embodiment provides a personalized public demand prediction system based on knowledge graphs, including: Data acquisition module: used to acquire multi-source historical government data and construct a static government knowledge graph; The knowledge graph dynamic update module is used to acquire real-time government affairs flow data and dynamically update the static government affairs knowledge graph based on the real-time government affairs flow data to obtain a dynamic government affairs knowledge graph. Graph Neural Network Module: Used to process dynamic government knowledge graphs using graph neural networks, and to perform nonlinear aggregation of node features using a dynamic attention mechanism combined with a time decay factor to generate low-dimensional time-conditional embedding vectors for public nodes and government service nodes. Link prediction module: Used to calculate the connection probability between public nodes and government service nodes by using the link prediction model to calculate the low-dimensional time conditional embedding vector, and obtain personalized public demand prediction results.

[0075] Example 3 This embodiment provides an electronic device, including a processor and a memory, wherein the memory is used to store a computer program, which is loaded and executed by the processor to implement the knowledge graph-based personalized public demand prediction method as described in Embodiment 1.

[0076] Example 4 This embodiment provides a computer-readable storage medium for storing a computer program; wherein the computer program, when executed by a processor, implements the knowledge graph-based personalized public demand prediction method as described in Embodiment 1.

[0077] While the specific embodiments of the present invention have been described above in conjunction with the accompanying drawings, this is not intended to limit the scope of protection of the present invention. Those skilled in the art should understand that various modifications or variations that can be made by those skilled in the art without creative effort based on the technical solutions of the present invention are still within the scope of protection of the present invention.

Claims

1. A personalized public demand prediction method based on knowledge graphs, characterized in that, include: Acquire historical government data from multiple sources and construct a static government knowledge graph; Acquire real-time government affairs flow data, and dynamically update the static government affairs knowledge graph based on the real-time government affairs flow data to obtain a dynamic government affairs knowledge graph; A graph neural network is used to process the dynamic government knowledge graph, and a dynamic attention mechanism combined with a time decay factor is used to perform nonlinear aggregation of node features to generate low-dimensional time-conditional embedding vectors for public nodes and government service nodes. By using the link prediction model to calculate the connection probability between public nodes and government service nodes from the normalized low-dimensional time conditional embedding vector, personalized public demand prediction results are obtained.

2. The personalized public demand prediction method based on knowledge graphs as described in claim 1, characterized in that, The static government knowledge graph includes nodes and edges. The types of nodes include public profile nodes, geographical region nodes, time nodes, government event nodes, functional department nodes, and government service nodes. The types of edges include ownership relationships, triggering relationships, handling relationships, processing relationships, demand relationships, and time-concurrency relationships.

3. The personalized public demand prediction method based on knowledge graphs as described in claim 1, characterized in that, The process utilizes graph neural networks to process the dynamic government knowledge graph and employs a dynamic attention mechanism incorporating a time decay factor for nonlinear aggregation of node features, generating low-dimensional temporal conditional embedding vectors for public nodes and government service nodes, as follows: ; in, Represents a node In the The low-dimensional temporal conditional embedding vector of the layer; This represents the Sigmoid activation function; This represents a vector concatenation operation, used to concatenate feature vectors output by multiple attention heads. Represents a node In the The low-dimensional temporal conditional embedding vector of the layer; j represents any neighboring node of node i; Represents a node The set of neighboring nodes; and Represents the weight matrix; This represents the dynamic attention weight between node i and node j, which incorporates a time decay factor.

4. The personalized public demand prediction method based on knowledge graphs as described in claim 3, characterized in that, The weight calculation for the dynamic attention mechanism incorporating the time decay factor is expressed as follows: ; in, This represents the dynamic attention weight between node i and node j, which incorporates a time decay factor. This represents the activation function of the linear unit with leakage correction; Represents the learnable attention parameter vector Transpose of; This represents the feature transformation weight matrix used to calculate the attention score; This represents the current layer feature representation of node i; This represents the current layer feature representation of node j; Indicates a splicing operation; This represents the time interval at which the relationship between node i and node j was last updated; This is a time decay hyperparameter used to control the rate at which historical correlations decay as time intervals increase; Represents a node The set of neighboring nodes Any neighboring node in the normalization summation process is used as the traversal variable. Represents a node With nodes The time interval at which the relationship between them was last updated.

5. The personalized public demand prediction method based on knowledge graphs as described in claim 1, characterized in that, By using a link prediction model to calculate the connection probability between public nodes and government service nodes from the normalized low-dimensional time conditional embedding vector, personalized public demand prediction results are obtained, expressed as follows: ; in, This represents the public nodes predicted by the model. At any moment For government service nodes The probability of generating demand; Represents the normalized public nodes u The low-dimensional time-conditional embedding vector at time t; Represents the normalized government service nodes s The low-dimensional time-conditional embedding vector at time t; Indicates the transpose operation; Represents the relational mapping matrix; Indicates the overall bias term; This represents the Sigmoid activation function.

6. The personalized public demand prediction method based on knowledge graphs as described in claim 5, characterized in that, The relation mapping matrix is ​​initialized based on the difference between the historical positive sample feature interaction matrix and the negative sample interaction matrix, and is expressed in a low-rank decomposition form as follows: ; Where r represents the relation type; This represents a relational mapping matrix, used to characterize the matching relationship between the feature dimensions of public nodes and the feature dimensions of government service nodes; and Represents the low-rank mapping parameter matrix; Indicates the transpose operation; Represents a diagonal function; This represents the diagonal correction vector corresponding to relation type r, used to supplement the direct matching relationship between features of the same dimension.

7. The personalized public demand prediction method based on knowledge graphs as described in claim 5, characterized in that, The comprehensive bias term is expressed as: ; in, Indicates the overall bias term; This indicates a bias in the activity level of public nodes; This indicates the popularity bias of government service nodes; , , This represents the weighting coefficient.

8. A personalized public demand prediction system based on knowledge graphs, characterized in that: include: Data acquisition module: used to acquire multi-source historical government data and construct a static government knowledge graph; The knowledge graph dynamic update module is used to acquire real-time government affairs flow data and dynamically update the static government affairs knowledge graph based on the real-time government affairs flow data to obtain a dynamic government affairs knowledge graph. Graph Neural Network Module: Used to process dynamic government knowledge graphs using graph neural networks, and to perform nonlinear aggregation of node features using a dynamic attention mechanism combined with a time decay factor to generate low-dimensional time-conditional embedding vectors for public nodes and government service nodes. Link prediction module: Used to calculate the connection probability between public nodes and government service nodes by using the link prediction model on the normalized low-dimensional time conditional embedding vector, so as to obtain personalized public demand prediction results.

9. An electronic device, characterized in that, It includes a processor and a memory, wherein the memory is used to store a computer program, which is loaded and executed by the processor to implement the knowledge graph-based personalized public demand prediction method as described in any one of claims 1-7.

10. A computer-readable storage medium, characterized in that, Used to store computer programs, which, when executed by a processor, implement the knowledge graph-based personalized public demand prediction method as described in any one of claims 1-7.