Variable calculation method and device based on dependency relationship and computer equipment

Through the variable calculation method based on dependency, real-time data is obtained asynchronously and data requests are optimized, the inefficiency and network congestion problems in traditional variable calculation methods are solved, and more efficient variable calculation and operation and maintenance costs are achieved.

CN120448053APending Publication Date: 2025-08-08SHANGHAI RUIDE HUIZHI TECHNOLOGY CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202510446603.2
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-04-10
Publication Date
2025-08-08

AI Technical Summary

Technical Problem

Traditional variable calculation methods are inefficient, especially when variables increase during business promotion, resulting in network congestion and reduced computing efficiency.

Method used

The variable calculation method based on dependency relationships is used to determine the subvariables and their data sources of the variable to be calculated, generate a data request group and obtain real-time data asynchronously, avoiding the single variable calculation failure affecting the overall efficiency and reducing the frequency of data source access.

Benefits of technology

It improves the overall efficiency of variable calculation, reduces network congestion, and reduces operation and maintenance costs.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120448053A_ABST
    Figure CN120448053A_ABST
Patent Text Reader

Abstract

The embodiment of the invention belongs to the technical field of computers, and particularly relates to a variable calculation method and device based on a dependency relationship and computer equipment, and the method comprises the following steps: receiving a plurality of variables to be calculated; determining a sub-variable of each to-be-calculated variable according to a dependency relationship between each to-be-calculated variable and other variables; wherein the dependency relationship with other variables is that the variable value of the first variable depends on the variable value of the second variable; according to all the sub-variables and the corresponding data sources, data request groups corresponding to the data sources are generated, and the data request groups are used for obtaining real-time data of the sub-variables. And calculating a variable value of the variable to be calculated according to the obtained real-time data. The problem that a traditional variable calculation mode is low in efficiency is solved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The embodiments of this specification relate to the field of computer technology, and more particularly to a method, apparatus, and computer device for calculating variables based on dependency relationships. Background Art

[0002] Traditional variable calculation methods are usually performed synchronously, that is, the calculation of each variable needs to be completed in sequence. When calculating a certain variable, real-time data must first be obtained from the data source corresponding to the variable and / or its sub-variables. Then, the calculation of the variable is completed based on the obtained real-time data. Only then will the next variable be processed. This leads to low efficiency in overall variable calculation. At the same time, with the promotion and innovation of business, the number of variables that need to be processed has increased significantly. For the same data source, various requests for variable calculation to obtain real-time data will be frequently received, which aggravates network congestion and reduces the overall variable calculation efficiency. Summary of the Invention

[0003] The embodiments of this specification provide a dependency-based variable calculation method, apparatus, and computer device, which are used to solve or at least partially solve the problem of low efficiency of traditional variable calculation methods.

[0004] In order to solve the above technical problems, a first aspect of an embodiment of this specification provides a method for calculating variables based on dependency relationships, the method comprising:

[0005] Receive multiple variables to be calculated;

[0006] Determine the sub-variables of each variable to be calculated based on the dependency relationship between each variable to be calculated and other variables; wherein the dependency relationship with other variables is that the calculation of the variable value of the first variable depends on the variable value of the second variable;

[0007] Generate a data request group corresponding to each data source based on all sub-variables and their corresponding data sources, wherein the data request group is used to obtain real-time data of each sub-variable;

[0008] Calculate the variable value of the variable to be calculated based on the real-time data obtained.

[0009] Furthermore, the sub-variables include basic variables and / or derived variables;

[0010] Based on all sub-variables and corresponding data sources, a data request group corresponding to each data source is generated, including:

[0011] When a subvariable is a derived variable, the subvariable of the subvariable is determined based on the dependency relationship between the subvariable and other variables;

[0012] Based on all basic variables and corresponding data sources, a data request group corresponding to each data source is generated.

[0013] Furthermore, after obtaining the real-time data required for each variable to be calculated from each data source, the following steps are also included:

[0014] Calculate and store the variable value of each basic variable according to the real-time data;

[0015] When the real-time data of all basic variables of a certain variable have been obtained, the variable values of all sub-variables of the variable are calculated and stored based on the real-time data.

[0016] Furthermore, the variable values of all sub-variables of the variable are calculated and stored, including:

[0017] Determine in sequence whether each subvariable of the variable is the same as a subvariable of another variable; the subvariable is a variable whose variable value has been calculated;

[0018] If the judgment is no, calculate and store the variable value of the subvariable.

[0019] Furthermore, after calculating the variable values of all sub-variables of the variable, including:

[0020] Determine whether the variable values of each sub-variable of the variable are abnormal;

[0021] If the answer is yes, the variable value calculation of all sub-variables corresponding to the abnormal sub-variable and the same data source is suspended, and the real-time data is obtained again.

[0022] Furthermore, when the variable with an abnormal value is a variable to be calculated or a derived variable, it also includes:

[0023] According to the variable value calculation process of the variable, determine the step of calculation abnormality;

[0024] Determine the abnormal value according to the steps of calculating the abnormality;

[0025] According to the abnormal value, the abnormal sub-variables of the variable are determined.

[0026] Furthermore, based on the abnormal value, each abnormal sub-variable of the variable is determined, including:

[0027] If the abnormal value exceeds the abnormal threshold range, determine whether the denominator in the expression for calculating the abnormal value is abnormal;

[0028] If abnormal, the abnormal sub-variable is determined based on the denominator.

[0029] Furthermore, the variable values of all sub-variables of the variable are stored, including:

[0030] Determine the storage priority of each sub-variable of the variable according to the dependency relationship associated with each sub-variable of the variable;

[0031] According to the storage priority, each sub-variable is stored in a buffer area with different transmission efficiency.

[0032] Furthermore, the method further comprises:

[0033] When there is a subvariable that exceeds the real-time data callback time limit, obtain the task information and historical real-time data of the subvariable that exceeds the real-time data callback time limit;

[0034] Determine, according to the task information, an alternative sub-variable from the sub-variables that have completed the real-time data callback;

[0035] The real-time data of the sub-variable that exceeds the real-time data callback time limit is determined according to the real-time data of the candidate sub-variable and the historical real-time data.

