Smart city entity knowledge graph completion method, system and device

By using the relationship embedding generation model of conditional variational autoencoder and contrast learning algorithm in the smart city knowledge graph, the problems of knowledge graph update lag and relationship loss are solved, and efficient and accurate knowledge graph completion and decision support are achieved.

CN119761476APending Publication Date: 2025-04-04浪潮智慧城市科技有限公司
View PDF 0 Cites 2 Cited by

Patent Information

Application Number
CN202411846299.2
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-12-16
Publication Date
2025-04-04

AI Technical Summary

Technical Problem

The existing smart city knowledge graph faces the problems of lagging information updates and lack of relationships. Traditional methods rely on experts to operate manually, and automation technology does not perform well in emerging entities and relationship predictions.

Method used

A relationship embedding generation model based on conditional variational autoencoder is adopted, and the model is trained through a comparative learning algorithm to generate the properties of unknown smart city entity relationships, and the model is dynamically adjusted to adapt to the urban data environment.

Benefits of technology

It has achieved rapid and accurate completion of the smart city entity knowledge graph, and improved the integrity of the knowledge graph and the decision-making support capabilities of smart city management.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119761476A_ABST
    Figure CN119761476A_ABST
Patent Text Reader

Abstract

The present invention relates to the field of smart city entity information processing technology, and specifically provides a smart city entity knowledge graph completion method, system and device, which have the following steps: S1, feature extraction, and obtaining initial embedding vectors of entities and relationships; S2, a relationship embedding generation model uses the smart city entity embedding vector as input, and outputs the property results of unknown smart city entity relationships; S3, using the initial embedding vectors of entities and relationships to train the relationship embedding generation model through a contrast learning algorithm, and obtaining a smart city entity knowledge graph completion model; S4, using the smart city entity knowledge graph completion model to predict the properties of unknown smart city entity relationships corresponding to the input smart city entities, and completing the smart city entity knowledge graph. Compared with the prior art, the present invention can dynamically adjust the model to adapt to the ever-changing urban data environment, and achieve rapid response and completion to new urban conditions.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of smart city entity information processing technology, and specifically provides a smart city entity knowledge graph completion method, system and device. Background Art

[0002] In the field of smart cities, knowledge graphs, as a key technology for integrating various smart city information (such as traffic flow, energy consumption, environmental monitoring, and facility relationships), have been widely used in urban management, resource optimization, and intelligent decision support. By constructing and analyzing complex relationships between entities, knowledge graphs can support advanced queries and data analysis, thereby improving the quality and efficiency of smart city services. However, with the continuous changes in urban development needs and technological advances, new urban challenges and management needs continue to emerge, resulting in the existing smart city knowledge graphs facing problems such as lagging information updates and missing relationships.

[0003] Traditional knowledge graph construction and completion methods mainly rely on manual operations by experts, which is not only time-consuming and labor-intensive, but also difficult to quickly and accurately reflect the latest smart city entity knowledge. In addition, although existing automated technologies (such as embedded representation learning and statistical inference methods) perform well in certain scenarios, these methods are mostly optimized for known data, and their prediction performance and accuracy are significantly reduced for newly emerging and unseen smart city entities and relationships. This is because these technologies lack effective generalization capabilities, especially when faced with sparse data and emerging smart city entity conditions, and it is difficult to provide reliable inferences.

[0004] In recent years, zero-shot learning has made significant progress in the fields of image and text processing as an effective means to solve the problem of category extrapolation. The core idea is to learn the deep features of existing categories and apply this knowledge to unseen categories.

[0005] However, directly applying these methods to the knowledge graph of smart city entities faces challenges: smart city entity data is highly specialized and semantically complex, requiring the model to capture more detailed features and relationships. Currently, no description or report of similar technology to the present invention has been found, and no similar information at home or abroad has been collected. Summary of the invention

[0006] The present invention aims to address the deficiencies of the above-mentioned prior art and provides a practical method for completing the entity knowledge graph of a smart city.

[0007] A further technical task of the present invention is to provide a smart city entity knowledge graph completion system that is reasonably designed, safe and applicable.

[0008] A further technical task of the present invention is to provide a smart city entity knowledge graph completion device.

[0009] The technical solution adopted by the present invention to solve its technical problem is:

[0010] The smart city entity knowledge graph completion method has the following steps:

[0011] S1. Extract features from the text description of smart city entities to obtain initial embedding vectors of entities and relationships;

[0012] S2. Using a relation embedding generation model based on a conditional variational autoencoder, the relation embedding generation model takes a smart city entity embedding vector as input and outputs a property result of an unknown smart city entity relationship;

[0013] S3. Use the initial embedding vectors of entities and relationships to train the relation embedding generation model through a contrastive learning algorithm, and continuously optimize the parameters of the relation embedding generation model according to the output of the relation embedding generation model to obtain a smart city entity knowledge graph completion model;

[0014] S4. Use the smart city entity knowledge graph completion model to predict the properties of the unknown smart city entity relationships corresponding to the input smart city entities, obtain the state of each entity relationship in the knowledge graph, and then use it to complete the smart city entity knowledge graph.

[0015] Furthermore, in step S1, the smart city entity data or text data is obtained and preprocessed and feature extracted, wherein:

[0016] S11, preprocessing, including data cleaning, denoising and normalization;

[0017] S12: Feature extraction, which is used to extract effective information that can reflect the characteristics of entities and relationships from the original data to obtain the initial embedding vectors of entities and relationships.

[0018] Furthermore, in step S2, the relationship embedding generation model based on the conditional variational autoencoder includes: a conditional variational autoencoder module, the conditional variational autoencoder module is used to take the smart city entity embedding vector as input and output the property prediction result of the unknown smart city entity relationship; wherein:

