Method for constructing knowledge database for power billing system
By constructing attribute drift values and semantic associations and optimizing entity alignment thresholds, the problem of poor entity fusion performance of existing knowledge databases in electricity billing and payment systems is solved, achieving more efficient knowledge database updates and entity alignment.
Patent Information
- Application Number
- CN202611674329.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2026-10-28
- Publication Date
- 2026-11-27
AI Technical Summary
Existing knowledge databases are ill-suited to the complex changes in electricity billing data in electricity billing and payment systems, resulting in poor entity fusion and impacting the efficiency of knowledge resource utilization and intelligent processing capabilities.
By analyzing the degree of attribute differences and periodicity of each entity in historical billing cycles, attribute drift values and semantic associations are constructed, and entity alignment thresholds are optimized to achieve adaptive entity clustering and fusion.
It improves the accuracy of knowledge database construction and entity alignment, and enhances the stability and update efficiency of knowledge structures.
Smart Images

Figure CN123178372A_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of intelligent processing technology for power data, specifically to a method for constructing a knowledge database for power billing and payment systems. Background Technology
[0002] As the electricity market continues to expand, the types of rules, business relationships, and data volume in electricity billing operations are constantly increasing, and the relationships between knowledge data are becoming increasingly complex. Knowledge databases are a crucial foundation for supporting intelligent analysis and business reasoning in electricity billing and payment systems. However, existing knowledge databases struggle to adapt to the complex changes in electricity billing data during their construction, which in turn affects the efficiency of knowledge resource utilization and intelligent processing capabilities.
[0003] Because the knowledge database in an electricity billing and payment system needs to continuously receive new data from each billing cycle, its construction typically requires merging newly collected entity data with historical knowledge entities and incrementally updating historical entities. Existing technologies mostly use a fixed similarity threshold for entity alignment, but they do not fully consider the differences in changes across time caused by variations in electricity consumption patterns, electricity price discounts, and business rules. If a fixed threshold is still used for entity fusion, it may lead to over-fusion or ineffective merging, resulting in entity fragmentation and reducing the accuracy of the knowledge database construction and subsequent knowledge reasoning capabilities. Summary of the Invention
[0004] To address the aforementioned technical problems, this application provides a method for constructing a knowledge database for electricity billing and payment systems, thereby resolving the existing issues.
[0005] The knowledge database construction method for electricity billing and payment systems proposed in this application adopts the following technical solution: One embodiment of this application provides a method for constructing a knowledge database for an electricity billing and payment system, the method comprising the following steps: The structured and unstructured data of the electricity billing and payment system are acquired; an initial knowledge database is constructed based on all structured and unstructured data from historical billing cycles. Based on the degree of difference between each entity's attributes in each billing cycle and the same type of attributes in the previous billing cycle in the initial knowledge database, a distance coefficient is constructed; by analyzing the magnitude and periodicity of the distance coefficient of each entity in all historical billing cycles, the attribute drift value of each entity is determined. Analyze the degree of difference between attribute drift values of different entities and the degree of correlation between distance coefficients of different entities across all historical billing periods to construct the historical differences between each entity and other entities; Obtain the corresponding attributes of each entity in other entities; analyze the commonality and similarity of all attributes and their corresponding attributes in different entities, as well as the consistency between the entities associated with different entities in the initial knowledge database, construct the semantic association between each entity and other entities, and combine the historical differences to cluster all entities to obtain multiple entity clusters. By utilizing the attribute drift values of all entities in each entity cluster, the entity alignment threshold of each entity cluster in the StructBERT model is optimized, and then the initial knowledge database is updated using each entity in the current billing cycle.
[0006] As a preferred embodiment, the method for constructing the initial knowledge database is as follows: The unstructured data for each billing period is segmented into words to obtain the corresponding text data; Entity extraction, relation extraction, and attribute extraction are performed on all structured and text data within each billing cycle. All attribute information corresponding to each entity is converted into word vectors. According to the data collection order of each attribute, the word vectors corresponding to all attributes of each entity in each billing period are concatenated in sequence to obtain the attribute set of each entity in each billing period. Based on the attribute set of each entity within a preset number of historical billing periods, the entity fusion model is used to perform cross-period entity alignment and fusion on all entities extracted within the preset number of historical billing periods to obtain an initial knowledge database.
[0007] As a preferred embodiment, the method for constructing the distance coefficient is as follows: The word vectors corresponding to all attributes of each entity in all historical billing periods are used as input to the HDBSCAN clustering algorithm for adaptive clustering, resulting in several clusters. Calculate the Euclidean distance between each attribute of each entity in each billing period and all attributes in its cluster that belong to the previous billing period, and record the mean of all Euclidean distances as the distance coefficient of each attribute of each entity in each billing period.
[0008] As a preferred embodiment, the method for constructing the attribute drift values of each entity is as follows: Calculate the mean of the distance coefficients of all attributes for each entity in each billing cycle, and arrange the mean values of each entity in all historical billing cycles in chronological order of each billing cycle, and record them as the cycle offset sequence of each entity. The periodic offset sequence of each entity is used as the input to the autocorrelation function, with the difference between adjacent hysteresis quantities being 1, and a series of autocorrelation coefficients are output. The attribute drift values of each entity are positively correlated with the mean of the periodic offset sequence and negatively correlated with the maximum value among all autocorrelation coefficients.
[0009] As a preferred embodiment, the method for constructing the historical differences between the entities and other entities is as follows: Calculate the absolute difference between the attribute drift values of each entity and those of other entities; Calculate the Pearson correlation coefficient between each entity and the periodic offset sequences of other entities; The historical differences between each entity and other entities are positively correlated with the absolute difference and negatively correlated with the Pearson correlation coefficient.
[0010] As a preferred embodiment, the method for obtaining the corresponding attributes of each entity in other entities is as follows: Calculate the cosine similarity between each attribute of each entity and all attributes of all other entities, and record the attribute corresponding to the maximum cosine similarity as the corresponding attribute of each entity in the other entities.
[0011] As a preferred embodiment, the method for constructing the semantic associations between the entities and other entities is as follows: Cluster the word vectors corresponding to all attributes of all entities in the initial knowledge database to obtain several clusters; The ratio between the number of elements in the cluster of each attribute and the total number of elements in all clusters is recorded as the general weight of each attribute. Calculate the mean of the general weight of each attribute in each entity and the general weight of its corresponding attribute in other entities, and the cosine similarity between each attribute and the word vector of its corresponding attribute in other entities. The ratio of the cosine similarity to the mean is recorded as the similarity contribution of each attribute in each entity to other entities. Calculate the average contribution of all attributes of each entity to the similarity between each entity and other entities. The set of all entities directly connected to each entity in the initial knowledge database is denoted as the association set of each entity; the association sets of each entity and other entities are used as input to the SimRank algorithm, and the similarity between each entity and other entities is output. The semantic relevance between each entity and other entities is positively correlated with the mean of the similarity contribution and the relational similarity.
[0012] As a preferred embodiment, the method for obtaining the entity clusters is as follows: Construct a similarity index between each entity and other entities, wherein the similarity index is positively correlated with the semantic relevance and negatively correlated with the historical differences; All entities are used as input to the ANC algorithm. The sum of the similarity index between any two entities and the preset robustness factor is calculated, and the reciprocal of the sum is used as the distance metric between the two entities. This process is used to cluster all entities, and the resulting clusters are denoted as entity clusters.
[0013] As a preferred implementation, the specific formula for optimizing the entity alignment threshold of each entity cluster is as follows: In the formula, The optimized entity alignment threshold for the z-th entity cluster; This is the preset initial entity alignment threshold; Let be the mean of the attribute drift values of all entities within the z-th entity cluster; It is an exponential function with the natural constant e as the base; This is the preset parameter tuning factor.
[0014] As a preferred implementation, the specific process of updating the initial knowledge database through each entity in the current billing cycle is as follows: Calculate the semantic association between each entity and the central entity of all entity clusters in the current billing cycle, and take the entity cluster corresponding to the maximum semantic association as the cluster to which each entity belongs; The StructBERT model is used to perform entity alignment analysis on each entity in the current billing cycle and each entity in its own cluster. The entity alignment threshold is set to the optimized entity alignment threshold corresponding to the cluster. If any entity is successfully aligned with any historical entity in its cluster, the entity is merged into the incremental data of the corresponding historical entity, and the attribute content of the historical entity is updated to obtain the updated knowledge database. Otherwise, the entity is added as a new knowledge entity to the initial knowledge database and assigned to its corresponding cluster, thus obtaining the updated knowledge database.
[0015] This application has at least the following beneficial effects: This application addresses the problem of poor entity fusion performance caused by the use of fixed thresholds for alignment in existing technologies. It constructs attribute drift values for each entity by analyzing the degree of difference and periodicity of attributes across historical billing cycles, thereby enabling the analysis of the stability of attribute changes across different historical billing cycles. Furthermore, it constructs historical variability by analyzing the differences in attribute drift values between entities and other entities, as well as the correlation of attribute change characteristics, allowing for the assessment of the degree of evolutionary differences in attributes between different entities over historical periods. Semantic relevance is constructed by analyzing the commonality and similarity of attributes, as well as the associated entities of each entity, thereby analyzing the proximity of different entities at the attribute semantic and relational structure levels. A similarity index is then constructed to cluster all entities, enabling more accurate clustering of similar entities and improving the accuracy of subsequent entity alignment. Finally, the attribute drift values are used to optimize the entity alignment threshold for each entity cluster, enabling differentiated entity alignment for different types of entities, thus improving the entity fusion accuracy and knowledge structure stability during the knowledge database construction process. Attached Figure Description
[0016] Figure 1 A flowchart illustrating the steps involved in constructing a knowledge database for an electricity billing and payment system as provided in this application; Figure 2 A flowchart illustrating the process of obtaining similar indices between the entities provided in this application and other entities. Detailed Implementation
[0017] This application provides a method for constructing a knowledge database for an electricity billing and payment system, specifically, the following method is provided. Please refer to [link to relevant documentation]. Figure 1 The method includes the following steps: Step 1: Acquire structured and unstructured data from the electricity billing and payment system; construct an initial knowledge database.
[0018] This application deploys a data interface in the electricity billing and payment system to collect structured data in real time, such as user ID, user type, address, electricity consumption, electricity price, electricity price type (peak / valley / flat period electricity price), and transaction timestamp; at the same time, it acquires unstructured data, such as billing rule documents, electricity bill settlements, historical case documents, and promotional activity text data.
[0019] For unstructured data, this application uses the jieba word segmentation tool to segment each text data, and combines it with the Harbin Institute of Technology stop word list to remove stop words with no actual semantic value, thereby obtaining the corresponding text data.
[0020] Since the initial knowledge database needs to continuously receive newly generated data after its initial construction to ensure its timeliness and completeness and avoid deviating from the actual business state, it is necessary to match and align the newly acquired data with the existing historical entities in the knowledge database and incrementally update the entity content.
[0021] In this embodiment, the time interval for collecting all structured data is 5 seconds, and the time interval for collecting all unstructured data is 1 day; data is collected according to the billing cycle, and each billing cycle in this embodiment is 1 day.
[0022] It should be noted that when collecting unstructured data, since the addition and modification of document data are logged, only unstructured data that has been added or modified will be collected within the current billing cycle. Document data that has not been changed will not be collected repeatedly.
[0023] Obtain the previous M historical billing cycles (M is a preset number, ranging from 100 to 200, and 150 in this embodiment) of the current billing cycle. Taking the i-th billing cycle among the M historical billing cycles as an example, use the DeepDive knowledge extraction tool to extract entities, relations, and attributes from all structured data and text data collected in the i-th billing cycle, and construct triples based on the extraction results.
[0024] For each entity extracted within the i-th billing cycle, all attribute information corresponding to each entity is transformed into word vectors using a word vector model. The word vector model is not limited to Word2Vec or GloVe; this embodiment uses the Word2Vec model. Then, following the data collection order of each attribute, the word vectors corresponding to all attributes of each entity are concatenated sequentially to construct the attribute set of each entity within the i-th billing cycle. Similarly, the attribute sets of each entity in M historical billing cycles are obtained.
[0025] Based on the attribute sets of each entity over M historical billing periods, an entity fusion model is used to perform cross-period entity alignment and fusion of all entities within the M historical billing periods, thereby constructing an initial knowledge database. The entity fusion model is not limited to the MGeo address similarity model, the StructBERT model, or cosine similarity; this embodiment uses the StructBERT model, with default thresholds for the fusion parameters. The knowledge entities in the initial knowledge database include user entities, electricity price rule entities, case entities, and business rule entities, etc.
[0026] Step 2: Construct distance coefficients to determine the attribute drift values of each entity.
[0027] The entities in the initial knowledge database exhibit a clear clustering characteristic in the feature space. Taking user entities as an example, industrial users, commercial users, and residential users differ significantly in their electricity consumption patterns, applicable electricity pricing rules, and billing methods, causing different types of knowledge entities to naturally form their own relatively independent clustering regions in the feature space. Since some regions have densely distributed entities with highly similar features, while others have sparsely distributed entities with significantly different features, applying a fixed threshold for entity matching across all regions may lead to over-merging of similar but distinct entities in dense regions, while records belonging to the same entity in sparse regions may fail to be effectively merged due to excessively high thresholds, resulting in entity fragmentation. Therefore, adaptive entity matching based on the distribution characteristics of different clustering regions is necessary to improve the update efficiency and accuracy of the knowledge database during subsequent entity data fusion.
[0028] Furthermore, since different entities exhibit varying degrees of change over time, some entities show minimal change and stable status across multiple billing cycles, and new data collected from them typically maintains a high degree of similarity. Conversely, other entities experience continuous feature drift due to changes in electricity consumption behavior, electricity pricing rules, or business status, often resulting in significant differences between new data and these entities. Therefore, it is necessary to first analyze the stability of different entities by considering their historical changes over historical periods, thereby providing a basis for adjusting subsequent entity matching strategies.
[0029] The analysis takes the u-th entity in the initial knowledge database as an example. The word vectors corresponding to all attributes of the u-th entity across all historical billing periods are used as input to the HDBSCAN clustering algorithm for adaptive clustering, resulting in several clusters to distinguish the attribute categories. Then, taking the attributes of the u-th entity in the i-th billing period as examples, the Euclidean distance between each attribute of the u-th entity in the i-th billing period and all attributes in its respective cluster belonging to the previous billing period are calculated. The mean of all Euclidean distances is recorded as the distance coefficient of each attribute of the u-th entity in the i-th billing period, reflecting the degree of data change of each attribute of the u-th entity in the i-th billing period compared to the previous billing period.
[0030] It should be noted that if the u-th entity experiences a data update in the i-th billing cycle, resulting in an inconsistency in the number of attributes of the u-th entity in adjacent billing cycles, the distance coefficient of the newly added attribute will be set to the average of the distance coefficients of all other attributes in the i-th billing cycle.
[0031] Calculate the mean distance coefficient of all attributes of the u-th entity in each billing cycle; and arrange the mean values of the u-th entity in all historical billing cycles in chronological order of each billing cycle to construct the cycle offset sequence of the u-th entity; the mean value of the obtained cycle offset sequence represents the degree of change of attribute values of the u-th entity in multiple historical billing cycles. The larger the value, the more obvious the characteristic change of the u-th entity between all adjacent billing cycles, indicating that the entity is more likely to be in a state of change for a long time.
[0032] Furthermore, it is also necessary to consider the periodic changes in entity characteristics over time. Since electricity billing is affected by weekdays, holidays, and seasonal electricity consumption, the electricity consumption data of some entities will show obvious periodic changes in different periods. Therefore, it is necessary to distinguish between periodic fluctuations and persistent drift to avoid errors.
[0033] The periodic offset sequence of the u-th entity is used as input to the autocorrelation function, which outputs a series of autocorrelation coefficients. Each coefficient corresponds to a different lag, and the difference between adjacent lags is 1. The maximum value among all autocorrelation coefficients is denoted as the periodic strength of the u-th entity. The greater the periodic strength, the stronger the periodic repeatability of the characteristic changes of the u-th entity in different historical billing periods. That is, although there are certain differences between adjacent periods, the overall changes will still repeat according to a fixed period, and the changes in entity attributes are more inclined to periodic fluctuations rather than continuous drift.
[0034] In this embodiment, the hysteresis value ranges from [1, n], where n is taken from an empirical range of 60-90. In this embodiment, 90 is used, representing the number of billing cycles corresponding to a quarter. When the actual length of the periodic offset sequence of the observed entity is less than the upper limit of the hysteresis n, the range of the hysteresis value when the entity is input into the autocorrelation function is dynamically adjusted and limited to [1, L-1], where L is the actual length of the periodic offset sequence of the entity.
[0035] As a preferred implementation, attribute drift values for each entity are constructed based on the average level and periodicity of the distance coefficients of each entity across all historical billing periods. These values characterize the overall drift degree of all attributes of each entity across historical billing periods. The method for constructing the attribute drift values for each entity is as follows: The mean of the distance coefficients of all attributes for each entity in each billing period is calculated. The mean values for each entity across all historical billing periods are arranged chronologically according to the billing periods, and this is recorded as the periodic offset sequence for each entity. The periodic offset sequence is used as the input to an autocorrelation function, with the difference between adjacent lags being 1, and a series of autocorrelation coefficients are output. The attribute drift values of each entity are positively correlated with the mean of the periodic offset sequence and negatively correlated with the maximum value among all autocorrelation coefficients. A positive correlation means that the dependent variable increases as the independent variable increases, or decreases as the independent variable decreases. A negative correlation means that the dependent variable decreases as the independent variable increases, or increases as the independent variable decreases. This is determined by the actual application and is not specifically limited in this application.
[0036] In this embodiment, the attribute drift value of the u-th entity is denoted as... Its specific expression is: In the formula, Let be the attribute drift value of the u-th entity; Let be the mean of the periodic offset sequence of the u-th entity; Let be the periodic intensity of the u-th entity; It is an exponential function with the natural constant e as the base. The exponential function is used to handle values in the range [-2, 0]. Perform normalization; As a normalization function, this embodiment uses the minimum-maximum normalization method for normalization, and its minimum and maximum values are determined based on the corresponding parameter sets of all entities.
[0037] Attribute drift value is obtained through To reflect the magnitude of changes in an entity's attributes over historical periods; through This reflects the degree of cyclical repetition of entity attribute changes. There is a clear correlation between the two parameters: when the overall change in entity attributes is large, but the change has a clear cyclical pattern, it indicates that the entity is more likely to be in a stable cyclical fluctuation; while when the change in entity attributes is large, and the cyclical pattern is weak, it indicates that the entity is more likely to be in a state of irregular and continuous drift.
[0038] The attribute drift value characterizes the overall drift of all attributes of the u-th entity over historical billing periods. A larger value indicates more unstable changes in the attribute characteristics of the u-th entity across different periods, lacking a stable pattern of change. This suggests potentially significant differences in features between new data and the u-th entity. Therefore, it's necessary to avoid excessively increasing the entity matching threshold to prevent ineffective merging of entities from the same source. Conversely, a smaller value indicates a more stable overall state of the u-th entity. Therefore, it's advisable to appropriately increase the entity matching accuracy to prevent incorrect merging of different entities.
[0039] Step 3: Construct historical differences between each entity and other entities.
[0040] Furthermore, although the entities in the knowledge database have undergone entity alignment and fusion, the merged entities still possess different semantic features. Additionally, due to differences in attribute types and numbers among different entities, direct clustering analysis is not feasible, thus requiring further processing.
[0041] Take the u-th entity and the v-th entity in the initial knowledge database as an example.
[0042] Calculate the attribute drift value of the v-th entity according to the above method; then calculate the absolute difference between the attribute drift values of the u-th entity and the v-th entity. The obtained absolute difference can reflect the degree of difference between the two entities in their historical evolution. The smaller the value, the more consistent the change range of the two entities in the historical billing period, and the more likely they are to belong to the same type of entity.
[0043] Furthermore, considering that in the electricity sector, many entities do not change independently due to factors such as payment rules, peak and off-peak hours, and preferential policies, but rather experience significant interconnected changes.
[0044] Therefore, the correlation coefficient between the periodic offset sequences of the u-th entity and the v-th entity is calculated. The obtained correlation coefficient can reflect the degree of synchronous change of the two entities in the historical cycle. The larger the value, the more consistent the change trend.
[0045] The method for calculating the correlation coefficient is not limited to Pearson correlation coefficient, Spearman correlation coefficient, or cosine similarity. This embodiment uses Pearson correlation coefficient.
[0046] In a preferred implementation, historical variability between each entity and other entities is constructed based on the degree of difference between the attribute drift values of each entity and other entities, and the correlation between the distance coefficients of two entities across all historical billing periods. This historical variability characterizes the degree of collaborative variability between two entities in historical billing periods. The method for constructing historical variability between each entity and other entities is as follows: calculating the absolute difference between the attribute drift values of each entity and other entities; calculating the Pearson correlation coefficient between the periodic offset sequences of each entity and other entities; the historical variability between each entity and other entities is positively correlated with the absolute difference and negatively correlated with the Pearson correlation coefficient.
[0047] In this embodiment, the historical difference between the u-th entity and the v-th entity is denoted as . Its specific expression is: In the formula, The historical differences between the u-th entity and the v-th entity; This represents the absolute difference between the attribute drift values of the u-th entity and the v-th entity. Let be the Pearson correlation coefficient between the periodic offset sequences of the u-th entity and the v-th entity; This is a preset constant with a value greater than 1, used to prevent the denominator from being 0; in this embodiment, it is set to 1.1. As a normalization function, this embodiment uses the minimum-maximum normalization method for normalization, and its minimum and maximum values are determined based on the corresponding parameter sets between any two entities.
[0048] Historical differences are achieved through To reflect the degree of difference in the historical magnitude of change between two entities, through This reflects the degree of consistency between the historical trends of two entities. Historical difference can characterize the degree of coordination between two entities in historical billing periods; the smaller the value, the more consistent the trends of the two entities in historical billing periods, and the smaller the difference between the magnitudes of change, the greater the likelihood that they are the same type of entity.
[0049] Step 4: Construct semantic relationships between each entity and other entities, and combine historical differences to cluster all entities to obtain multiple entity clusters.
[0050] Furthermore, the semantic features of the entities can be combined for further analysis. If the u-th entity and the v-th entity belong to the same type, such as both being resident user entities, then their corresponding attribute structures usually have a high degree of consistency.
[0051] Using any attribute of the u-th entity as the target attribute, calculate the similarity between the target attribute and each attribute of the v-th entity, and record the attribute corresponding to the maximum similarity as the corresponding attribute s of the target attribute in the v-th entity. Similarly, obtain the corresponding attributes of each attribute of the u-th entity. The similarity calculation method is not limited to cosine similarity or Jaccard similarity; this embodiment uses cosine similarity.
[0052] Considering that different attributes have varying abilities to distinguish entity semantics, some attributes differ significantly among different entities and can more clearly reflect entity characteristics; while other attributes change little among different entities and contribute relatively little to entity differentiation. Therefore, a weighted analysis of the attribute similarity between entities can be performed by combining the contribution levels of different attributes.
[0053] The word vectors corresponding to all attributes of all entities in the initial knowledge database are used as input to the HDBSCAN clustering algorithm for adaptive clustering, resulting in several clusters. The ratio between the number of elements in the cluster containing the target attribute and the total number of elements in all clusters is denoted as the general weight of the target attribute. Similarly, the ratio between the number of elements in the cluster containing the target attribute's corresponding attribute s and the total number of elements in all clusters is denoted as the general weight of the target attribute's corresponding attribute s. The larger the general weight, the more common the attribute is, and the more limited its contribution to entity differentiation.
[0054] Calculate the mean *a* of the general weight of the target attribute and the general weight of its corresponding attribute *s*, and the cosine similarity *b* between the word vectors of the target attribute and its corresponding attribute *s*. Divide the cosine similarity *b* by the mean *a* and denote the similarity contribution of the target attribute relative to the v-th entity. The similarity contribution reflects the effective semantic association between the target attribute and its corresponding attribute; a larger value indicates higher semantic similarity and stronger discriminative ability between the two attributes, thus contributing more to entity similarity analysis.
[0055] Calculate the similarity contribution of all attributes in the u-th entity relative to the v-th entity, and the similarity contribution of all attributes in the v-th entity relative to the u-th entity in the same way, and record the average of all similarity contributions as the overall similarity contribution between the u-th entity and the v-th entity.
[0056] It should be noted that each attribute has only one corresponding attribute. Simultaneously, a preset similarity lower threshold is established (ranging from 0.2 to 0.3, with 0.2 in this embodiment). If the number of attributes of the u-th entity and the v-th entity is inconsistent, and the maximum similarity among all attributes of the target attribute and the v-th entity is lower than the preset similarity lower threshold, it is determined that the target attribute does not have a corresponding attribute, and the similarity contribution of the target attribute is set to 0. Furthermore, in the calculation of similarity contribution, considering that if the mean value 'a' of the general weights is too small, it will lead to an excessively large calculation result, affecting other parameters, when the mean value 'a' of the general weights is less than the preset general threshold (ranging from 0.05 to 0.08, with 0.07 in this embodiment), the mean value 'a' of the general weights is set to the preset general threshold.
[0057] Furthermore, an entity's characteristics are influenced not only by its own attributes but also by the relational network it belongs to. For example, if the u-th entity and the v-th entity are both residential user entities, associated with the same electricity pricing rules, the same business cases, and the same payment agreements, then although their related attribute values may differ, their relational networks remain stable.
[0058] The set of all entities directly connected to the u-th entity in the initial knowledge database is denoted as the association set of the u-th entity. The association set of the v-th entity is constructed in the same way. The association sets of the u-th and v-th entities are used as input to the SimRank algorithm, which outputs the similarity score between the u-th and v-th entities. Relationship similarity reflects the degree of consistency between two entities in their relational network; a higher value indicates that the entities associated with the two entities are more similar, and the greater the probability that they are of the same type.
[0059] As a preferred implementation, semantic associations between entities are constructed based on the commonality and similarity of all attributes of each entity and their corresponding attributes in other entities, as well as the consistency between each entity and other entities associated with each other in the initial knowledge database. This is used to characterize the comprehensive proximity of two entities in terms of attribute semantics and relational structure. The method for constructing the semantic association between each entity and other entities is as follows: The word vectors corresponding to all attributes of all entities in the initial knowledge database are clustered to obtain several clusters; the ratio between the number of elements in the cluster of each attribute and the total number of elements in all clusters is recorded as the general weight of each attribute; the mean of the general weight of each attribute in each entity and the general weight of its corresponding attributes in other entities, and the cosine similarity between each attribute and its corresponding attribute word vectors in other entities are calculated, and the ratio of the cosine similarity to the mean is recorded as the similarity contribution of each attribute in each entity relative to other entities; the mean of the similarity contributions of all attributes between each entity and other entities is calculated; the set of all entities directly connected to each entity in the initial knowledge database is recorded as the association set of each entity; the association set of each entity and other entities is used as the input of the SimRank algorithm, and the similarity between each entity and other entities is output; the semantic association between each entity and other entities is positively correlated with the mean of the similarity contribution and the relationship similarity.
[0060] In this embodiment, the semantic association between the u-th entity and the v-th entity is denoted as... Its specific expression is: In the formula, The semantic relationship between the u-th entity and the v-th entity; Contribute to the overall similarity of all attributes between the u-th entity and the v-th entity; Let be the similarity between the u-th entity and the v-th entity.
[0061] Semantic relevance can characterize the degree of closeness between two entities in terms of attribute semantics and relational structure; the larger the value, the higher the similarity between the two entities in terms of attribute semantics and relational structure, and the greater the possibility that the two entities belong to the same type of entity.
[0062] Computational principle: Semantic relevance is achieved through... To reflect the overall similarity between two entities at the attribute semantic level; through This reflects the degree of proximity between two entities at the relational network structure level; It can describe entity relationships from both attribute semantics and relational structure perspectives. While there is no coupling between the two, they can compensate for each other; therefore, addition is used for calculation in this embodiment. Meanwhile, considering the possibility of... Too large and leading to Since the impact of the calculation is minimal, an exponential function is used for normalization.
[0063] Furthermore, as a preferred implementation, based on the historical differences and semantic connections between each entity and other entities, a similarity index is constructed to characterize the probability that each entity belongs to the same type of entity as other entities. The similarity index is positively correlated with the semantic connection and negatively correlated with the historical differences. The flowchart for obtaining the similarity index between each entity and other entities is shown below. Figure 2 As shown.
[0064] In this embodiment, the historical differences between the u-th entity and the v-th entity are exponentially normalized, and the normalization result is: And the normalized historical differences and the preset robustness factor will be used to... The sum of the values is used as the denominator, and the semantic relevance between the u-th entity and the v-th entity is used as the numerator to calculate the ratio. The ratio result is recorded as the homogeneity index between the u-th entity and the v-th entity. A robustness factor is preset. To avoid calculation errors caused by a denominator of 0, the value is selected from 0.0005 to 0.001, and 0.001 is used in this embodiment.
[0065] The larger the similarity index, the more similar the two entities are not only in terms of attribute semantics and relational structure, but also in terms of their changes over historical periods. Therefore, the two entities are more likely to belong to the same type of entity.
[0066] After calculating the similarity index between two entities, all entities are used as input to the ANC algorithm for adaptive clustering. The similarity index between any two entities is then compared with a preset robustness factor. The sum of the values is used, and the reciprocal of the sum is used as the distance metric between any two entities, thereby dividing all entities into multiple clusters. The resulting multiple clusters are denoted as entity clusters.
[0067] Step 5: Optimize the entity alignment threshold of each entity cluster in the StructBERT model, and then update the initial knowledge database.
[0068] Furthermore, taking the z-th entity cluster as an example, the entity alignment threshold corresponding to the z-th entity cluster is optimized: In the formula, The optimized entity alignment threshold for the z-th entity cluster; The initial entity alignment threshold is preset, which is 0.6 in this embodiment; Let be the mean of the attribute drift values of all entities within the z-th entity cluster; It is an exponential function with the natural constant e as the base; This is a preset parameter tuning factor used to avoid excessive threshold changes that could lead to a decrease in entity fusion stability. It is selected from 0.2 to 0.3, and in this embodiment, it is selected as 0.2.
[0069] like A larger threshold indicates that the entities within the z-th cluster have undergone significant changes over historical billing periods, and their attributes are prone to change. In this case, it is necessary to avoid excessively increasing the entity alignment threshold to prevent incompatibility and fusion due to entity fragmentation. If the value is relatively small, it indicates that the attribute data of entities within the z-th cluster is relatively stable. In this case, it is necessary to appropriately increase the entity alignment threshold to avoid incorrect merging of different entities.
[0070] During the data update process of the knowledge database, after the newly collected data in the current billing cycle (i.e. the latest billing cycle) completes entity extraction and triple construction, taking the t-th entity in the current billing cycle as an example, the semantic association between the t-th entity and the central entity of each entity cluster is calculated, and the entity cluster corresponding to the maximum semantic association value is taken as the cluster to which the t-th entity is assigned.
[0071] Subsequently, the optimized entity alignment threshold corresponding to the assigned cluster is obtained, and the StructBERT model is used to perform entity alignment analysis on the t-th entity and each historical entity within its assigned cluster. The entity alignment threshold is set to the optimized entity alignment threshold corresponding to the assigned cluster. If the t-th entity successfully aligns with any historical entity in its assigned cluster, the t-th entity is merged into the incremental data of the corresponding historical entity, and the attribute content of that historical entity is updated to obtain the updated knowledge database. Otherwise, the t-th entity is added as a new knowledge entity to the initial knowledge database and assigned to its corresponding assigned cluster to obtain the updated knowledge database.
[0072] Similarly, entity alignment analysis is performed on all new entities in the latest billing cycle to update the initial knowledge database.
[0073] Similarly, by using all entities in each subsequent billing cycle to update the knowledge database, a real-time updated knowledge database can be obtained.
[0074] Thus, the invention of a knowledge database construction method for electricity billing and payment systems is completed. This method can dynamically adjust the entity alignment strategy based on the historical evolution characteristics of each entity cluster during the continuous expansion of the knowledge database, thereby improving the entity fusion accuracy and the update efficiency of the knowledge database.
Claims
1. A method for constructing a knowledge database for an electricity billing and payment system, characterized in that, The method includes the following steps: The structured and unstructured data of the electricity billing and payment system are acquired; an initial knowledge database is constructed based on all structured and unstructured data from historical billing cycles. Based on the degree of difference between each entity's attributes in each billing cycle and the same type of attributes in the previous billing cycle in the initial knowledge database, a distance coefficient is constructed; by analyzing the magnitude and periodicity of the distance coefficient of each entity in all historical billing cycles, the attribute drift value of each entity is determined. Analyze the degree of difference between attribute drift values of different entities and the degree of correlation between distance coefficients of different entities across all historical billing periods to construct the historical differences between each entity and other entities; Obtain the corresponding attributes of each entity in other entities; analyze the commonality and similarity of all attributes and their corresponding attributes in different entities, as well as the consistency between the entities associated with different entities in the initial knowledge database, construct the semantic association between each entity and other entities, and combine the historical differences to cluster all entities to obtain multiple entity clusters. By utilizing the attribute drift values of all entities in each entity cluster, the entity alignment threshold of each entity cluster in the StructBERT model is optimized, and then the initial knowledge database is updated using each entity in the current billing cycle.
2. The knowledge database construction method for an electricity billing and payment system as described in claim 1, characterized in that, The method for constructing the initial knowledge database is as follows: The unstructured data for each billing period is segmented into words to obtain the corresponding text data; Entity extraction, relation extraction, and attribute extraction are performed on all structured and text data within each billing cycle. All attribute information corresponding to each entity is converted into word vectors. According to the data collection order of each attribute, the word vectors corresponding to all attributes of each entity in each billing period are concatenated in sequence to obtain the attribute set of each entity in each billing period. Based on the attribute set of each entity within a preset number of historical billing periods, the entity fusion model is used to perform cross-period entity alignment and fusion on all entities extracted within the preset number of historical billing periods to obtain an initial knowledge database.
3. The knowledge database construction method for an electricity billing and payment system as described in claim 1, characterized in that, The method for constructing the distance coefficient is as follows: The word vectors corresponding to all attributes of each entity in all historical billing periods are used as input to the HDBSCAN clustering algorithm for adaptive clustering, resulting in several clusters. Calculate the Euclidean distance between each attribute of each entity in each billing period and all attributes in its cluster that belong to the previous billing period, and record the mean of all Euclidean distances as the distance coefficient of each attribute of each entity in each billing period.
4. The knowledge database construction method for an electricity billing and payment system as described in claim 1, characterized in that, The method for constructing the attribute drift values of each entity is as follows: Calculate the mean of the distance coefficients of all attributes for each entity in each billing cycle, and arrange the mean values of each entity in all historical billing cycles in chronological order of each billing cycle, and record them as the cycle offset sequence of each entity. The periodic offset sequence of each entity is used as the input to the autocorrelation function, with the difference between adjacent hysteresis quantities being 1, and a series of autocorrelation coefficients are output. The attribute drift values of each entity are positively correlated with the mean of the periodic offset sequence and negatively correlated with the maximum value among all autocorrelation coefficients.
5. The knowledge database construction method for an electricity billing and payment system as described in claim 4, characterized in that, The method for constructing the historical differences between each entity and other entities is as follows: Calculate the absolute difference between the attribute drift values of each entity and those of other entities; Calculate the Pearson correlation coefficient between each entity and the periodic offset sequences of other entities; The historical differences between each entity and other entities are positively correlated with the absolute difference and negatively correlated with the Pearson correlation coefficient.
6. The knowledge database construction method for an electricity billing and payment system as described in claim 1, characterized in that, The method for obtaining the corresponding attributes of each entity in other entities is as follows: Calculate the cosine similarity between each attribute of each entity and all attributes of all other entities, and record the attribute corresponding to the maximum cosine similarity as the corresponding attribute of each entity in the other entities.
7. The knowledge database construction method for an electricity billing and payment system as described in claim 1, characterized in that, The method for constructing the semantic relationships between each entity and other entities is as follows: Cluster the word vectors corresponding to all attributes of all entities in the initial knowledge database to obtain several clusters; The ratio between the number of elements in the cluster of each attribute and the total number of elements in all clusters is recorded as the general weight of each attribute. Calculate the mean of the general weight of each attribute in each entity and the general weight of its corresponding attribute in other entities, and the cosine similarity between each attribute and the word vector of its corresponding attribute in other entities. The ratio of the cosine similarity to the mean is recorded as the similarity contribution of each attribute in each entity to other entities. Calculate the average contribution of all attributes of each entity to the similarity between each entity and other entities. The set of all entities directly connected to each entity in the initial knowledge database is denoted as the association set of each entity; the association sets of each entity and other entities are used as input to the SimRank algorithm, and the similarity between each entity and other entities is output. The semantic relevance between each entity and other entities is positively correlated with the mean of the similarity contribution and the relational similarity.
8. The method for constructing a knowledge database for an electricity billing and payment system as described in claim 1, characterized in that, The method for obtaining the entity clusters is as follows: Construct a similarity index between each entity and other entities, wherein the similarity index is positively correlated with the semantic relevance and negatively correlated with the historical differences; All entities are used as input to the ANC algorithm. The sum of the similarity index between any two entities and the preset robustness factor is calculated, and the reciprocal of the sum is used as the distance metric between the two entities. This process is used to cluster all entities, and the resulting clusters are denoted as entity clusters.
9. The method for constructing a knowledge database for an electricity billing and payment system as described in claim 1, characterized in that, The specific formula for optimizing the entity alignment threshold of each entity cluster is as follows: In the formula, The optimized entity alignment threshold for the z-th entity cluster; This is the preset initial entity alignment threshold; Let be the mean of the attribute drift values of all entities within the z-th entity cluster; It is an exponential function with the natural constant e as the base; This is the preset parameter tuning factor.
10. The method for constructing a knowledge database for an electricity billing and payment system as described in claim 1, characterized in that, The specific process of updating the initial knowledge database through each entity in the current billing cycle is as follows: Calculate the semantic association between each entity and the central entity of all entity clusters in the current billing cycle, and take the entity cluster corresponding to the maximum semantic association as the cluster to which each entity belongs; The StructBERT model is used to perform entity alignment analysis on each entity in the current billing cycle and each entity in its own cluster. The entity alignment threshold is set to the optimized entity alignment threshold corresponding to the cluster. If any entity is successfully aligned with any historical entity in its cluster, the entity is merged into the incremental data of the corresponding historical entity, and the attribute content of the historical entity is updated to obtain the updated knowledge database. Otherwise, the entity is added as a new knowledge entity to the initial knowledge database and assigned to its corresponding cluster, thus obtaining the updated knowledge database.