[0036] Furthermore, determining the real-time data of the sub-variable that exceeds the real-time data callback time limit based on the real-time data of the candidate sub-variable and the historical real-time data includes:

[0037] Calculating the information correlation between the historical real-time data and the task information, and the information correlation between the real-time data of the candidate sub-variable and the task information;

[0038] The real-time data with the greatest information correlation between the two is determined as the real-time data of the sub-variable that exceeds the real-time data callback time limit.

[0039] Furthermore, the variable value of the variable to be calculated is calculated based on the acquired real-time data, including:

[0040] When all sub-variables of a variable to be calculated have completed the variable value calculation, the variable value of the variable to be calculated is calculated based on the variable values of all sub-variables of the variable to be calculated.

[0041] A second aspect of the embodiments of this specification provides a variable calculation device based on dependency relationships, the device comprising:

[0042] A receiving module, used for receiving multiple variables to be calculated;

[0043] a determination module, configured to determine a subvariable of each variable to be calculated based on a dependency relationship between each variable to be calculated and other variables; wherein the dependency relationship with other variables is that the calculation of the variable value of the first variable depends on the variable value of the second variable;

[0044] A generation module, configured to generate a data request group corresponding to each data source based on all sub-variables and corresponding data sources, wherein the data request group is used to obtain real-time data of each sub-variable;

[0045] The calculation module is used to calculate the variable value of the variable to be calculated based on the acquired real-time data.

[0046] A third aspect of the embodiments of this specification provides a computer device, comprising a memory, a processor, and a computer program stored on the memory, wherein when the computer program is executed by the processor, the computer program executes instructions of the dependency-based variable calculation method described in any of the aforementioned embodiments.

[0047] A fourth aspect of the embodiments of this specification provides a computer storage medium having a computer program stored thereon. When the computer program is executed by a processor of a computer device, the computer program executes the instructions of the variable calculation method based on dependency as described in any of the aforementioned embodiments.

[0048] A fifth aspect of the embodiments of this specification provides a computer program product, which includes a computer program. When the computer program is run by a processor of a computer device, it executes instructions of the variable calculation method based on dependency as described in any of the above embodiments.

[0049] The dependency-based variable calculation method, apparatus, and computer device provided in the embodiments of this specification determine all sub-variables corresponding to the variable to be calculated based on the dependency relationship between each variable to be calculated and other variables, and group all sub-variables according to the corresponding different data sources to obtain multiple data request groups; then, a data acquisition request is initiated to each data source in units of the data request group, and the variable values of all variables to be calculated are calculated based on the returned real-time data; through the dependency relationship between the variables, the real-time data of all sub-variables are first obtained, and the corresponding variables to be calculated are calculated based on the obtained real-time data, thereby separating the dependencies between the variables to be calculated (that is, the subsequent variable to be calculated does not need to wait for the successful calculation of the previous variable to be calculated), thereby preventing the calculation efficiency of the overall variable from being affected by a single variable calculation failure; at the same time, each data source only needs to receive a real-time data acquisition request once, avoiding network congestion caused by frequent access and improving the overall variable calculation efficiency.

[0050] In order to make the above and other purposes, features and advantages of the embodiments of this specification more obvious and easy to understand, preferred embodiments are specifically cited below and described in detail with reference to the accompanying drawings. BRIEF DESCRIPTION OF THE DRAWINGS

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

[0052] Figure 1 A flow chart showing a method for calculating variables based on dependency relationships according to an embodiment of this specification is shown;

[0053] Figure 2 A flowchart of generating a data request group corresponding to each data source according to an embodiment of this specification is shown;

[0054] Figure 3 The flowchart after acquiring real-time data in the embodiment of this specification is shown;

[0055] Figure 4 A flowchart of calculating and storing variable values of sub-variables according to an embodiment of this specification is shown;

[0056] Figure 5 The flowchart after calculating the variable value of the sub-variable in the embodiment of this specification is shown;

[0057] Figure 6 A flow chart of a method for handling abnormalities in a variable to be calculated or a derived variable according to an embodiment of the present specification is shown;

[0058] Figure 7 A flowchart of determining abnormal sub-variables according to an embodiment of this specification is shown;

[0059] Figure 8 A flowchart of storing variable values of sub-variables according to an embodiment of this specification is shown;

[0060] Figure 9 The following is a flowchart showing the processing of exceeding the real-time data callback time limit according to the embodiment of this specification;

[0061] Figure 10 A flowchart of further processing when the real-time data callback time limit is exceeded in an embodiment of this specification is shown;

[0062] Figure 11 A schematic diagram showing the dependency relationship of the variable A to be calculated according to the embodiment of this specification is shown;

[0063] Figure 12 A schematic diagram showing the dependency relationship of the variable B to be calculated in the embodiment of this specification is shown;

[0064] Figure 13 Schematic diagram showing the dependency relationship of the variable C to be calculated in the embodiment of this specification;

[0065] Figure 14 Shows an example diagram of variable calculation in an embodiment of this specification;

[0066] Figure 15 A structural diagram of variable calculation based on dependency relationships in an embodiment of this specification is shown;

[0067] Figure 16The diagram shows the structure of the computer device according to the embodiment of the present specification.

[0068] Description of the accompanying symbols:

[0069] 1510, receiving module;

[0070] 1520. Determine module;

[0071] 1530. Generate module;

[0072] 1540, calculation module;

[0073] 1602. Computer equipment;

[0074] 1604, processor;

[0075] 1606. Memory;

[0076] 1608, driving mechanism;

[0077] 1610, input / output module;

[0078] 1612. Input devices;

[0079] 1614. Output device;

[0080] 1616, presentation equipment;

[0081] 1618. Graphical User Interface;

[0082] 1620, network interface;

[0083] 1622, communication link;

[0084] 1624. Communication bus. DETAILED DESCRIPTION

[0085] The following will clearly and completely describe the technical solutions in the embodiments of this specification in conjunction with the drawings in the embodiments of this specification. Obviously, the embodiments described are only part of the embodiments of this specification, not all of the embodiments. Based on the embodiments in this specification, all other embodiments obtained by ordinary technicians in this field without making any creative efforts shall fall within the scope of protection of the embodiments of this specification.