[0019] The conditional variational autoencoder module, whose encoder is used to map the input feature vector x to a latent variable distribution z, generates a conditional probability q φ (z|x) is:

[0020]

[0021] In the formula, μ φ (x) and Respectively represent the mean and variance of the input feature vector;

[0022] The conditional variational autoencoder module, whose decoder generates an output feature vector x′ according to the latent variable, and the conditional distribution p of the output feature vector x′ θ (x′|z) is:

[0023]

[0024] In the formula, μ θ (z) and denote the mean and variance of the output feature vector based on the latent variable z, respectively.

[0025] Furthermore, the relation embedding generation model based on conditional variational autoencoder further includes: a contrastive denoising autoencoder module, which is used to decompose the input property prediction result vector into a relation-related sub-vector and a relation-irrelevant sub-vector, and isolate and remove noise from the prediction result; wherein:

[0026] The contrast denoising autoencoder module decomposes the input property prediction result vector to obtain a relation-related subvector (rs) and a relation-irrelevant subvector (is); wherein:

[0027] The original result vector x of the input passes through the encoder E of the contrast denoising autoencoder module Ψ Mapped to a subvector in the latent space, expressed as:

[0028]

[0029] Where s represents the encoder E of the denoising autoencoder Ψ The generated embedding vector in the latent space is a representation of the original input vector x, rs represents the sub-vector that captures the relationship-related information, is represents the noise information sub-vector that is irrelevant to the relationship, and the symbol It means that the relation-related sub-vector rs and the relation-irrelevant sub-vector is are connected to form a complete smart city entity embedding vector;

[0030] The decoder D of the contrastive denoising autoencoder module ω Reconstruct the subvectors:

[0031]

[0032] In the formula, x * Represents the reconstruction vector.

[0033] Furthermore, in step S3, the following operations are further included:

[0034] S31, constructing a training sample set using the initial embedding vectors of entities and relations, where the training sample set includes normal relation instances and potential unseen relation instances;

[0035] S32. Using the training sample set, the relation embedding generation model is trained by the contrastive learning algorithm. The contrastive learning algorithm enhances the clustering of entity pairs with the same relation in the latent space by minimizing the loss function, while separating entity pairs with different relations. It is expressed as:

[0036]

[0037] Among them, the loss function l is defined as:

[0038]

[0039] Where D represents the distance function (here is the cosine distance), Δ∈[0,2] is the relaxation hyperparameter, represents samples generated from the conditional distribution of relation r, Represents the corresponding relationship The centroid vector of . This contrast loss aims to reduce the overlap of embedding distributions of different relations;

[0040] S33. The optimization goal of the conditional variational autoencoder module is to maximize the reconstruction accuracy and minimize the KL divergence between the potential distribution of the encoder output and the standard normal distribution. The reconstruction loss function L of the conditional variational autoencoder module is cvae for:

[0041]

[0042] Where, L cvae represents the total loss function of the conditional variational autoencoder module, which consists of two parts: reconstruction loss and KL divergence; p(z) represents the prior distribution of the latent variable z;

[0043] S34, the optimization goal of the contrast denoising autoencoder module is to evaluate the original input vector x and the reconstructed vector x * The difference between them can optimize the reconstruction accuracy of the model, and then compare the reconstruction loss function L of the denoising autoencoder module recon for:

[0044] L recon =||xx * ||

[0045] In the formula, the symbol ||·|| indicates the norm between the calculated vectors;

[0046] S35. By jointly optimizing the above loss function Lcvae and / or L recon , adjust the parameters of each encoder and decoder of the relation embedding generation model to obtain the smart city entity knowledge graph completion model.

[0047] Furthermore, in step S4, the following operations are further included:

[0048] S41, using the smart city entity knowledge graph completion model to predict the properties of the unknown smart city entity relationship corresponding to the input smart city entity, and obtain a relationship prediction result;

[0049] S42, process the relationship prediction results, and divide the processed relationship prediction results into normal and abnormal categories according to a preset threshold, obtain the relationship status of each entity in the knowledge graph, and identify possible abnormal situations and relationship error types.

[0050] Furthermore, in step S42, the relationship prediction result is processed, further comprising:

[0051] S421. According to the relationship prediction result, the relationship states in the knowledge graph are divided into different categories or states;

[0052] S422, performing fault diagnosis on the relationship in the knowledge graph according to the relationship prediction result;

[0053] S423. Based on the relationship prediction results, real-time monitoring of the relationships in the knowledge graph is performed;

[0054] S424. Based on the relationship prediction results, identify and analyze the relationships in the knowledge graph.

[0055] Smart city entity knowledge graph completion system, including basic data acquisition module, relationship embedding generation model module, model training module and relationship prediction module;

[0056] The basic data acquisition module is used to extract features from the text description of smart city entities to obtain initial embedding vectors of entities and relationships;

[0057] The relation embedding generation model module is used to provide a relation embedding generation model based on a conditional variational autoencoder, and the relation embedding generation model is used to take a smart city entity as input and output a property prediction result of an unknown smart city entity relationship;

[0058] The model training module is used to train the relationship embedding generation model by using the initial embedding vectors of entities and relationships through a contrastive learning algorithm, and continuously optimize the parameters of the relationship embedding generation model according to the results output by the relationship embedding generation model to obtain a smart city entity knowledge graph completion model;

[0059] The relationship prediction module is used to use the smart city entity knowledge graph completion model to predict the properties of the unknown smart city entity relationship corresponding to the input smart city entity, obtain the state of each entity relationship in the knowledge graph, and then use it to complete the smart city entity knowledge graph.