[0086] It should be noted that the terms "first," "second," and the like in this specification, the claims, and the accompanying drawings are used to distinguish similar objects and are not necessarily used to describe a particular order or precedence. It should be understood that the terms used in this manner are interchangeable where appropriate, so that the embodiments of this specification described herein can be implemented in an order other than those illustrated or described herein. In addition, the terms "including" and "having," and any variations thereof, are intended to cover non-exclusive inclusions. For example, a process, method, apparatus, product, or device comprising a series of steps or units is not necessarily limited to those steps or units explicitly listed, but may include other steps or units that are not explicitly listed or that are inherent to such processes, methods, products, or devices.

[0087] This specification provides method operation steps as described in the embodiments or flowcharts, but more or fewer operation steps may be included based on routine or non-creative work. The order of steps listed in the embodiments is only one way of executing the steps among many orderings and does not represent the only execution order. When a system or device product is actually executed, the method can be executed in the order shown in the embodiments or the drawings or in parallel.

[0088] It should be noted that the acquisition, storage, use, and processing of data in the technical solutions of the embodiments of this specification comply with the relevant provisions of national laws and regulations.

[0089] It should be noted that in the embodiments of this specification, certain software, components, models and other existing solutions in the industry may be mentioned. They should be regarded as exemplary. Their purpose is only to illustrate the feasibility of implementing the technical solutions of the embodiments of this specification, but it does not mean that the applicant has or will necessarily use the solution.

[0090] It should be noted that in the embodiments of this specification, the variable to be calculated refers to the variable located at the upstream end of the derivative calculation, and the sub-variable refers to the downstream variable of the variable to be calculated. The variable value calculation of the variable to be calculated needs to depend on the variable value of its downstream sub-variable.

[0091] Derivative computing has relevant applications in many fields. For example, in the field of risk control, the formulation of a strategy often requires multiple variables to be calculated as the calculation basis. Traditional derivative computing systems usually configure the data source for each variable to be calculated in advance. When a new variable to be calculated is added, the data source is also configured for the new variable to be calculated, so that the calculation efficiency of the variable to be calculated can be accelerated when decision-making is required.

[0092] However, traditional variable calculations are usually performed synchronously. The next variable to be calculated will only be processed after the variable value of the previous variable to be calculated is determined, resulting in low efficiency in the calculation of the overall variable. For the same data source, various requests for variable calculations to obtain real-time data will also be frequently received (for example, different variables to be calculated have sub-variables corresponding to the same data source), which aggravates network congestion and reduces the calculation efficiency of the overall variable.

[0093] In addition, when the configuration of certain data sources is updated (for example, changes in data source address, ID, etc.) or the data sources corresponding to certain sub-variables change, the operation and maintenance personnel need to adjust the configuration of the corresponding variables to be calculated one by one, which increases the operation and maintenance workload and labor costs.

[0094] To solve the above problem, in one embodiment of this specification, a variable calculation method based on dependency relationships is provided.

[0095] Specifically, such as Figure 1 As shown, the variable calculation methods based on dependency relationships include:

[0096] Step 110, receiving a plurality of variables to be calculated;

[0097] Step 120: determining sub-variables of each variable to be calculated based on a dependency relationship between each variable to be calculated and other variables; wherein the dependency relationship with other variables is that the calculation of the variable value of the first variable depends on the variable value of the second variable;

[0098] Step 130: Generate a data request group corresponding to each data source based on all sub-variables and corresponding data sources, wherein the data request group is used to obtain real-time data of each sub-variable;

[0099] Step 140: Calculate the variable value of the variable to be calculated based on the acquired real-time data.

[0100] This embodiment determines all sub-variables corresponding to the variable to be calculated based on the dependency relationship between each variable to be calculated and other variables, and groups all sub-variables according to the corresponding different data sources to obtain multiple data request groups; then, a data acquisition request is initiated to each data source in units of data request groups, and the variable values of all variables to be calculated are calculated based on the returned real-time data; through the dependency relationship between variables, the real-time data of all sub-variables are first obtained, and then the corresponding variables to be calculated are calculated based on the obtained real-time data, thereby separating the dependencies between the variables to be calculated (that is, the subsequent variable to be calculated does not need to wait for the successful calculation of the previous variable to be calculated), thereby preventing the calculation efficiency of the overall variable from being affected by a single variable calculation failure; at the same time, each data source only needs to receive a real-time data acquisition request once, avoiding network congestion caused by frequent access and improving the overall variable calculation efficiency.

[0101] Compared with the traditional derivative variable calculation system, in the embodiment of this specification, the data source configuration is no longer performed in advance for each variable to be calculated. Instead, a dependency table is established between the variables. The dependency table corresponds to the upstream and downstream relationships between all variables, as well as the data source information corresponding to all the most downstream variables (i.e., basic variables). When it is necessary to calculate the variable value of each variable to be calculated, the dependency table is first queried to determine the sub-variables of each variable to be calculated and the data source corresponding to each sub-variable. Then, each sub-variable is grouped and requested according to the data source, and the variable value of each variable to be calculated is calculated based on the returned real-time data, thereby realizing asynchronous derivative calculation and speeding up the overall variable calculation efficiency. When the dependency relationship between variables or the configuration of the data source changes, there is no need to reconfigure each variable to be calculated, only the dependency table needs to be updated, thereby reducing the labor cost of operation and maintenance personnel.

[0102] There are usually multiple sub-variables of the variable to be calculated. The most downstream sub-variable is the basic variable, such as the service variable (corresponding to the data provided by the service provider). The non-most downstream sub-variable is the derived variable. The variable value of the derived variable can be determined based on the basic variable downstream. For example, derived variable a = (basic variable a + basic variable b) / basic variable c.

[0103] In another embodiment of this specification, Figure 2 As shown, based on all sub-variables and corresponding data sources, a data request group corresponding to each data source is generated, including:

[0104] Step 210: When the sub-variable is a derived variable, determine the sub-variable of the sub-variable based on the dependency relationship between the sub-variable and other variables;

[0105] Step 220: Generate a data request group corresponding to each data source based on all basic variables and corresponding data sources.

[0106] This embodiment takes into account that when a sub-variable is a derived variable, it is necessary to further obtain the sub-variables of the derived variable according to the dependency table until all basic variables that need to request real-time data are determined. Then, based on all basic variables and corresponding data sources, a data request group corresponding to each data source is generated. In this way, each data source will only receive one data access request, thereby reducing network congestion and accelerating variable calculation efficiency.

[0107] It should be understood that the downstream sub-variables of the derived variable may also contain derived variables. At this time, it is necessary to query the dependency table again to query the sub-variables of the downstream derived variables of the derived variable. If the query result still contains derived variables, continue to query until the query result contains only basic variables.

[0108] Figure 11 and Figure 12 Shows the dependency between two variables to be calculated. Figure 11 In the example, the most upstream variable is the variable to be calculated A, which depends on four sub-variables (i.e., basic variable A, basic variable B, basic variable C, and basic variable D). Once the values of these four sub-variables are determined, the variable to be calculated A can calculate its own value based on the values of these sub-variables.

[0109] Figure 12 In the example, the most upstream variable is variable B to be calculated. Variable B to be calculated depends on four sub-variables: derived variable A, base variable A, derived variable C, and base variable D. Derived variable A depends on derived variable B and base variable B, which in turn depends on base variable F. Meanwhile, derived variable C depends on base variable E. Therefore, the value of derived variable B can only be determined after the value of base variable F is determined. The value of derived variable A can only be determined after the values of derived variable B and base variable B are determined. Similarly, the value of derived variable C can only be determined after the value of base variable E is determined. The value of variable B to be calculated can only be calculated after the values of derived variable A, base variable A, derived variable C, and base variable D are all determined. Therefore, the more complex the variable dependencies of a variable to be calculated, the higher its computational cost.

[0110] In this way, the dependency table containing the variable to be calculated A and the variable to be calculated B can be represented as follows:

[0111] Table 1

[0112] Variable ID variable name The ID of the dependent variable … 1 Variable A to be calculated 6、7、8、9 … 2 Variable B to be calculated 3、5、6、9 … 3 Derived variable A 4、7 … 4 Derived variable B 11 … 5 Derived variable C 10 … 6 Basic variable A / … 7 Basic variable B / … 8 Basic variable C / … 9 Basic variable D / … 10 Basic variable E / … 11 Basic variable F / …

[0113] In order to further improve the overall calculation efficiency of variables, a method after obtaining real-time data is provided in an embodiment of this specification, such as Figure 3 As shown, after obtaining the real-time data required for each variable to be calculated from each data source, the following steps are also included:

[0114] Step 310: Calculate and store the variable value of each basic variable based on the real-time data;

[0115] Step 320: When the real-time data of all basic variables of a certain variable have been obtained, the variable values of all sub-variables of the variable are calculated and stored based on the real-time data.

[0116] After acquiring real-time data, this embodiment begins to calculate the variable values of each basic variable. At the same time, considering that different variables may depend on the same sub-variables, the calculated variable values are also stored to facilitate the call when the variable value is calculated. In addition, when the real-time data of all basic variables of a certain variable are acquired, the variable values of all sub-variables of the variable are calculated and stored first, so that the variable value of the variable can be determined in advance, and the data of the corresponding data source can be verified to be correct based on the variable value of the variable.

[0117] In another embodiment of the present specification, before calculating the variable value, a preliminary judgment can be performed to reduce the amount of redundant calculations, such as Figure 4 As shown, the variable values of all sub-variables of the variable are calculated and stored, including:

[0118] Step 410, determine in turn whether each subvariable of the variable is the same as a subvariable of another variable. If the determination is no, proceed to step 420;

[0119] Wherein, the certain sub-variable is a variable whose variable value has been calculated;

[0120] Step 420: Calculate and store the variable value of the subvariable.

[0121] When calculating the variable value of a certain variable, this embodiment takes into account that the variable values of some variables have been calculated and stored in the calculation process of other variables. Therefore, it is first queried whether there are variable values to be calculated in the storage. When the variable value to be calculated already has a calculation result, the calculation of the variable value can be skipped, thereby reducing the amount of redundant calculation. When the variable value to be calculated does not have a calculation result, the variable value is calculated and stored for use in other calculation processes.

[0122] Variable values can reflect some error information. For example, if the value of a variable is too large or too small and obviously exceeds the normal range, it means that the calculation result of the variable value of the variable may be inaccurate. Therefore, in one embodiment of this specification, after calculating the variable value of the variable, relevant judgments are also made, such as Figure 5 As shown, after calculating the variable values of all sub-variables of the variable, including:

[0123] Step 510, determining whether the variable value of each sub-variable of the variable is abnormal, if it is determined to be abnormal, executing step 520;

[0124] Step 520: suspend the variable value calculation of all sub-variables corresponding to the abnormal sub-variable and the same data source, and re-acquire the real-time data.

[0125] After calculating the variable value of the sub-variable, this embodiment also performs result verification to determine whether the variable value of the sub-variable is abnormal. When the variable value of the sub-variable is abnormal, the variable value calculation of all sub-variables corresponding to the abnormal sub-variable and the same data source is suspended in a timely manner, and real-time data is re-acquired. This can reduce the amount of erroneous calculations, thereby reducing the cost of error correction. At the same time, it avoids invalid calculations of related variables and promptly acquires real-time data again, thereby improving the overall calculation efficiency when the data source is unstable.

[0126] For example, variable d depends on base variable f, variable e depends on base variable f, base variable m, and base variable k, and variable h depends on base variable f, base variable g, and base variable n. Base variables f, m, and g correspond to data source a, k to data source b, and n to data source c. When data source a returns real-time data for base variables f and g, variable d first calculates its value based on base variable f, as real-time data for all its dependent variables has already arrived. Then, data source b returns real-time data for base variable k, and variable e calculates its value based on base variables f, m, and k, as real-time data for all its dependent variables has already arrived. At this point, real-time data from data source c has not yet been returned, but real-time data for base variable g is already available, so calculation continues for base variable g.