[0060] A smart city entity knowledge graph completion device, comprising: at least one memory and at least one processor;

[0061] The at least one memory is used to store a machine-readable program;

[0062] The at least one processor is used to call the machine-readable program to execute the smart city entity knowledge graph completion method.

[0063] Compared with the prior art, the smart city entity knowledge graph completion method, system and device of the present invention have the following outstanding beneficial effects:

[0064] The present invention can dynamically adjust the model to adapt to the ever-changing urban data environment, and achieve rapid response and completion of new urban conditions. Through the present invention, the integrity of the smart city knowledge graph and the decision-making support capabilities of smart city management are significantly improved, providing solid technical support for real-time monitoring, optimal resource allocation, and efficient urban governance. BRIEF DESCRIPTION OF THE DRAWINGS

[0065] In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative work.

[0066] Attached Figure 1 It is a flowchart of the method for completing the knowledge graph of smart city entities;

[0067] Attached Figure 2 It is a working diagram of the smart city entity knowledge graph completion method;

[0068] Attached Figure 3 It is a framework diagram of the smart city entity knowledge graph completion system. DETAILED DESCRIPTION

[0069] In order to enable those skilled in the art to better understand the solution of the present invention, the present invention is further described in detail below in conjunction with specific implementation methods. Obviously, the described embodiments are only part of the embodiments of the present invention, rather than all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.

[0070] A best embodiment is given below:

[0071] like Figure 1 As shown, the smart city entity knowledge graph completion method in this embodiment has the following steps:

[0072] S1. Extract features from the text description of smart city entities to obtain initial embedding vectors of entities (e.g., traffic facilities “roads”, environmental indicators “air quality”, urban equipment “street lights”, events “traffic accidents”) and relationships (e.g., “facility connection”, “pollution source impact”, “monitoring area”, “event response”, etc.);

[0073] The following operations may also be further included:

[0074] Obtain smart city entity data or text materials, and perform preprocessing and feature extraction; including:

[0075] S11, preprocessing, including: data cleaning, denoising and normalization;

[0076] S12, feature extraction, is used to extract effective information that can reflect the characteristics of entities and relationships from the original data to obtain the initial embedding vectors of entities and relationships.

[0077] S2. Use a relational embedding generation model based on conditional variational autoencoder. The relational embedding generation model takes the smart city entity embedding vector as input and outputs the property results of the unknown smart city entity relationship.

[0078] It may further include: a conditional variational autoencoder module, the conditional variational autoencoder module is used to take the smart city entity embedding vector as input and output the property prediction result of the unknown smart city entity relationship; wherein:

[0079] The conditional variational autoencoder module, whose encoder is used to map the input feature vector x to a latent variable distribution z, generates a conditional probability q φ (z|x) is:

[0080]

[0081] In the formula, μ φ (x) and denote the mean and variance of the latent variables, respectively;

[0082] The conditional variational autoencoder module, whose decoder generates an output feature vector x′ based on the latent variable, and the conditional distribution p of the output feature vector x′ is θ (x′|z) is:

[0083]

[0084] In the formula, μ θ (z) and denote the mean and variance of the output feature vector based on the latent variable z, respectively.

[0085] It may further include: a contrast denoising autoencoder module, which is used to decompose the input property prediction result vector into a relationship-related sub-vector and a relationship-irrelevant sub-vector, and isolate and remove noise from the prediction result; wherein:

[0086] Compared with the denoising autoencoder module, the input property prediction result vector is decomposed to obtain the relationship-related sub-vector (rs) and the relationship-irrelevant sub-vector (is); where:

[0087] The original result vector x of the input is compared with the encoder E of the denoising self-encoder module Ψ Mapped to a subvector in the latent space, expressed as:

[0088]

[0089] Where s represents the complete potential embedding vector generated by the contrastive denoising autoencoder module, rs represents the sub-vector that captures relation-related information, is represents the noise information sub-vector that is irrelevant to the relation, and the symbol It means that the relation-related sub-vector rs and the relation-irrelevant sub-vector is are concatenated to form a complete smart city entity embedding vector;

[0090] Comparison of the decoder D of the denoising autoencoder module ω Reconstruct the subvectors:

[0091]

[0092] In the formula, x * Represents the reconstruction vector.

[0093] S3. Use the initial embedding vectors of entities and relationships to train the relation embedding generation model through a contrastive learning algorithm, and continuously optimize the parameters of the relation embedding generation model according to the output of the relation embedding generation model to obtain a smart city entity knowledge graph completion model;

[0094] The following operations may further be included:

[0095] S31, constructing a training sample set using the initial embedding vectors of entities and relations, where the training sample set includes normal relation instances and potential unseen relation instances;

[0096] S32. Using the training sample set, the relation embedding generation model is trained by the contrastive learning algorithm. The contrastive learning algorithm enhances the clustering of entity pairs with the same relation in the latent space by minimizing the loss function, while separating entity pairs with different relations. It is expressed as:

[0097]

[0098] Among them, the loss function l is defined as:

[0099]

[0100] Where D represents the distance function (here is the cosine distance), Δ∈[0,2] is the relaxation hyperparameter, represents samples generated from the conditional distribution of relation r, Represents the corresponding relationship The centroid vector of . This contrast loss aims to reduce the overlap of embedding distributions of different relations;

[0101] S33. The optimization goal of the conditional variational autoencoder module is to maximize the reconstruction accuracy and minimize the KL divergence between the potential distribution of the encoder output and the standard normal distribution. The reconstruction loss function L of the conditional variational autoencoder module is cvae for:

[0102]

[0103] Where, L cvae represents the total loss function of the conditional variational autoencoder module, which consists of two parts: reconstruction loss and KL divergence; p(z) represents the prior distribution of the latent variable z;

[0104] In some preferred implementations, the above S3 may further include the following operations:

[0105] S34, the optimization goal of the denoising autoencoder module is to evaluate the original input vector x and the reconstructed vector x * The difference between them can optimize the reconstruction accuracy of the model, and then compare the reconstruction loss function L of the denoising autoencoder module recon for:

[0106] L recon =||xx * ||

[0107] Here, the symbol ||·|| indicates the calculation of the norm between vectors.

[0108] S35, by jointly optimizing the above loss function L cvae and / or L recon , adjust the parameters of each encoder and decoder of the relation embedding generation model to obtain the smart city entity knowledge graph completion model.

[0109] S4. Use the smart city entity knowledge graph completion model to predict the properties of the unknown smart city entity relationships corresponding to the input smart city entities, obtain the state of each entity relationship in the knowledge graph, and then use it to complete the smart city entity knowledge graph;

[0110] The following operations may also be further included:

[0111] S41. Predicting the properties of unknown smart city entity relationships corresponding to the input smart city entities using the smart city entity knowledge graph completion model to obtain relationship prediction results;

[0112] S42, processing the relationship prediction results, and dividing the processed relationship prediction results into normal and abnormal categories according to a preset threshold, obtaining the relationship status of each entity in the knowledge graph, and identifying possible abnormal situations and relationship error types;

[0113] Processing the relationship prediction results may further include the following operations:

[0114] S421. According to the relationship prediction result, the relationship status in the knowledge graph is divided into different categories or states;

[0115] S422, performing fault diagnosis on the relationship in the knowledge graph according to the relationship prediction result;

[0116] S423. Based on the relationship prediction results, real-time monitoring of the relationships in the knowledge graph is performed;

[0117] S424. Based on the relationship prediction results, identify and analyze the relationships in the knowledge graph.

[0118] like Figure 2 As shown, in this embodiment, first, by analyzing the text description of smart city entities, the initial embedding vectors of entities and relationships are extracted. These embedding vectors represent important smart city entity concepts and their relationships in the smart city entity knowledge graph, providing basic data for subsequent relationship prediction.

[0119] Next, a relation embedding generation model is constructed using a conditional variational autoencoder (C-VAE). C-VAE accepts smart city entity pairs as input, learns latent distribution features through the encoder, and generates relation embeddings using the decoder. In this process, C-VAE achieves accurate prediction of unknown smart city entity relationships through contrastive loss optimization and structured representation of the latent space. To further improve the accuracy of the model, the model introduces a contrastive denoising autoencoder to decompose the entity pair embedding into a relation-related subvector (rs) and a relation-irrelevant subvector (is). Among them, the rs subvector focuses on capturing key information related to the target relationship, while the is subvector isolates irrelevant noise information, effectively reducing the interference caused by neighboring entities or irrelevant features, thereby improving the ability to distinguish relationship predictions. The close integration of these modules with the knowledge graph, especially through the separation of rs and is, can dynamically adjust the learning process of the model, so that it can maintain efficient and accurate prediction performance in the ever-changing smart city entity data environment. This approach ensures that the model can not only adapt to the complexity and dynamic changes of smart city entity data, but also play an important role in real-time diagnosis support.

[0120] Finally, the model output is further optimized. The model parameters are adjusted through the gradient descent method, and the model performance is evaluated and optimized by combining cross-validation and other technologies to ensure that the final output relationship prediction results are accurate, thereby achieving accurate completion and expansion of the smart city entity knowledge graph.

[0121] Through the above innovative design, the present invention constructs a dynamically adaptive and highly accurate smart city entity knowledge graph completion method, which can effectively support the updating and discovery of smart city entity knowledge and significantly improve the quality and efficiency of smart city entity services.

[0122] Specifically, the smart city entity knowledge graph completion method is based on contrastive learning and conditional variational autoencoder (C-VAE), and specifically includes the following steps:

[0123] First, the collected smart city entity data or text materials are preprocessed and feature extracted. Preprocessing includes steps such as data cleaning, denoising and normalization to ensure the quality and availability of data. Feature extraction focuses on extracting effective information that can reflect entity and relationship characteristics from raw data, such as sensor entity data, event entity and traffic entity information.

[0124] Then, the conditional variational autoencoder (C-VAE) is used to perform density estimation and probability modeling on the extracted features, thereby revealing the distribution law and potential structure of the data.

[0125] On this basis, the contrastive denoising autoencoder is introduced to decompose the extracted embedding vector into relation-related subvectors (rs) and relation-independent subvectors (is). Specifically, the input embedding vector x is passed through the encoder E Ψ Mapped to a subvector in the latent space:

[0126]

[0127] Among them, rs represents the sub-vector that captures the information related to the relationship, is represents the noise information sub-vector that is irrelevant to the relationship, and the symbol It means that the relation-related sub-vector rs and the relation-independent sub-vector is are concatenated to form a complete embedding vector. Then, the decoder D ω The sub-vectors are reconstructed to ensure that the separated vectors can retain the effective information of the original embedding:

[0128]

[0129] The parameters of the encoder and decoder are adjusted by optimizing the following reconstruction loss function to ensure that rs focuses on valid relationship information and is effectively isolates irrelevant noise. The symbol ||·|| represents the norm between the calculated vectors, which is used to evaluate the difference between the original vector x and the reconstructed vector x*, thereby optimizing the reconstruction accuracy of the model:

[0130] L recon =||xx * ||