[0127] When an exception occurs in data source a, not only are the variable value calculations for basic variables f and d invalid, but the variable value calculations for basic variables m and g are also invalid, and the variable value calculation of variable e based on basic variables f and m is also invalid. According to the method in this embodiment, when an exception is detected in basic variable f or variable d, the variable value calculations for all variables corresponding to data source a are suspended, namely, the variable value calculations for basic variable m and basic variable g are suspended, indirectly suspending the variable value calculation for basic variable e, thereby effectively reducing three invalid calculations.

[0128] In another embodiment of this specification, Figure 6 As shown in the figure, when the variable with abnormal value is a variable to be calculated or a derived variable, it also includes:

[0129] Step 610, determining a step of calculation abnormality according to the variable value calculation process of the variable;

[0130] Step 620, determining an abnormal value according to the step of calculating anomalies;

[0131] Step 630: Determine each abnormal sub-variable of the variable according to the abnormal value.

[0132] This embodiment takes into account that if the variable with an abnormal variable value is a variable to be calculated or a derived variable, the abnormal situation may be caused by some sub-variables. Therefore, it is necessary to determine the abnormal step, so as to only suspend the variable value calculation of all sub-variables corresponding to the abnormal sub-variable from the same data source, thereby strengthening the targeted exception handling and further improving the overall computing efficiency when the data source is unstable.

[0133] For example, the value of derived variable m is abnormal. The calculation process of variable m depends on variables z, x, and c, and variable m = variable z + variable x * variable c. Before calculating the value of variable m, the values of variables z, x, and c all fall within the normal range. However, the value of variable m is too large. At this time, according to the calculation steps, the value of variable x * variable c exceeds the normal range of variable m's variable value (i.e., variable x * variable c is an abnormal step). As a result, variable z + variable x * variable c also exceeds the normal range of variable m's variable value. Therefore, variables x and variable c are determined to be abnormal sub-variables.

[0134] Furthermore, in another embodiment of this specification, if Figure 7 As shown in the figure, based on the abnormal value, the abnormal sub-variables of the variable are determined, including:

[0135] Step 710: If the abnormal value exceeds the abnormal threshold range, determine whether the denominator in the expression for calculating the abnormal value is abnormal. If so, execute step 720;

[0136] Step 720: Determine abnormal sub-variables based on the denominator.

[0137] This embodiment provides a specific method for determining abnormal sub-variables. When an abnormal value exceeds an abnormal threshold range, the abnormal sub-variable is quickly determined based on the denominator in the abnormal value expression, thereby improving the efficiency of determining the abnormal sub-variable.

[0138] The abnormal threshold interval refers to further dividing the abnormal variable value into intervals. The abnormal threshold interval can quickly determine whether there is an abnormal denominator in the fractional expression. For example, variable t = variable q / variable w. When the variable value of variable t is abnormal and exceeds the abnormal threshold interval, it may be caused by variable w. For example, the variable value of variable w is a very small number (such as 0), which will not cause an abnormality in addition operations. However, in division operations, the variable value of variable w will cause the variable value of variable t to be very large, resulting in an abnormal variable value of variable t. Therefore, variable w is an abnormal sub-variable. The abnormal threshold interval can be determined according to usage requirements and is not limited in this manual.

[0139] Furthermore, if the value of variable w is determined by multiple sub-variables, the range of abnormal sub-variables can be further narrowed based on variable w. For example, if variable w = variable w1 * (variable w2 - variable w3), where the values of variables w2 and w3 are equal, resulting in variable w2 - variable w3 = 0, which in turn results in variable w being infinite. Therefore, variables w2 and w3 can be determined as abnormal sub-variables. For another example, if variable w = variable w4 / variable w5, where the value of variable w5 = 0, resulting in variable w being infinite, variable w5 can be determined as an abnormal sub-variable.

[0140] In another embodiment of the present specification, a method for implementing a variable value of a storage variable is also provided, such as Figure 8 As shown, the variable values of all sub-variables of the variable are stored, including:

[0141] Step 810: Determine the storage priority of each sub-variable of the variable according to the dependency relationship associated with each sub-variable of the variable;

[0142] Step 820: Store each sub-variable into a buffer area with different transmission efficiency according to the storage priority.

[0143] This embodiment takes the dependency relationships associated with each sub-variable into consideration, and by determining different storage priorities, flexibly determines the storage methods of sub-variables of different importance, thereby further improving the overall computation efficiency of the variables.

[0144] For example, the variable value calculations of 8 variables depend on the same sub-variable q, and the variable value calculations of 3 variables depend on the same sub-variable p. It can be determined that the sub-variable q is accessed more times than the sub-variable p. At this time, placing the sub-variable q with more associated dependencies into the high-speed buffer and placing the sub-variable p with fewer associated dependencies into the low-speed buffer can greatly speed up the access efficiency of the overall variables.

[0145] In another embodiment of this specification, Figure 9 As shown, the variable calculation method based on dependency relationship also includes:

[0146] Step 910: When there is a sub-variable that exceeds the real-time data callback time limit, obtain the task information and historical real-time data of the sub-variable that exceeds the real-time data callback time limit;

[0147] Step 920: Determine a candidate sub-variable from the sub-variables that have completed the real-time data callback according to the task information;

[0148] Step 930: Determine the real-time data of the sub-variable that exceeds the real-time data callback time limit based on the real-time data of the candidate sub-variable and the historical real-time data.

[0149] This embodiment establishes a real-time data callback time limit for sub-variables. When a sub-variable exceeds the real-time data callback time limit, the real-time data of the sub-variable is determined based on the task information and historical real-time data of the sub-variable, thereby ensuring the timeliness of the variable calculation.

[0150] For example, task information involves obtaining the target's most recent behavioral data. Multiple variables may have the same task information. For example, variable 1 can be used to obtain the target's recent call records, while variable 2 can be used to obtain the target's recent text message records. In some cases, call records and text message records are associated. When variable 1 exceeds the real-time data callback time limit, but variable 2 has already obtained real-time data, the text message records of variable 2 can be used as an alternative sub-variable for variable 1. Variable 1's historical real-time data can reflect the behavioral data closest to the target's current behavior. If variable 1's real-time data is not called back in time, variable 1's historical real-time data can provide a certain reference value. Variable 1's real-time data (i.e., replacement data) can then be determined by combining the alternative sub-variables with variable 1's historical real-time data.