[0131] In addition, the working mechanism of C-VAE can be described as follows: the encoder maps the input feature x to a latent variable distribution z, and the generated conditional probability is:

[0132]

[0133] Among them, μ φ (x) and Denote the mean and variance of the latent variables respectively. The decoder generates the output feature x′ based on the latent variables, and its conditional distribution is:

[0134]

[0135] The goal of C-VAE is to maximize the reconstruction accuracy and minimize the KL divergence between the latent distribution of the encoder output and the standard normal distribution:

[0136]

[0137] By combining C-VAE and contrastive denoising autoencoder, the model can effectively capture the complex nonlinear relationships between entities and relations, thereby making more accurate predictions for unknown relations.

[0138] After completing preprocessing and feature extraction, a training sample set is constructed based on the obtained data, which contains normal relationship instances and potential unseen relationship instances. Using these sample data, a feature encoder is constructed through a contrastive learning algorithm to learn and optimize the feature representation of entities and relationships, so that the model can adaptively adjust the network structure in a complex feature space and better express the intrinsic characteristics of the data. During the training process, a contrastive denoising autoencoder is introduced to further optimize the output of the feature encoder, by separating the relationship-related subvector (rs) and the relationship-irrelevant subvector (is), ensuring that the model captures effective information while isolating irrelevant noise.

[0139] The goal of contrastive learning is to enhance the clustering of entity pairs of the same relation in the latent space by optimizing the contrastive loss function, while separating entity pairs of different relations. Specifically, contrastive learning uses the following loss function:

[0140]

[0141] Among them, the loss function l is defined as:

[0142]

[0143] Where D represents the distance function (here is the cosine distance), Δ∈[0,2] is the relaxation hyperparameter, represents samples generated from the conditional distribution of relation r, Represents the corresponding relationship The contrast loss is designed to reduce the overlap of embedding distributions of different relations. By minimizing the contrast loss, the model can effectively enhance the similarity of entity pairs of the same relation and separate entity pairs of different relations in the latent space.

[0144] In addition, the model output is further optimized by using RS and IS separated by the contrastive denoising autoencoder to ensure that RS focuses on capturing key relationship information, while IS effectively isolates irrelevant noise. In this way, the model can not only dynamically adapt to the changes in complex smart city entity data, but also capture and analyze important changes in event records during processing, thus providing a solid foundation for relationship inference and knowledge graph completion.

[0145] By combining key smart city entity parameters (such as event records and traffic information) with the algorithm's preprocessing and feature extraction steps, important changes in event records can be captured and analyzed in real time. This combination enables the algorithm to not only process static data, but also dynamically adapt to the actual application status of smart city entity knowledge, laying a solid foundation for subsequent relationship inference and knowledge graph completion.

[0146] Based on the constructed feature encoder, the conditional variational autoencoder (C-VAE) is used to perform density estimation and probability modeling for each entity-relationship pair. C-VAE encodes the input entity and relationship pairs, learns the distribution features in the latent space, quantifies the similarity and connection between entity pairs, and reconstructs the data through a generative model. This probabilistic modeling process can better reveal the complex nonlinear connections between entities and relationships, and further improve the topological structure of the knowledge graph.

[0147] In order to improve the model's ability to distinguish different relationships, a contrastive denoising autoencoder is combined in the model. The autoencoder decomposes the embedding vector of the entity pair into a relationship-related subvector (rs) and a relationship-irrelevant subvector (is). By isolating the noise, it effectively removes the interference caused by neighboring entities or other irrelevant information. This separation enables the model to more accurately describe the distribution and category information of entities and relationships.

[0148] In the specific implementation, the encoder q of C-VAE φ (z|x) maps the input features to the distribution of latent variables z, and the decoder p θ (x ′ |z) generates reconstructed features based on the latent variable. Combined with the decomposed rs and is, the model can significantly reduce the impact of noise on relationship prediction while maintaining useful relationship information. Through this combination, C-VAE can not only capture the complex interactions between entities and relationships, but also improve the ability to identify relationships through the denoising process, providing a more reliable foundation for subsequent relationship inference.

[0149] This method, which integrates C-VAE and contrastive denoising autoencoder, effectively improves the model's ability to capture relational features and suppress noise, enabling it to more accurately model the relationships in the knowledge graph, thereby providing stronger support for the inference of unknown relationships and the completion of the knowledge graph.

[0150] The preprocessed and feature-extracted data is input into the constructed contrastive learning, contrastive denoising autoencoder and conditional variational autoencoder (C-VAE) for joint training. During the training process, the model optimizes the feature encoder through contrastive learning to maximize the similarity between samples with the same relationship and minimize the similarity between samples with different relationships, thereby enhancing the model's ability to distinguish relationships.

[0151] In model training, the contrastive denoising autoencoder further optimizes the feature expression by decomposing the entity pair embedding into a relation-related sub-vector (rs) and a relation-irrelevant sub-vector (is). Through this separation, the model can effectively remove noise and ensure that rs focuses on capturing key relational information, while is isolates irrelevant interference, thereby improving the accuracy and robustness of relational prediction.

[0152] During the training process, C-VAE uses the encoder to probabilistically model the input entity relationship pairs, learns their potential distribution, and reconstructs these relationship pairs through the decoder. The target loss of C-VAE includes reconstruction loss and KL divergence loss, which are used to ensure that the generated relationship embedding is consistent with the original input data while avoiding excessive concentration or diffusion of the distribution in the latent space. Its loss function is as follows:

[0153]