[0151] A further embodiment of this specification provides a method for determining the real-time data of variable 1 based on the candidate sub-variables and the historical real-time data of variable 1, such as Figure 10 As shown, based on the real-time data and historical real-time data of the candidate sub-variables, the real-time data of the sub-variable that exceeds the real-time data callback time limit is determined, including:

[0152] Step 1010, calculating the information correlation between the historical real-time data and the task information, and the information correlation between the real-time data of the candidate sub-variable and the task information;

[0153] Step 1020: Determine the real-time data with the greatest information correlation between the two as the real-time data of the sub-variable that exceeds the real-time data callback time limit.

[0154] This embodiment calculates and compares the information correlation between historical real-time data and task information, as well as the information correlation between the real-time data of the alternative sub-variables and the task information, and determines the data with a large information correlation as the real-time data of the sub-variable that exceeds the real-time data callback time limit, thereby ensuring the validity and timeliness of the variable calculation.

[0155] Information relevance can be understood as historical real-time data or real-time data of alternative sub-variables, which can cover the focus range of task information. For example, task information mainly focuses on several aspects of target behavior (such as whether the call content involves a specific field, whether it involves transactions, whether it involves community activities, etc.). If the real-time data of the alternative sub-variable covers a wider range of task information than the historical real-time data, the real-time data of the alternative sub-variable is determined to be the real-time data of the sub-variable that exceeds the real-time data callback time limit. If the historical real-time data covers a wider range of task information than the real-time data of the alternative sub-variable, the historical real-time data is determined to be the real-time data of the sub-variable that exceeds the real-time data callback time limit.

[0156] In another embodiment of the present specification, model variables are also involved. Model variables can also be regarded as derived variables because model variables depend on the variable values of one or more basic variables. However, the variable value calculation of the model variable is not based on the preset variable value calculation rules, but the variable value of the basic variable is input into the algorithm model (such as a machine learning model) to obtain the variable value output result of the model variable.

[0157] like Figure 13 As shown, the most upstream variable is the variable to be calculated C, which depends on four sub-variables, namely model variable A, basic variable C, derived variable E, and derived variable D. Among them, model variable A depends on basic variable A and basic variable H, derived variable E depends on basic variable B and model variable B, model variable B depends on basic variable R, and derived variable D depends on basic variable N. Therefore, the variable value of model variable A can only be determined after the variable values of basic variables A and basic variables H are determined, the variable value of model variable B can only be determined after the variable value of basic variable R is determined, the variable value of derived variable E can only be determined after the variable values of basic variable B and model variable B are determined, and the variable value of derived variable E can only be determined after the variable values of basic variable B and model variable B are determined. Similarly, the variable value of derived variable D can only be determined after the variable value of basic variable N is determined. Only when the variable values of model variable A, basic variable C, derived variable E, and derived variable D are all determined can the variable value of variable C to be calculated be calculated.

[0158] In this way, the dependency table including the variable to be calculated A, the variable to be calculated B, and the variable to be calculated C can be represented as follows:

[0159] Table 2

[0160]

[0161]

[0162] Here, Table 1 and Table 2 respectively represent the dependency table including the variable to be calculated A and the variable to be calculated B (excluding the variable to be calculated C) and the dependency table including the variable to be calculated A, the variable to be calculated B, and the variable to be calculated C. They are used to selectively query different dependency tables to speed up the query. Alternatively, only one overall dependency table can be maintained, depending on the situation, and this manual does not limit this.

[0163] In one embodiment of this specification, the variable value calculation process of some derived variables and model variables is also given, such as Figure 14 shown.

[0164] Combine Figure 14 , the variable value calculation process is as follows:

[0165] First, receive the variables to be calculated and query the dependency table to determine the IDs of all basic variables that need to obtain real-time data. Then, group them according to the data source. For the sake of convenience, assume that all basic variables required by derived variable A (basic variable B, basic variable F) and all basic variables required by model variable A (basic variable A, basic variable H) correspond to the same data source A. In this case, basic variables A, B, F, and H are grouped into the same data request group A, and the following steps are performed:

[0166] S1. Data request group A initiates a real-time data query request to data source A;

[0167] S2. Data source A packages the corresponding real-time data and returns it to data request group A;

[0168] S3. Calculate the variable values of basic variable A, basic variable B, basic variable F, and basic variable H based on the acquired real-time data;

[0169] Afterwards, S3->S4->S5, S3->S4'->…->S8' are executed separately as follows:

[0170] S4, calculating the variable value of the derived variable B according to the variable value of the basic variable F;

[0171] S5, calculating the variable value of the derived variable A according to the variable value of the basic variable B and the variable value of the derived variable B;

[0172] S4 '. The variable value of the basic variable A and the variable value of the basic variable H are combined into a variable value set A;

[0173] S5 '. The variable value set A and the calculation request are sent to the shared model A;

[0174] S6'. Shared model A returns the variable value of model variable A;

[0175] After S5', if the shared model A times out and fails to feed back the variable value of the model variable A (i.e., the real-time data callback time limit of the model variable A is exceeded), S7' is executed;

[0176] S7 '. The variable value set A and the calculation request are sent to the local model A;

[0177] S8'. Local model A returns the variable value of model variable A.

[0178] In the above steps, shared model A is the external model called. Generally speaking, the computing performance and results of shared model A are better than those of local model A. When shared model A exceeds the real-time data callback time limit of model variable A, the timeliness of variable calculation is affected. The variable value of model variable A is quickly obtained based on local model A.

[0179] In another embodiment of the present specification, when all sub-variables of a variable to be calculated have completed variable value calculation, the variable value of the variable to be calculated can be calculated based on the variable values of all sub-variables of the variable to be calculated.

[0180] After the variable value of the variable to be calculated is calculated, verification and error location need to be performed according to the method of the previous embodiment to ensure that the variable value is calculated correctly.