[0154] By jointly optimizing the contrast loss, C-VAE loss, and contrastive denoising autoencoder loss, the model further improves the ability to suppress noise while capturing complex relational structures. The contrast loss ensures that entity pairs with the same relation are clustered in the latent space, while entity pairs with different relations are effectively separated, thereby improving the prediction ability of unseen relations.

[0155] During the training process, the model uses cross-validation technology to adjust and optimize parameters to ensure the stability and efficiency of the model under various data distributions. Through such multi-level loss optimization, the model can not only accurately complete known relationships, but also effectively infer unknown relationships, thereby improving the overall integrity and application value of the knowledge graph.

[0156] This method of comprehensive contrastive learning, denoising and probabilistic modeling enables the model to more accurately cope with complex relationships and data changes in the knowledge graph, providing a strong technical foundation for knowledge graph completion and relationship inference.

[0157] Compare the results of the relational embedding generation model output and perform further follow-up operations. The detailed operations are as follows: Based on the output of the relational embedding generation model, count and analyze the status information of each knowledge graph entity relationship, and divide the relationship status into normal and abnormal categories according to the pre-set threshold. By analyzing the relationship status of each entity in the knowledge graph, it is possible to effectively identify possible abnormal situations and relationship error types. In order to improve the accuracy and robustness of the analysis, a contrastive denoising autoencoder is introduced to further process the model output. By separating the relationship-related subvector (rs) and the relationship-irrelevant subvector (is), the noise introduced by neighboring entities or irrelevant information is effectively removed to ensure the accuracy and stability of the status judgment. Specifically, the following methods can be used to process the results of the model output:

[0158] Classification judgment: According to the output results of the model optimized by the contrast denoising autoencoder, the relationship status in the knowledge graph is divided into different categories or states. For example, the relationship status between entities is divided into different categories such as normal, abnormal, and unknown for subsequent processing and analysis.

[0159] Fault diagnosis: According to the output results of the optimized model, fault diagnosis is performed on the relations in the knowledge graph. By analyzing the related sub-vectors (rs) of the separated relations, it is possible to more accurately determine whether there are abnormalities or errors in certain relations, and further determine the type and cause of the error.

[0160] Real-time monitoring: Use the denoised model output to monitor the relationships in the knowledge graph in real time. By continuously inputting new entity data and inferring and analyzing their relationships, the integrity and accuracy of the knowledge graph can be more accurately monitored in real time, and potential problems and anomalies can be discovered and handled in a timely manner.

[0161] Decision support: Based on the model output results processed by the contrast denoising autoencoder, decision support is provided for the expansion and maintenance of the knowledge graph. By identifying and analyzing the relationships in the knowledge graph, more accurate reference opinions and suggestions can be provided for the operation and management of the knowledge graph, helping to improve the application efficiency and accuracy of the knowledge graph.

[0162] By closely combining the contrastive zero-shot relational learning model with the contrastive denoising autoencoder, the model can not only accurately identify conventional relations, but also adjust the recognition strategy in a timely manner when abnormal changes occur in data characteristics. This combination of real-time monitoring and knowledge graph data, especially through the separation of RS and IS, effectively improves the accuracy and response speed of knowledge graph completion, ensuring the integrity and practicality of the knowledge graph.

[0163] The contrastive denoising autoencoder decomposes the entity pair embedding into a relation-related subvector (rs) and a relation-irrelevant subvector (is), effectively removing irrelevant information introduced by neighboring entities or other noise sources, thereby enhancing the accuracy of the analysis of relational states and features. The autoencoder module further includes a semantic contrastive network (SCN), the purpose of which is to ensure that the relation-related subvector (rs) retains as much useful relational information as possible, while the relation-irrelevant subvector (is) is strictly limited to not containing information related to the target relation, ensuring effective isolation of noise. Through this separation and processing, the model can achieve higher accuracy and generalization ability when performing knowledge graph completion.

[0164] Based on the above method, Figure 3 As shown, the smart city entity knowledge graph completion system in this embodiment includes the following modules:

[0165] Basic data acquisition module, which is used to extract features from text descriptions of smart city entities and obtain initial embedding vectors of entities and relationships;

[0166] A relation embedding generation model module, which is used to provide a relation embedding generation model based on a conditional variational autoencoder. The relation embedding generation model is used to take a smart city entity as input and output a property prediction result of an unknown smart city entity relationship;

[0167] Model training module: This module uses the initial embedding vectors of entities and relationships to train the relationship embedding generation model through a contrastive learning algorithm, and continuously optimizes the parameters of the relationship embedding generation model according to the output of the relationship embedding generation model to obtain a smart city entity knowledge graph completion model;

[0168] The relationship prediction module uses the smart city entity knowledge graph completion model to predict the properties of the unknown smart city entity relationships corresponding to the input smart city entities, obtain the state of each entity relationship in the knowledge graph, and then use it to complete the smart city entity knowledge graph.

[0169] A smart city entity knowledge graph completion device, comprising: at least one memory and at least one processor;

[0170] The at least one memory is used to store a machine-readable program;

[0171] The at least one processor is used to call the machine-readable program to execute the smart city entity knowledge graph completion method.

[0172] An embodiment of the present invention further provides a computer terminal, comprising a memory, a processor, and a computer program stored in the memory and executable on the processor. When the processor executes the computer program, the processor can be used to execute any method of the above-mentioned embodiments of the present invention, or to run any system of the above-mentioned embodiments of the present invention.

[0173] Optionally, the memory is used to store programs; the memory may include volatile memory (English: volatile memory), such as random-access memory (English: random-access memory, abbreviated: RAM), such as static random-access memory (English: static random-access memory, abbreviated: SRAM), double data rate synchronous dynamic random access memory (English: Double Data Rate Synchronous Dynamic Random Access Memory, abbreviated: DDR SDRAM), etc.; the memory may also include non-volatile memory (English: non-volatile memory), such as flash memory (English: flash memory). The memory is used to store computer programs (such as applications, functional modules, etc. that implement the above method), computer instructions, etc., and the above computer programs, computer instructions, etc. can be partitioned and stored in one or more memories. And the above computer programs, computer instructions, data, etc. can be called by the processor.

[0174] The above-mentioned computer programs, computer instructions, etc. may be stored in one or more memories in partitions, and the above-mentioned computer programs, computer instructions, data, etc. may be called by a processor.

[0175] The processor is used to execute the computer program stored in the memory to implement the various steps of the method or various modules of the system involved in the above embodiments. For details, please refer to the relevant descriptions in the above method and system embodiments.

[0176] The processor and the memory may be independent structures or integrated structures. When the processor and the memory are independent structures, the memory and the processor may be coupled and connected via a bus.

[0177] An embodiment of the present invention further provides a computer-readable storage medium having a computer program stored thereon. When the computer program is executed by a processor, it can be used to execute any method of the above embodiments of the present invention, or to run any system of the above embodiments of the present invention.

[0178] Among them, computer-readable media include computer storage media and communication media, wherein the communication media include any media that facilitates the transmission of computer programs from one place to another. The storage medium can be any available medium that can be accessed by a general or special-purpose computer. An exemplary storage medium is coupled to the processor so that the processor can read information from the storage medium and write information to the storage medium. Of course, the storage medium can also be an integral part of the processor. The processor and the storage medium can be located in an ASIC. In addition, the ASIC can be located in a user device. Of course, the processor and the storage medium can also be present in a communication device as discrete components.

[0179] The smart city entity knowledge graph completion method, system, terminal and medium provided by the above embodiments of the present invention, by closely combining the contrast zero-sample relationship learning model with the contrast denoising autoencoder, the model can not only accurately identify conventional relationships, but also timely adjust the recognition strategy when abnormal changes occur in data characteristics. This combination of real-time monitoring and knowledge graph data, especially through the separation of RS and IS, effectively improves the accuracy and response speed of knowledge graph completion, and ensures the integrity and practicality of the knowledge graph. These adjustments include dynamically optimizing model parameters to adapt to new smart city entity data, automatically completing missing relationship information, and adjusting the prediction strategy of the diagnostic model to ensure the latest and accuracy of smart city entity knowledge. By combining the contrast denoising autoencoder and the conditional variational autoencoder (C-VAE), the model can automatically process complex nonlinear relationships in the knowledge graph, optimize the separation of relationship-related subvectors (RS) and irrelevant subvectors (IS), and effectively eliminate the interference of noise on relationship prediction. This collaborative processing method not only significantly improves the efficiency and accuracy of graph completion, but also enhances the system's responsiveness to dynamic smart city entity data, and realizes the precise expansion of smart city entity knowledge. Through innovative algorithm design, contrastive learning is combined with generative modeling technology, which effectively solves the shortcomings of traditional knowledge graph construction methods in dealing with complex data distribution and completing unseen relationships. It can automatically adapt to the dynamic changes of smart city entity data, which is of great significance to improving the efficiency and reliability of smart city entity diagnosis.

[0180] The above-mentioned specific implementations are only specific cases of the present invention. The patent protection scope of the present invention includes but is not limited to the above-mentioned specific implementations. Any technical solutions that conform to the above-mentioned specific implementations of the present invention and any appropriate changes or substitutions made by ordinary technicians in the relevant technical field shall fall within the patent protection scope of the present invention.

[0181] Although embodiments of the present invention have been shown and described, it will be appreciated by those skilled in the art that various changes, modifications, substitutions and variations may be made to the embodiments without departing from the principles and spirit of the present invention, and that the scope of the present invention is defined by the appended claims and their equivalents.

Claims

1. A method for completing the knowledge graph of smart city entities, characterized in that: The steps are as follows: S1. Extract features from the text description of smart city entities to obtain initial embedding vectors of entities and relationships; S2. Using a relation embedding generation model based on a conditional variational autoencoder, the relation embedding generation model takes a smart city entity embedding vector as input and outputs a property result of an unknown smart city entity relationship; S3. Use the initial embedding vectors of entities and relationships to train the relation embedding generation model through a contrastive learning algorithm, and continuously optimize the parameters of the relation embedding generation model according to the output of the relation embedding generation model to obtain a smart city entity knowledge graph completion model; S4. Use the smart city entity knowledge graph completion model to predict the properties of the unknown smart city entity relationships corresponding to the input smart city entities, obtain the state of each entity relationship in the knowledge graph, and then use it to complete the smart city entity knowledge graph.

2. The smart city entity knowledge graph completion method according to claim 1 is characterized in that: In step S1, the smart city entity data or text data is obtained and preprocessed and feature extracted, wherein: S11, preprocessing, including data cleaning, denoising and normalization; S12: Feature extraction, which is used to extract effective information that can reflect the characteristics of entities and relationships from the original data to obtain the initial embedding vectors of entities and relationships.

3. The method for completing the smart city entity knowledge graph according to claim 2 is characterized in that: In step S2, the relationship embedding generation model based on conditional variational autoencoder includes: a conditional variational autoencoder module, the conditional variational autoencoder module is used to take the smart city entity embedding vector as input and output the property prediction result of the unknown smart city entity relationship; wherein: The conditional variational autoencoder module, whose encoder is used to map the input feature vector x to a latent variable distribution z, generates a conditional probability q φ (z|x) is: In the formula, μ φ (x) and Respectively represent the mean and variance of the input feature vector; The conditional variational autoencoder module, whose decoder generates an output feature vector x′ according to the latent variable, and the conditional distribution p of the output feature vector x′ θ (x′|z) is: In the formula, μ θ (z) and denote the mean and variance of the output feature vector based on the latent variable z, respectively.