[0181] Based on the same inventive concept, the embodiments of this specification also provide a dependency-based variable calculation device, as described in the following embodiments. Because the principles for solving problems in the dependency-based variable calculation device are similar to those in the dependency-based variable calculation method, the implementation of the dependency-based variable calculation device can be referenced to the dependency-based variable calculation method, and any repetitions will not be repeated.

[0182] Specifically, such as Figure 15 As shown, the variable calculation device based on dependency relationship includes:

[0183] A receiving module 1510 is configured to receive a plurality of variables to be calculated;

[0184] Determination module 1520, configured to determine a subvariable of each variable to be calculated based on a dependency relationship between each variable to be calculated and other variables; wherein the dependency relationship with other variables is that the calculation of the variable value of the first variable depends on the variable value of the second variable;

[0185] A generating module 1530 is configured to generate a data request group corresponding to each data source based on all sub-variables and corresponding data sources, wherein the data request group is used to obtain real-time data of each sub-variable;

[0186] The calculation module 1540 is used to calculate the variable value of the variable to be calculated based on the acquired real-time data.

[0187] The dependency-based variable calculation method, apparatus, and computer device provided in the embodiments of this specification determine all sub-variables corresponding to the variable to be calculated based on the dependency relationship between each variable to be calculated and other variables, and group all sub-variables according to the corresponding different data sources to obtain multiple data request groups; then, a data acquisition request is initiated to each data source in units of the data request group, and the variable values of all variables to be calculated are calculated based on the returned real-time data; through the dependency relationship between the variables, the real-time data of all sub-variables are first obtained, and the corresponding variables to be calculated are calculated based on the obtained real-time data, thereby separating the dependencies between the variables to be calculated (that is, the subsequent variable to be calculated does not need to wait for the successful calculation of the previous variable to be calculated), thereby preventing the calculation efficiency of the overall variable from being affected by a single variable calculation failure; at the same time, each data source only needs to receive a real-time data acquisition request once, avoiding network congestion caused by frequent access and improving the overall variable calculation efficiency.

[0188] In one embodiment of this specification, a computer device is further provided for implementing the method described in any of the above embodiments, such as Figure 16 The diagram shows a schematic diagram of the structure of a computer device according to an embodiment of the present specification. Computer device 1602 may include one or more processors 1604, such as one or more central processing units (CPUs), each of which may implement one or more hardware threads. Computer device 1602 may also include any memory 1606 for storing any type of information, such as code, settings, data, etc. For example, and without limitation, memory 1606 may include any one or more combinations of the following: any type of RAM, any type of ROM, a flash memory device, a hard disk, an optical disk, etc. More generally, any memory may use any technology to store information. Furthermore, any memory may provide volatile or non-volatile retention of information. Furthermore, any memory may represent a fixed or removable component of computer device 1602. In one embodiment, when processor 1604 executes associated instructions stored in any memory or combination of memories, computer device 1602 may perform any operation of the associated instructions. Computer device 1602 also includes one or more drive mechanisms 1608, such as a hard disk drive mechanism, an optical disk drive mechanism, etc., for interacting with any memory.

[0189] The computer device 1602 may also include an input / output module 1610 (I / O) for receiving various inputs (via input devices 1612) and for providing various outputs (via output devices 1614). A specific output mechanism may include a presentation device 1616 and an associated graphical user interface (GUI) 1618. In other embodiments, the input / output module 1610 (I / O), input devices 1610, and output devices 1614 may not be included, and the computer device 1602 may simply be a computer device in a network. The computer device 1602 may also include one or more network interfaces 1620 for exchanging data with other devices via one or more communication links 1622. One or more communication buses 1624 couple the components described above together.

[0190] The communication link 1622 can be implemented in any manner, for example, through a local area network, a wide area network (e.g., the Internet), a point-to-point connection, etc., or any combination thereof. The communication link 1622 can include any combination of hardwired links, wireless links, routers, gateway functions, name servers, etc., governed by any protocol or combination of protocols.

[0191] Corresponding to Figures 1 to 14 The method in this specification also provides a computer-readable storage medium, which stores a computer program. When the computer program is executed by a processor, the steps of the above method are executed.

[0192] The embodiment of this specification also provides a computer-readable instruction, wherein when the processor executes the instruction, the program therein causes the processor to execute the following Figures 1 to 14 The method shown.

[0193] It should be understood that in the various embodiments of this specification, the size of the serial numbers of the above-mentioned processes does not mean the order of execution. The execution order of each process should be determined by its function and internal logic, and should not constitute any limitation on the implementation process of the embodiments of this specification.

[0194] It should also be understood that in the embodiments of this specification, the term "and / or" is merely a description of the relationship between associated objects, indicating that three possible relationships exist. For example, "A and / or B" can represent three situations: A exists alone, A and B exist simultaneously, and B exists alone. Furthermore, the character " / " in this specification generally indicates that the associated objects are in an "or" relationship.

[0195] Those skilled in the art will appreciate that the units and algorithm steps of each example described in conjunction with the embodiments disclosed in the embodiments of this specification can be implemented in electronic hardware, computer software, or a combination of the two. In order to clearly illustrate the interchangeability of hardware and software, the composition and steps of each example have been generally described in terms of function in the above description. Whether these functions are performed in hardware or software depends on the specific application and design constraints of the technical solution. Professional and technical personnel can use different methods to implement the described functions for each specific application, but such implementation should not be considered to be beyond the scope of the embodiments of this specification.

[0196] Those skilled in the art will clearly understand that, for the convenience and brevity of description, the specific working processes of the systems, devices and units described above can refer to the corresponding processes in the aforementioned method embodiments and will not be repeated here.

[0197] In the several embodiments provided in this specification, it should be understood that the disclosed systems, devices and methods can be implemented in other ways. For example, the device embodiments described above are merely illustrative. For example, the division of the units is merely a logical function division. In actual implementation, there may be other division methods, such as multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed. In addition, the mutual coupling or direct coupling or communication connection shown or discussed can be an indirect coupling or communication connection through some interfaces, devices or units, or can be an electrical, mechanical or other form of connection.

[0198] The units described as separate components may or may not be physically separate, and the components shown as units may or may not be physical units, that is, they may be located in one place or distributed across multiple network units. Some or all of the units may be selected according to actual needs to achieve the purpose of the embodiments of this specification.

[0199] In addition, the functional units in the various embodiments of this specification may be integrated into a single processing unit, or each unit may exist physically separately, or two or more units may be integrated into a single unit. The aforementioned integrated units may be implemented in the form of hardware or software functional units.

[0200] If the integrated unit is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the embodiment of this specification is essentially or the part that contributes to the prior art, or all or part of the technical solution can be embodied in the form of a software product, and the computer software product is stored in a storage medium, including a number of instructions for enabling a computer device (which can be a personal computer, a server, or a network device, etc.) to execute all or part of the steps of the method described in each embodiment of this specification. The aforementioned storage medium includes: various media that can store program codes, such as a USB flash drive, a mobile hard disk, a read-only memory (ROM), a random access memory (RAM), a magnetic disk or an optical disk.

[0201] Specific embodiments are used in this specification to illustrate the principles and implementation methods of this specification. The description of the above embodiments is only used to help understand the methods and core ideas of the embodiments of the specification. At the same time, for those skilled in the art, based on the ideas of the embodiments of this specification, there will be changes in the specific implementation methods and application scope. In summary, the content of this specification should not be understood as a limitation on the embodiments of this specification.

Claims

1. A variable calculation method based on dependency relationship, characterized in that: The method comprises: Receive multiple variables to be calculated; Determine the sub-variables of each variable to be calculated based on the dependency relationship between each variable to be calculated and other variables; wherein the dependency relationship with other variables is that the calculation of the variable value of the first variable depends on the variable value of the second variable; Generate a data request group corresponding to each data source based on all sub-variables and their corresponding data sources, wherein the data request group is used to obtain real-time data of each sub-variable; Calculate the variable value of the variable to be calculated based on the real-time data obtained.

2. The method according to claim 1, wherein The sub-variables include basic variables and / or derived variables; Based on all sub-variables and corresponding data sources, a data request group corresponding to each data source is generated, including: When a subvariable is a derived variable, the subvariable of the subvariable is determined based on the dependency relationship between the subvariable and other variables; Based on all basic variables and corresponding data sources, a data request group corresponding to each data source is generated.

3. The method according to claim 2, wherein After obtaining the real-time data required for each variable to be calculated from each data source, it also includes: Calculate and store the variable value of each basic variable according to the real-time data; When the real-time data of all basic variables of a certain variable have been obtained, the variable values of all sub-variables of the variable are calculated and stored based on the real-time data.

4. The method according to claim 3, wherein Calculate and store the variable value of all subvariables of this variable, including: Determine in sequence whether each subvariable of the variable is the same as a subvariable of another variable; the subvariable is a variable whose variable value has been calculated; If the judgment is no, calculate and store the variable value of the subvariable.

5. The method according to claim 3, wherein After calculating the variable values of all subvariables of this variable, including: Determine whether the variable values of each sub-variable of the variable are abnormal; If the answer is yes, the variable value calculation of all sub-variables corresponding to the abnormal sub-variable and the same data source is suspended, and the real-time data is obtained again.

6. The method according to claim 5, wherein When the variable with an abnormal value is a variable to be calculated or a derived variable, it also includes: According to the variable value calculation process of the variable, determine the step of calculation abnormality; Determine the abnormal value according to the steps of calculating the abnormality; According to the abnormal value, the abnormal sub-variables of the variable are determined.

7. The method according to claim 6, wherein According to the abnormal value, the abnormal sub-variables of the variable are determined, including: If the abnormal value exceeds the abnormal threshold range, determine whether the denominator in the expression for calculating the abnormal value is abnormal; If abnormal, the abnormal sub-variable is determined based on the denominator.

8. The method according to claim 3, wherein Stores the variable values of all sub-variables of this variable, including: Determine the storage priority of each sub-variable of the variable according to the dependency relationship associated with each sub-variable of the variable; According to the storage priority, each sub-variable is stored in a buffer area with different transmission efficiency.

9. The method according to claim 1, wherein The method further comprises: When there is a subvariable that exceeds the real-time data callback time limit, obtain the task information and historical real-time data of the subvariable that exceeds the real-time data callback time limit; Determine, according to the task information, an alternative sub-variable from the sub-variables that have completed the real-time data callback; The real-time data of the sub-variable that exceeds the real-time data callback time limit is determined according to the real-time data of the candidate sub-variable and the historical real-time data.

10. The method according to claim 9, wherein Determining the real-time data of the sub-variable that exceeds the real-time data callback time limit according to the real-time data of the candidate sub-variable and the historical real-time data includes: Calculating the information correlation between the historical real-time data and the task information, and the information correlation between the real-time data of the candidate sub-variable and the task information; The real-time data with the greatest information correlation between the two is determined as the real-time data of the sub-variable that exceeds the real-time data callback time limit.

11. The method according to claim 1, wherein Calculate the variable values of the variables to be calculated based on the acquired real-time data, including: When all sub-variables of a variable to be calculated have completed the variable value calculation, the variable value of the variable to be calculated is calculated based on the variable values of all sub-variables of the variable to be calculated.

12. A variable calculation device based on dependency relationship, characterized in that: The device comprises: A receiving module, used for receiving multiple variables to be calculated; a determination module, configured to determine a subvariable of each variable to be calculated based on a dependency relationship between each variable to be calculated and other variables; wherein the dependency relationship with other variables is that the calculation of the variable value of the first variable depends on the variable value of the second variable; A generation module, configured to generate a data request group corresponding to each data source based on all sub-variables and corresponding data sources, wherein the data request group is used to obtain real-time data of each sub-variable; The calculation module is used to calculate the variable value of the variable to be calculated based on the acquired real-time data.

13. A computer device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein: When the processor executes the computer program, the method according to any one of claims 1 to 11 is implemented.

14. A computer-readable storage medium storing a computer program, characterized in that: When the computer program is executed by a processor of a computer device, the method according to any one of claims 1 to 11 is implemented.

15. A computer program product, comprising a computer program, characterized in that When the computer program is executed by a processor of a computer device, the method according to any one of claims 1 to 11 is implemented.