4. The method for completing the smart city entity knowledge graph according to claim 3 is characterized in that: The relation embedding generation model based on conditional variational autoencoder further includes: a contrastive denoising autoencoder module, which is used to decompose the input property prediction result vector into a relation-related sub-vector and a relation-irrelevant sub-vector, and isolate and remove noise from the prediction result; wherein: The contrast denoising autoencoder module decomposes the input property prediction result vector to obtain a relation-related subvector (rs) and a relation-irrelevant subvector (is); wherein: The original result vector x of the input passes through the encoder E of the contrast denoising autoencoder module Ψ Mapped to a subvector in the latent space, expressed as: Where s represents the encoder E of the denoising autoencoder Ψ The generated embedding vector in the latent space is a representation of the original input vector x, rs represents the sub-vector that captures the relationship-related information, is represents the noise information sub-vector that is irrelevant to the relationship, and the symbol It means that the relation-related sub-vector rs and the relation-irrelevant sub-vector is are connected to form a complete smart city entity embedding vector; The decoder D of the contrastive denoising autoencoder module ω Reconstruct the subvectors: In the formula, x * Represents the reconstruction vector.

5. The method for completing the smart city entity knowledge graph according to claim 4 is characterized in that: In step S3, the following operations are further included: S31, constructing a training sample set using the initial embedding vectors of entities and relations, where the training sample set includes normal relation instances and potential unseen relation instances; S32. Using the training sample set, the relation embedding generation model is trained by the contrastive learning algorithm. The contrastive learning algorithm enhances the clustering of entity pairs with the same relation in the latent space by minimizing the loss function, while separating entity pairs with different relations. It is expressed as: Among them, the loss function l is defined as: Where D represents the distance function, Δ∈[0,2] is the relaxation hyperparameter, represents samples generated from the conditional distribution of relation r, Represents the corresponding relationship The contrast loss aims to reduce the overlap of embedding distributions of different relations. S33. The optimization goal of the conditional variational autoencoder module is to maximize the reconstruction accuracy and minimize the KL divergence between the potential distribution of the encoder output and the standard normal distribution. The reconstruction loss function L of the conditional variational autoencoder module is cvae for: Where, L cvae represents the total loss function of the conditional variational autoencoder module, which consists of two parts: reconstruction loss and KL divergence; p(z) represents the prior distribution of the latent variable z; S34, the optimization goal of the contrast denoising autoencoder module is to evaluate the original input vector x and the reconstructed vector x * The difference between them can optimize the reconstruction accuracy of the model, and then compare the reconstruction loss function L of the denoising autoencoder module recon for: L recon =||x-x * || In the formula, the symbol ||·|| indicates the norm between the calculated vectors; S35. By jointly optimizing the above loss function L cvae and / or L recon , adjust the parameters of each encoder and decoder of the relation embedding generation model to obtain the smart city entity knowledge graph completion model.

6. The method for completing the smart city entity knowledge graph according to claim 5 is characterized in that: In step S4, the following operations are further included: S41, using the smart city entity knowledge graph completion model to predict the properties of the unknown smart city entity relationship corresponding to the input smart city entity, and obtain a relationship prediction result; S42, process the relationship prediction results, and divide the processed relationship prediction results into normal and abnormal categories according to a preset threshold, obtain the relationship status of each entity in the knowledge graph, and identify possible abnormal situations and relationship error types.

7. The method for completing the smart city entity knowledge graph according to claim 6, characterized in that: In step S42, the relationship prediction result is processed, further comprising: S421. According to the relationship prediction result, the relationship status in the knowledge graph is divided into different categories or states; S422, performing fault diagnosis on the relationship in the knowledge graph according to the relationship prediction result; S423. Based on the relationship prediction results, real-time monitoring of the relationships in the knowledge graph is performed; S424. Based on the relationship prediction results, identify and analyze the relationships in the knowledge graph.

8. Smart city entity knowledge graph completion system, characterized by: It includes basic data acquisition module, relation embedding generation model module, model training module and relation prediction module; The basic data acquisition module is used to extract features from the text description of smart city entities to obtain initial embedding vectors of entities and relationships; The relation embedding generation model module is used to provide a relation embedding generation model based on a conditional variational autoencoder, and the relation embedding generation model is used to take a smart city entity as input and output a property prediction result of an unknown smart city entity relationship; The model training module is used to train the relationship embedding generation model by using the initial embedding vectors of entities and relationships through a contrastive learning algorithm, and continuously optimize the parameters of the relationship embedding generation model according to the results output by the relationship embedding generation model to obtain a smart city entity knowledge graph completion model; The relationship prediction module is used to use the smart city entity knowledge graph completion model to predict the properties of the unknown smart city entity relationship corresponding to the input smart city entity, obtain the state of each entity relationship in the knowledge graph, and then use it to complete the smart city entity knowledge graph.

9. A smart city entity knowledge graph completion device, characterized in that: include: at least one memory and at least one processor; The at least one memory is used to store a machine-readable program; The at least one processor is configured to call the machine-readable program to execute the method according to any one of claims 1 to 7.

Citation Information

Cited By

  • Multimodal model semantic enhancement and comparative learning method based on colored lamp knowledge graph

    CN120911481A

  • Multi-modal model semantic enhancement and contrast learning method based on color light knowledge graph

    CN120911481B