Method and device for reading table in actuarial model, computer equipment and medium
By analyzing variables and determining tables in the actuarial model, combined with a hierarchical query mechanism, the problems of large data volume and slow reading speed in the existing technology are solved, and efficient data reading and simplified table design are achieved.
Patent Information
- Application Number
- CN202411638894.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-11-15
- Publication Date
- 2025-02-28
AI Technical Summary
In actuarial models, the prior art is difficult to take into account the small amount of data, easy table understanding and fast data reading speed. Especially when processing huge tables, there are problems such as data redundancy, slow reading speed and low computing efficiency.
By analyzing the variables to be used in the calculation process of the actuarial model, determining the table where the target variable is located, and performing hierarchical query in the table based on the calculation parameters, determining whether the queryed data is a table name or a constant, and thus implementing nested hierarchical query to reduce the amount of data in each individual table.
It has achieved significant improvement in data reading performance, reduced the amount of table data, and enabled the system to locate and obtain required data faster without full table scanning, simplifying the design and management of data tables, and reducing the maintenance workload of data tables.
Smart Images

Figure CN119537404A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of data processing technology, and in particular to a method, device, computer equipment and medium for reading a table in an actuarial model. Background Art
[0002] Actuarial models are mathematical models used to assess and manage uncertainty and risk in finance, insurance, and risk management. These models help actuaries perform data analysis, predict future financial or risk events, and support decision making. Actuarial models provide a scientific basis for insurance companies, pension plans, portfolio management, and other financial fields by quantifying risks and expected financial outcomes.
[0003] Actuarial models involve a lot of calculations of data related to existing assets, future risks, and expected returns. When calculating such data, a lot of existing data is used, and different hypothetical probabilities for future time and scenarios are introduced. Therefore, importing tables into actuarial models for related model calculations is a very important and high-frequency link. At the same time, since these data and hypothetical probabilities are huge tables that are very large and complex, data reading efficiency has become an aspect that actuarial models need to pay special attention to.
[0004] In the prior art, solutions for actuarial models to read table data include two methods: a method of reading all table data and a method of reading data required by the model from different tables based on table nesting.
[0005] Among them, the above-mentioned method of reading all the table data is a basic and effective method to directly read the original data table into the actuarial model. The specific method is to spread out and maintain the full amount of data to be used in the table (similar to the Cartesian product result), and the actuarial system reads the full table, and then locates the specific data to be used according to the current dimension value during calculation. For example, for a hypothesis name A, there are 100 different annual values for the probability, so there will be 100 rows of data. If there are N different scenarios for hypothesis A, and each scenario itself has 100 values, then there will be 100*N*100 rows of data that need to be read.
[0006] The inventors have found that this data reading method displays all the data, and the data reading logic is simple, so users can view and understand the data very clearly; however, the data is redundant and repeated, especially when facing huge tables, which takes up a lot of space, has a slow data reading speed and low computing efficiency.
[0007] Regarding the above-mentioned method of reading from different tables based on table nesting, the data tables with related relationships are secondary associated, and the related data are maintained in their respective tables. At the same time, associated primary key index fields are added to the tables to achieve table nesting, so as to achieve the purpose of data matching between related data tables. When importing the actuarial model, the values required for model calculation are read from different tables through the established associated primary key index fields to obtain all the data required for model calculation.
[0008] The inventors have found that compared with the above-mentioned method of reading all table data, this data reading method reads data from the table on demand, does not need to pre-store all the combined values, reduces data redundancy, and helps to speed up the model loading speed and processing efficiency. However, it is necessary to establish an associated primary key index field in the table to realize the association of the data table, which makes it difficult for others to view and understand the index.
[0009] Therefore, the above two actuarial models’ methods of reading table data cannot take into account both small data volume and easy understanding of the table.
[0010] In addition, the inventors further studied the above two data reading methods and found that no matter which method is used, it is necessary to write computer program code to implement the data reading function to read the data required for model calculation from the table and assign it to the model variables. Therefore, the prior art based on the above two data reading methods requires a certain programming operation threshold when using the actuarial model. At the same time, in the scenario of actuarial model calculation, it is often necessary to track the calculation path. However, in the existing table data reading method, the relationship between variables and tables is equivalent to a black box for actuarial model users, especially complex calculation logic, which makes it difficult to track the relationship between tables and variables.
[0011] In summary, in the scenario where the actuarial model reads tabular data, how to resolve the contradictions in the existing technology in terms of data size, table understanding difficulty, and table data reading speed has become a technical problem that urgently needs to be solved in this field. Summary of the invention
[0012] The purpose of the present invention is to provide a method, device, computer equipment and medium for reading a table in an actuarial model, so as to solve the above-mentioned technical problems in the prior art.
[0013] On the one hand, to achieve the above-mentioned purpose, the present invention provides a method for reading a table in an actuarial model.
[0014] The method for reading a table in the actuarial model includes: parsing the variables to be used in the calculation process of the actuarial model to obtain the target variable; obtaining the calculation parameters that limit the target variable according to the calculation task; determining the table where the target variable is located as the target table; querying the target table according to the calculation parameters; judging whether the currently queried data is a table name or a constant; if the currently queried data is a table name, continuing to query in the table corresponding to the table name; if the currently queried data is a constant, determining the value of the target variable according to the constant.
[0015] Further, the target table includes a data column corresponding to the calculation parameter and a data column corresponding to the target variable, and the step of querying in the target table according to the calculation parameter includes: querying the data under the data column corresponding to the calculation parameter in the target table to obtain first data; when the first data is a data interval expressed in an interval manner, judging whether the calculation parameter belongs to the data interval; when the calculation parameter belongs to the data interval, determining that the behavior where the first data is located is a data row that satisfies the calculation parameter; wherein, when there are multiple calculation parameters that limit the target variable, determining that the data rows that satisfy all the calculation parameters and the data marked by the data column corresponding to the target variable are the data corresponding to the target variable.
[0016] Further, the data interval includes a first endpoint value, a second endpoint value less than the first endpoint value, a first symbol indicating whether the first endpoint value is included, and a second symbol indicating whether the second endpoint value is included, wherein the endpoint value includes a first character representing positive infinity and a second character representing negative infinity.
[0017] Furthermore, the step of determining the table where the target variable is located as the target table includes: parsing the configuration information of the target variable, wherein the configuration information of the variable includes a variable type, the variable type includes a table, and when the variable type is a table, the configuration information also includes an associated table of the variable; if it is parsed that the variable type of the target variable is a table, determining the associated table of the target variable as the target table.
[0018] Furthermore, the configuration information of the variable also includes the node to which the variable belongs in a preset tree structure, the tree structure includes at least two layers of nodes, and the step of querying in the target table according to the calculation parameters includes: querying the target table for data matching the target node, wherein the target node is the node to which the target variable belongs in the tree structure; when no data matching the target node is found, acquiring the upper nodes of the target node layer by layer from bottom to top until data matching a node in the tree structure is found; and querying the data matching the node for data satisfying the calculation parameters.
[0019] Furthermore, the method for reading tables in the actuarial model also includes: determining the reference relationship between the variable and the table according to the associated table of the variable; determining the inclusion relationship between the tables according to the table names in the associated table; and constructing a relationship diagram between the variable and the table according to the reference relationship and the inclusion relationship.
[0020] Furthermore, the step of querying in the target table according to the calculation parameters and the step of continuing to query in the table corresponding to the table name both include the following steps: determining whether the data volume of the table to be queried exceeds a preset data volume threshold; when the data volume of the table to be queried exceeds the preset data volume threshold, splitting the table to be queried into at least two table fragments according to the table dimension; and reading the table fragments of the dimension where the query condition is located into the memory for query.
[0021] On the other hand, to achieve the above-mentioned purpose, the present invention provides a device for reading a table in an actuarial model.
[0022] The device for reading tables in the actuarial model includes: a parsing module, which is used to parse the variables to be used in the calculation process of the actuarial model to obtain the target variables; an acquisition module, which is used to obtain the calculation parameters that limit the target variables according to the calculation tasks; a determination module, which is used to determine the table where the target variables are located as the target table; a query module, which is used to query the target table according to the calculation parameters; a judgment module, which is used to judge whether the currently queried data is a table name or a constant; the query module is also used to continue to query in the table corresponding to the table name when the currently queried data is a table name, and to determine the value of the target variable according to the constant when the currently queried data is a constant.
[0023] On the other hand, to achieve the above objectives, the present invention also provides a computer device, including a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor implements the steps of the above method when executing the computer program.
[0024] On the other hand, to achieve the above object, the present invention also provides a computer-readable storage medium on which a computer program is stored, and when the computer program is executed by a processor, the steps of the above method are implemented.
[0025] The method, device, computer equipment and medium for reading a table in an actuarial model provided by the present invention analyze the variables to be used in the calculation process of the actuarial model and define them as target variables, determine the table where the target variables are located as the target table, and after obtaining the calculation parameters that limit the target variables according to the calculation task, query the target table according to the calculation parameters. The data in the table mixes constants and table names, so it is determined whether the currently queried data is a table name or a constant. If the queried data is a table name, jump to another more specific table to continue searching. This hierarchical mechanism effectively reduces the amount of data in each individual table. If the queried data is a constant, the value of the target variable is determined according to the constant. Compared with the method of fully reading table data in the prior art, table nesting and hierarchical query are implemented, thereby greatly reducing the amount of table data. At the same time, the system can locate and obtain required data more quickly when reading, without the need to scan the entire large table, thereby significantly improving data reading performance; compared with the method of reading from different tables based on table nesting in the prior art, the query process can directly implement a hierarchical search mechanism based on the queried table name step by step, and the table no longer requires complex primary key indexes for efficient query, which simplifies the design and management of data tables and makes data storage more lightweight and easy to understand. In addition, the lack of primary key index requirements also means that the maintenance workload of data tables is reduced, especially in situations where data is frequently updated or modified. Tables that mix constants and table names provide flexibility in data table settings, and the hierarchy and content of data tables can be flexibly adjusted as needed, making the table logic more intuitive and easy to manage, and it is also easier to adjust and expand each table. BRIEF DESCRIPTION OF THE DRAWINGS
[0026] Various other advantages and benefits will become apparent to those of ordinary skill in the art by reading the detailed description of the preferred embodiments below. The accompanying drawings are only for the purpose of illustrating the preferred embodiments and are not to be considered as limiting the present invention. Moreover, the same reference symbols are used throughout the accompanying drawings to represent the same components. In the accompanying drawings: Figure 1 A flowchart of a method for reading a table in an actuarial model provided in Embodiment 1 of the present invention; Figure 2 A schematic diagram of the relationship between variables and tables in the actuarial model provided in the first embodiment of the present invention; Figure 3 A schematic diagram of a table to be read in the actuarial model provided in the first embodiment of the present invention; Figure 4 A schematic diagram of variable configuration in an actuarial model provided in the first embodiment of the present invention; Figure 5 A schematic diagram of a tree structure node in an actuarial model provided in the first embodiment of the present invention; Figure 6 A block diagram of a device for reading a table in an actuarial model provided in Embodiment 2 of the present invention; Figure 7 This is a hardware structure diagram of a computer device provided in Embodiment 3 of the present invention. DETAILED DESCRIPTION
[0027] In order to make the purpose, technical scheme and advantages of the present invention more clearly understood, the present invention is further described in detail below in conjunction with the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are only used to explain the present invention and are not intended to limit the present invention. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without making creative work are within the scope of protection of the present invention.
[0028] Embodiment 1 The embodiment of the present invention provides a method for reading a table in an actuarial model, by which the amount of data can be reduced, the difficulty of understanding the table can be reduced, and the speed of reading the table data can be improved when reading the table in the actuarial model. Specifically, Figure 1 This is a flow chart of a method for reading a table in an actuarial model provided in Embodiment 1 of the present invention, such as Figure 1 As shown, the method for reading a table in an actuarial model provided in this embodiment includes the following steps S101 to S107.
[0029] Step S101: Analyze the variables to be used in the calculation process of the actuarial model to obtain the target variables.
[0030] Specifically, actuarial models include: life insurance models, which are used to predict life-related risk events, such as mortality rates, changes in life expectancy, etc., and are used for pricing and reserve assessment of life insurance products; health insurance models, which model factors such as disease incidence and medical cost inflation, and are used for pricing and cost forecasting of health insurance products; loss distribution models, which are often used in property and casualty insurance to help predict the distribution of losses caused by specific risks (such as natural disasters and traffic accidents); pension models, which are used to evaluate pension plans, taking into account factors such as payout ratios, investment returns, and retirement age to ensure the long-term payability of pensions; capital models, which are widely used in enterprise risk management to help companies assess capital requirements to meet the capital adequacy requirements of regulators.
[0031] Actuarial models usually include the following key elements: data input, assumptions, mathematical and statistical methods, and model output. The data used in actuarial models include historical data and statistical data. Data input to the actuarial model is the input basis of the model. Actuaries use this data to analyze past trends and predict future changes. Assumptions include scenarios such as interest rates, mortality rates, disease incidence, and changes in the economic environment, which help actuaries predict future risks and returns in different actuarial scenarios. Mathematical and statistical methods are used by the model, including probability theory, statistics, financial mathematics, and other mathematical methods. These methods help quantify the relationship between different variables and simulate the possibility of various risk events. The final results of the model are usually output in the form of expected costs, premiums, reserves, or future payment flows. These results can help financial and insurance companies formulate appropriate pricing, reserves, investments, and risk mitigation strategies.
[0032] Among them, the variables to be used in the actuarial model calculation process include the variables used in the above-mentioned data and statistical methods and other models. Before querying the table, the variables to be used in the actuarial model calculation process are first parsed and used as the target variable, so that in the subsequent steps, the target variable is used as the query target, and the corresponding variable value is read from the corresponding table. Optionally, the variables to be used in the actuarial model calculation process can be formed into a variable table in advance, and the variables in the table are read to obtain the target variable. Alternatively, in the actuarial model calculation process, the variables to be used in the current calculation step can be used as the target variable. Alternatively, it can also be other scenarios, which are not limited in this application.
[0033] Step S102: Obtain calculation parameters of limited target variables according to the calculation task.
[0034] When the model performs a calculation task, it will first identify the current calculation conditions and actuarial scenarios. Among them, the calculation conditions may include time (such as year or quarter), demographic characteristics (such as gender, age), economic scenarios (such as inflation rate, interest rate), etc.; actuarial scenarios may include changes in the economic environment (such as interest rate fluctuations), demographic characteristics (such as mortality rate, morbidity rate), market risk factors (such as return on investment), etc. The above calculation parameters can specifically be the input parameters of the model or the intermediate parameters generated by other calculation steps. In this step, according to the calculation task, the calculation conditions that limit the target variable or the calculation parameters of the actuarial scenario are obtained.
[0035] Step S103: Determine the table where the target variable is located as the target table.
[0036] In this step, according to the parsed target variable, the data table where the target variable is located is found as the target table for subsequent data query and reading. For example, if the target variable is "male mortality rate in 2022", it is determined that the table where it is located is the "demographic data table".
[0037] Alternatively, in one embodiment, a configuration table or mapping file may be established in the system to predefine the mapping relationship between each variable and the data table where it is located. This may be a hard-coded rule or a dynamically configured mapping table. In this step, the table where the target variable is located is determined by querying this configuration table or mapping file. Alternatively, in another embodiment, each variable may be attached with some attributes or tags when it is defined to identify the data table where it is located. In this step, the data table where the target variable is located is determined by identifying the attributes of the variable and dynamically parsing it. For example, the variable "male mortality rate" sets an attribute "data source", and the attribute value is "demographic data table". When the system processes the variable, it will read its "data source" attribute and directly associate it with the corresponding data table. Alternatively, the variable may be classified according to its category or type, and the data table where it is located is associated with these categories. For example, "demographic variables" are all associated with "demographic data table", and "economic assumption variables" are all associated with "economic parameter data table". The system uses the category of the variable to automatically select the data table.
[0038] Regardless of which of the above methods or other methods in the prior art is adopted, through this step, the table where the target scalar is located is determined, that is, the entry table to be queried in the subsequent steps is determined.
[0039] Step S104: query in the table according to the calculation parameters.
[0040] In this step, you first query data in the target table using calculation parameters (such as time, gender, age group, etc.) to find data values under specific conditions. For example, the query conditions can be "year = 2022" and "gender = male" to filter out matching rows from the target table.
[0041] Secondly, in the subsequent steps, if the queried data is a table name, return to this step and continue to query in the table corresponding to the queried table name.
[0042] Step S105: Determine whether the currently queried data is a table name or a constant.
[0043] In this embodiment, the table can be set with at least two types of data, that is, at least constants and table names. Among them, constants refer to actual values, such as rates, probabilities and other specific data, which can be directly used for the calculation of actuarial models. Table names refer to names pointing to other tables, indicating that if the current query result is a table name, the system should continue to query in the corresponding subtable. In the table of this embodiment, there are both table names and constants, that is, values and nested table names are mixed, so that in some complex calculation data tables, a mixed form of constants + table names is used to realize nested reading of tables. Figure 2 A schematic diagram of the relationship between variables and tables in the actuarial model provided in the first embodiment of the present invention, such as Figure 2 As shown, when the variable death_mult_pc is 2024, the constant 80 is queried, but when it is 2018, (2018, 2023], the table name DTH_MLT_TBL is queried.
[0044] Optionally, a query rule is preset, and in this step, the preset query rule is used to determine whether the queried data is a table name or a constant. Further optionally, the query rule is set as follows: when the queried data is a numeric character (specifically, a numerical type such as an integer or a floating point number), the queried data is a constant; when the queried data is a non-numeric character (specifically, a string type), the queried data is a table name. Based on the query rule, in this step, if the query result is a string and conforms to the format of the table name, the system will recognize it as a table name, return to step S104, and continue to query in the table corresponding to the table name. If the query result is a numerical value, it is recognized as a constant, and the following step S106 is executed.
[0045] Among them, if the currently queried data is a table name, the system loads or accesses the table pointed to by the table name according to the table name, and uses the same calculation parameters or updated query conditions for further data query. For example, if the "mortality parameter table" is the queried table name, the system will enter the table and continue to search for data that meets the calculation parameters. Among them, the actual table can have multiple tables nested layer by layer as needed. In each query step, the query is performed in the corresponding table according to the table name until a constant value is finally obtained. In order to prevent the query from entering an endless loop or infinite recursion, a query depth limit can be set.
[0046] Step S106: If the currently queried data is a constant, determine the value of the target variable according to the constant.
[0047] In this step, when the queried data is a constant, the system assigns this constant to the target variable as the final value of the target variable for subsequent calculations.
[0048] The method for reading a table in an actuarial model provided in this embodiment is adopted to parse the variables to be used in the calculation process of the actuarial model and define them as target variables. The table where the target variables are located is defined as the target table. After obtaining the calculation parameters that limit the target variables according to the calculation task, the target table is queried according to the calculation parameters. The data in the table is a mixture of constants and table names, so it is determined whether the currently queried data is a table name or a constant. If the queried data is a table name, jump to another more specific table to continue searching. This hierarchical mechanism effectively reduces the amount of data in each individual table. If the queried data is a constant, the value of the target variable is determined according to the constant. Compared with the method of fully reading table data in the prior art, table nesting and hierarchical query are implemented, thereby greatly reducing the amount of table data. At the same time, the system can locate and obtain required data more quickly when reading, without the need to scan the entire large table, thereby significantly improving data reading performance; compared with the method of reading from different tables based on table nesting in the prior art, the query process can directly implement a hierarchical search mechanism based on the queried table name step by step, and the table no longer requires complex primary key indexes for efficient query, which simplifies the design and management of data tables and makes data storage more lightweight and easy to understand. In addition, the lack of primary key index requirements also means that the maintenance workload of data tables is reduced, especially in situations where data is frequently updated or modified. Tables that mix constants and table names provide flexibility in data table settings, and the hierarchy and content of data tables can be flexibly adjusted as needed, making the table logic more intuitive and easy to manage, and it is also easier to adjust and expand each table.
[0049] Optionally, in one embodiment, the target table includes a data column corresponding to the calculation parameter and a data column corresponding to the target variable, and the step of querying in the target table according to the calculation parameter includes: querying the data under the data column corresponding to the calculation parameter in the target table to obtain first data; when the first data is a data interval expressed in an interval manner, judging whether the calculation parameter belongs to the data interval; when the calculation parameter belongs to the data interval, determining that the behavior where the first data is located is a data row that satisfies the calculation parameter; wherein, when there are multiple calculation parameters that limit the target variable, determining that the data rows that satisfy all the calculation parameters and the data marked by the data column corresponding to the target variable are the data corresponding to the target variable.
[0050] Specifically, Figure 3 This is a schematic diagram of a table to be read in the actuarial model provided in the first embodiment of the present invention, such as Figure 3As shown, in this embodiment, constants in the table support the expression using data ranges. Further optionally, the data range includes a first endpoint value, a second endpoint value smaller than the first endpoint value, a first symbol indicating whether the first endpoint value is included, and a second symbol indicating whether the second endpoint value is included. For example, for 1, 2, 3, 4, 5, it can be expressed in the form of (1, 5]. For whether the data range includes endpoint values, that is, open intervals and closed intervals, it supports the same expression as in mathematical operations. An open interval is represented by round brackets "(a, b)", that is, using round brackets (parentheses) to indicate that the endpoint values are not included, and a closed interval is represented by square brackets "[a, b]", that is, using square brackets (brackets) to indicate that the endpoint values are included. If it is a half-open and half-closed interval, it is represented by "(a, b]" or "[a, b)". Among them, the endpoint values also include a first character representing positive infinity and a second character representing negative infinity. For example, inf is used to represent positive infinity, and -inf is used to represent negative infinity. That is, if it represents >a and <b, they can be represented by "(a, inf)" or (-inf, b) respectively.
[0051] On this basis, when querying in the target table according to calculation parameters, first query the data in the data column corresponding to the calculation parameter. If the queried data is a data range, determine whether the calculation parameter belongs to this data range to locate the data row that meets the calculation parameter. For the case of multiple calculation parameters, the data calibrated by the data row that meets all calculation parameters and the data column corresponding to the target variable is the data corresponding to the target variable.
[0052] For example, in Figure 3 the shown table, the calculation parameters include GAAP, 2023, 25, and 1. Then query the data in the assmp_year data column. Then, in the BASIS data column, query the data rows that meet the calculation parameter GAAP. In Figure 3 there are multiple data rows that meet the calculation parameter GAAP; query the data in the assmp_year data column, and the queried data is the data range [2023, 2024]. Determine that 2023 is within this data range, then the data row where [2023, 2024] is located is the data row that meets the calculation parameter 2023. In Figure 3 there are multiple data rows that meet the calculation parameter 2023; query the data in the prem_paybl_y data column, and the queried data is the data range (20, 30]. Determine that 25 is within this data range, then the data row where (20, 30] is located is the data row that meets the calculation parameter 2023. In Figure 3There are multiple data rows that meet the calculation parameter 25; when querying data under the policy_year data column, the data found is 1. Finally, the data rows that meet all the calculation parameters and the data column corresponding to the target variable comm_rate_pc are calibrated with data 31.4, which is the data corresponding to the target variable comm_rate_pc.
[0053] In the method for reading a table in the actuarial model provided in this embodiment, the table rows that can be merged are merged using data intervals as needed, so that some repeated rows in the table can be merged to reduce duplicate data in a single table, further reduce the amount of data read from the table, and reduce data storage space and reading resource overhead. At the same time, the expression based on the data interval is simple in logic and easy to understand. In other words, although the data expression method of "data interval" itself is a common mathematical logic, it is cleverly applied to data tables in the actuarial model scenario, which is adapted to the characteristic that duplicate data is easy to exist in a single data table in the actuarial model scenario, and better solves the problem of large amount of table data in the actuarial model scenario. It is also easy to understand and convenient for backtracking of actuarial results, which is one of the very important invention points of this application.
[0054] Optionally, in one embodiment, the step of determining the table where the target variable is located as the target table includes: parsing the configuration information of the target variable, wherein the configuration information of the variable includes the variable type, the variable type includes a table, and when the variable type is a table, the configuration information also includes an associated table of the variable; if the variable type of the target variable is parsed to be a table, determining the associated table of the target variable as the target table.
[0055] Specifically, before the variable is used, the variable is configured to form configuration information, wherein the configuration items include the configuration of the variable type. The variable type is set to include a table type and a non-table type, wherein the non-table type can be a variable type in the prior art, which will not be further elaborated here. When the variable type of the variable is a table, the configuration item also includes an associated table of the variable, that is, the table where the variable is located is configured as an associated table of the variable, wherein the table can be in the form of a csv file or other database. On this basis, when determining the target table, first obtain and parse the configuration information of the target variable, from which it is parsed that the variable type of the target variable is a table, and further parse the associated table of the target variable, that is, the target table.
[0056] Further optionally, when implementing the configuration of variables, graphical buttons and menus are used instead of manually writing codes, so that users can directly complete the configuration of variables by clicking, selecting and configuring, and form the configuration information of the variables. Specifically, the user can define a variable through the "Add Variable" button. When configuring the variable, the user sets the variable type to "Table", that is, the variable is limited to a data table. Then the system will display the data table selection options. The user selects a specific data table, and the system automatically associates the data in the data table with the variable, and automatically reads and assigns values at runtime.
[0057] Figure 4 This is a schematic diagram of variable configuration in the actuarial model provided in the first embodiment of the present invention, such as Figure 4 As shown, the system interface provides configuration buttons and options. The user selects the variable name of the variable to be configured as EXP_ASMP_TBL on the interface, and then selects the variable type Type as Table for the variable, and further selects the associated table CI. The system will automatically generate the reading and positioning logic when determining the target table.
[0058] By adopting the method of reading tables in the actuarial model provided in this embodiment, when using the system to assign values to variables in a table, based on the way of configuring variables by clicking buttons, it is only necessary to set the variable type to a table, and then select the corresponding data table to achieve the association and assignment of variables and data tables, and remove the operational threshold for code writing. When assigning values to variables, the system will automatically parse the configuration information of the scalar, use the configuration information to locate the specific data table selected by the user, and read data from the table at runtime through the system's built-in logic, so as to automatically perform operations such as association, reading, and querying of table data. Users only need to specify the table associated with the variable, without having to write code, which makes the connection process between variables and data tables simple and transparent, making the entire operation process more convenient and intuitive, suitable for actuarial scenarios, and is another very important invention of this application.
[0059] Optionally, in one embodiment, the configuration information of the variable also includes the node to which the variable belongs in a preset tree structure, the tree structure includes at least two layers of nodes, and the step of querying in the target table according to the calculation parameters includes: querying the target table for data matching the target node, wherein the target node is the node to which the target variable belongs in the tree structure; when no data matching the target node is found, obtaining the upper nodes of the target node layer by layer from bottom to top until data matching a node in the tree structure is found; and querying the data matching the node for data that meets the calculation parameters.
[0060] Specifically, each variable adds a custom Class attribute to mark its level, so that different variables form a hierarchical relationship, that is, a tree structure. For example, variables can be divided into a multi-layer structure such as "total> major category> subcategory> last subcategory" to form a tree structure. In the tree structure, the top-level node has the highest level of value, and the value of the last-level node is the most detailed. Each lower-level node can "inherit" the value of the upper-level node, so that different values are used at different levels, or the general value of the upper-level node is used when there is no precise value.
[0061] When configuring a variable, the configuration items include the node to which the variable belongs in the tree structure, and the configuration is written into the variable configuration information when the configuration is completed. When querying in the target table according to the calculation parameters, first determine the node to which the target scalar belongs in the tree structure from the configuration information of the target variable, that is, the target node, and then query the data matching the target node in the target table. If the query fails, the system will automatically search upward layer by layer until valid matching data is found.
[0062] For example, if the target variable is "insurance premium rate", its tree structure includes the hierarchical nodes of "insurance product>life insurance product>long-term insurance product>whole-life insurance product>whole-life critical illness insurance product". In this structure, at the "insurance product" level, the basic premium rate of the insurance product is defined; if a "life insurance product" has a specific rate, the node at the life insurance product level will cover the basic rate; if a "long-term insurance product" has a further specific rate for the insurance product, the node at the long-term insurance level will cover the specific rate of the "life insurance product"; if a "whole-life insurance product" has a further specific rate for the insurance product, the node at the long-term insurance level will cover the specific rate of the "long-term insurance product"; at the "whole-life critical illness insurance product" level, more specific rates can be defined. If data is missing, the rate will be obtained by tracing back to the upper node along the tree structure.
[0063] Figure 5 A schematic diagram of a tree structure node in the actuarial model provided in the first embodiment of the present invention, such as Figure 5 As shown, when setting the variable, set the Class attribute of variable TTT2 under the tree structure PROD to node t6_1. When querying variable TTT2, if policy_year is 1, data matching the target node t6_1 can be queried, and the value of variable TTT2 is 846.3; if policy_year is 4, data matching the target node t6_1 cannot be queried, and the data corresponding to the upper layer node test_q6, 979.6, is queried as the value of variable TTT2.
[0064] The method for reading tables in the actuarial model provided by this embodiment is adopted. By defining a tree-like hierarchical structure for the variables, and making them have the attribute of "inheritance" based on the node hierarchical relationship in the tree structure, when querying data, first query the data that matches the attribute node of the variable itself. If no data is found, then search upward layer by layer along the tree structure until valid data is found. On the one hand, this logic can avoid the failure of value acquisition due to the lack of data in the current node, so that the model can flexibly backtrack when encountering special situations. On the other hand, through inheritance, variables can uniformly define a part of common data in the top-level class or branch node, and subclasses only need to define different points; on the other hand, it also supports flexible customization of variables as multiple values when taking values in different dimensions. Therefore, the method for reading tables in the actuarial model provided in this embodiment reduces error returns during data reading and can implement the values of multiple variables under the same attributes through one-time maintenance without the need to define each node one by one, thereby further reducing data redundancy and table configuration, and thus improving the reading efficiency of the system. For exceptional specific variables, personalized values can still be taken to meet personalized needs; a variable can also be flexibly customized to multiple values in different dimensions, making the table-based actuarial model calculation more flexible and suitable for actuarial scenarios, which is another very important invention point of the present application.
[0065] Optionally, in one embodiment, the method for reading a table in the actuarial model further includes: determining a reference relationship between a variable and a table based on an associated table of the variable; determining an inclusion relationship between tables based on a table name in the associated table; and constructing a relationship diagram between the variable and the table based on the reference relationship and the inclusion relationship.
[0066] Specifically, as mentioned above, when configuring a variable, it includes configuring the associated table of the variable, based on which the associated table that needs to be referenced when the variable is valued can be obtained, that is, the reference relationship between the variable and the table; the data of the associated table includes the table name, based on which the table contained in the associated table can be obtained, that is, the inclusion relationship between the tables, and the relationship diagram between the variable and the table can be constructed using the reference relationship and inclusion relationship. Figure 2 , the relationship between the table and the variable is clearly visible, so that the upstream and downstream relationships can be tracked. The table "DEATH_RATE_INFO" in the middle of the relationship diagram is the current data table. Figure 2 The variable "death_sel_pc" on the right side is referenced during the calculation. Figure 2 As shown on the left side of the figure, the table contains a table named "DTH_SELECT_TBL". From the relationship diagram, it can be clearly seen that the calculation of the variable "death_sel_pc" further references "DTH_SELECT_TBL" by referencing the table "DEATH_RATE_INFO".
[0067] The method for reading tables in the actuarial model provided in this embodiment is used to form a relationship diagram between variables and tables based on the reference relationship between variables and tables and the inclusion relationship between tables, which is conducive to tracking the calculation path of actuarial results in actuarial scenarios.
[0068] Optionally, in one embodiment, the step of querying in the target table according to the calculation parameters and the step of continuing to query in the table corresponding to the table name both include the following steps: determining whether the data volume of the table to be queried exceeds a preset data volume threshold; when the data volume of the table to be queried exceeds the preset data volume threshold, splitting the table to be queried into at least two table fragments according to the table dimension; and reading the table fragments of the dimension where the query condition is located into the memory for query.
[0069] Specifically, in the calculation of the actuarial model, when the table data is read, whether it is a full-scale reading method or a nested table reading method, the original data table is directly read into the computer memory, and the actuarial model is calculated and then the specific data is located according to the current dimension value. Even if the nested table reading method has reduced the amount of data read, in the actuarial scenario, the table to be read is still a huge amount of data. For this reason, in this embodiment, for a table with a large amount of data, if the amount of data in the table exceeds the preset data amount threshold, the table is first split into at least two table fragments according to the table dimension. For example, a life table includes an age dimension (0-99 years old) and a gender dimension (male, female), and can be used in three different scenarios: annuity, non-annuity, and mixed table. For the full-scale reading method, the full table of 100 * 2 * 3 will be read into the memory, and for the nested table method, each single table needs to be read into the memory. In this embodiment, when the data volume of a single table exceeds the threshold, the original table will be automatically split into 6 small tables of 100*1 according to the dimension size, corresponding to the male dimension & annuity scenario, female dimension & annuity scenario, male dimension & non-annuity scenario, female dimension & non-annuity scenario, male dimension & mixed table scenario, and female dimension & mixed table scenario. When a variable needs to read a specific value, such as the 35-year-old male annuity table, the program will only read the male annuity table of the male dimension & annuity scenario into memory, and find the 36th value in the memory according to 35 years old (the first value is 0 years old) for fast reading.
[0070] The method for reading tables in the actuarial model provided in this embodiment is adopted, and the table to be read is further split into table fragments according to the dimensions specified by the parameters or scenarios in the data actuarial model. When reading data, the table fragments of the corresponding dimensions are read according to the specific value requirements, so that those parts of the table that do not need to be paid attention to do not need to be read into the memory, thereby reducing the time and memory resources consumed in reading large tables into the memory. At the same time, when querying data, the data unit can be directly found through the parameters of one dimension (such as age), making the reading and query of the data unit faster.
[0071] In summary, in each of the above embodiments, the use of interval expression greatly reduces the number of configuration rows of the data table; by using intervals and nested tables, the table logic can be configured normally, and the logic is clear, simple and easy to understand; by setting the variable type and selecting the data source table in two steps to assign values, no code writing ability is required, and the usage threshold is lowered; the variable-table full-link visual relationship diagram can very clearly help users track the reference relationship between variables and tables in the calculation, and then have a clearer understanding of the process and framework of model calculation, and can also assist in tracking nodes that may have problems when deviations occur in the model calculation results; by fragmenting the table, adding nested table reading and other forms, a large amount of table data is reduced, which can greatly improve data reading efficiency and calculation speed, and reduce the resource requirements for high-speed calculation storage during model calculation; through the inherited table reading design, the value of variables in different dimensions is supported, the definition of the number of variables is reduced, and the use of inheritance greatly reduces the configuration of the same repeated data.
[0072] Embodiment 2 Corresponding to the above-mentioned embodiment 1, embodiment 2 of the present invention provides a device for reading a table in an actuarial model. The corresponding technical feature details and corresponding technical effects can be referred to the above-mentioned embodiment 1, and will not be repeated in this embodiment. Figure 6 A block diagram of a device for reading a table in an actuarial model provided in Embodiment 2 of the present invention, such as Figure 6 As shown, the device includes: a parsing module 201, an acquisition module 202, a determination module 203, a query module 204 and a judgment module 205.
[0073] Among them, the parsing module 201 is used to parse the variables to be used in the calculation process of the actuarial model to obtain the target variable; the acquisition module 202 is used to obtain the calculation parameters that limit the target variable according to the calculation task; the determination module 203 is used to determine the table where the target variable is located as the target table; the query module 204 is used to query in the target table according to the calculation parameters; the judgment module 205 is used to judge whether the currently queried data is a table name or a constant; the query module is also used to continue to query in the table corresponding to the table name when the currently queried data is a table name, and to determine the value of the target variable according to the constant when the currently queried data is a constant.
[0074] Optionally, in one embodiment, the target table includes a data column corresponding to the calculation parameter and a data column corresponding to the target variable, and the query module includes: a first query unit, used to query the data under the data column corresponding to the calculation parameter in the target table to obtain first data; a first judgment unit, used to judge whether the calculation parameter belongs to the data interval when the first data is a data interval expressed in an interval manner; a first determination unit, used to determine that the behavior where the first data is located is a data row that satisfies the calculation parameter when the calculation parameter belongs to the data interval; wherein, when there are multiple calculation parameters that limit the target variable, the data rows that meet all the calculation parameters and the data marked by the data column corresponding to the target variable are determined to be the data corresponding to the target variable.
[0075] Optionally, in one embodiment, the data interval includes a first endpoint value, a second endpoint value less than the first endpoint value, a first symbol indicating whether the first endpoint value is included, and a second symbol indicating whether the second endpoint value is included, wherein the endpoint value includes a first character representing positive infinity and a second character representing negative infinity.
[0076] Optionally, in one embodiment, the determination module includes: a parsing unit, used to parse the configuration information of the target variable, wherein the configuration information of the variable includes a variable type, the variable type includes a table, and when the variable type is a table, the configuration information also includes an associated table of the variable; a determination unit, used to determine that the associated table of the target variable is the target table if the variable type of the target variable parsed is a table.
[0077] Optionally, in one embodiment, the configuration information of the variable also includes a node to which the variable belongs in a preset tree structure, the tree structure includes at least two layers of nodes, and the query unit includes: a second query unit, used to query the target table for data matching the target node, wherein the target node is the node to which the target variable belongs in the tree structure; an acquisition unit, used to acquire the upper nodes of the target node layer by layer from bottom to top when no data matching the target node is found, until data matching a node in the tree structure is found; and a third query unit, used to query the data matching the node for data that meets the calculation parameters.
[0078] Optionally, in one embodiment, the device for reading tables in the actuarial model also includes a construction module, which is used to determine the reference relationship between the variable and the table according to the associated table of the variable, determine the inclusion relationship between the tables according to the table name in the associated table, and construct a relationship diagram between the variable and the table according to the reference relationship and the inclusion relationship.
[0079] Optionally, in one embodiment, the query module includes: a second judgment unit, used to judge whether the data volume of the table to be queried exceeds a preset data volume threshold; a processing unit, used to split the table to be queried into at least two table fragments according to the table dimension when the data volume of the table to be queried exceeds the preset data volume threshold; and a reading unit, used to read the table fragments of the dimension where the query condition is located into the memory for query.
[0080] Embodiment 3 This embodiment also provides a computer device, such as a smart phone, tablet computer, laptop computer, desktop computer, rack server, blade server, tower server or cabinet server (including an independent server or a server cluster composed of multiple servers) that can execute programs. Figure 7 As shown, the computer device 01 of this embodiment includes at least but is not limited to: a memory 012 and a processor 011 which can be interconnected through a system bus. Figure 7 It should be pointed out that Figure 7 Only a computer device 01 having components memory 012 and processor 011 is shown, but it should be understood that it is not required to implement all of the components shown, and more or fewer components may be implemented instead.
[0081] In this embodiment, the memory 012 (i.e., readable storage medium) includes flash memory, hard disk, multimedia card, card-type memory (e.g., SD or DX memory, etc.), random access memory (RAM), static random access memory (SRAM), read-only memory (ROM), electrically erasable programmable read-only memory (EEPROM), programmable read-only memory (PROM), magnetic memory, magnetic disk, optical disk, etc. In some embodiments, the memory 012 may be an internal storage unit of the computer device 01, such as a hard disk or memory of the computer device 01. In other embodiments, the memory 012 may also be an external storage device of the computer device 01, such as a plug-in hard disk, a smart memory card (Smart Media Card, SMC), a secure digital (Secure Digital, SD) card, a flash card, etc. equipped on the computer device 01. Of course, the memory 012 may also include both the internal storage unit of the computer device 01 and its external storage device. In this embodiment, the memory 012 is generally used to store the operating system and various reference software installed on the computer device 01, such as the program code of the table reading device in the actuarial model of the second embodiment. In addition, the memory 012 can also be used to temporarily store various types of data that have been output or are to be output.
[0082] In some embodiments, the processor 011 may be a central processing unit (CPU), a controller, a microcontroller, a microprocessor, or other data processing chips. The processor 011 is generally used to control the overall operation of the computer device 01. In this embodiment, the processor 011 is used to run the program code stored in the memory 012 or process data, such as a method for reading a table in an actuarial model.
[0083] Embodiment 4 This embodiment also provides a computer-readable storage medium, such as a flash memory, a hard disk, a multimedia card, a card-type memory (for example, an SD or DX memory, etc.), a random access memory (RAM), a static random access memory (SRAM), a read-only memory (ROM), an electrically erasable programmable read-only memory (EEPROM), a programmable read-only memory (PROM), a magnetic memory, a disk, an optical disk, a server, an App reference mall, etc., on which a computer program is stored, and the program implements the corresponding function when executed by the processor. The computer-readable storage medium of this embodiment is used to store a device for reading a table in an actuarial model, and when executed by the processor, the method for reading a table in an actuarial model of embodiment 1 is implemented.
[0084] It should be noted that, in this article, the terms "include", "comprises" or any other variations thereof are intended to cover non-exclusive inclusion, so that a process, method, article or device including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, article or device. In the absence of further restrictions, an element defined by the sentence "comprises a ..." does not exclude the existence of other identical elements in the process, method, article or device including the element.
[0085] The serial numbers of the above embodiments of the present invention are only for description and do not represent the advantages or disadvantages of the embodiments.
[0086] Through the description of the above implementation methods, those skilled in the art can clearly understand that the above embodiment methods can be implemented by means of software plus a necessary general hardware platform, and of course by hardware, but in many cases the former is a better implementation method.
[0087] The above are only preferred embodiments of the present invention, and are not intended to limit the patent scope of the present invention. Any equivalent structure or equivalent process transformation made using the contents of the present invention specification and drawings, or directly or indirectly applied in other related technical fields, are also included in the patent protection scope of the present invention.
Claims
1. A method for reading a table in an actuarial model, characterized in that: include: Analyze the variables to be used in the calculation process of the actuarial model to obtain the target variables; Acquire calculation parameters that limit the target variable according to the calculation task; Determine the table where the target variable is located as the target table; querying the target table according to the calculation parameters; Determine whether the currently queried data is a table name or a constant; If the currently queried data is a table name, continue to query in the table corresponding to the table name; if the currently queried data is a constant, determine the value of the target variable according to the constant.
2. The method for reading a table in an actuarial model according to claim 1, characterized in that: The target table includes a data column corresponding to the calculation parameter and a data column corresponding to the target variable, and the step of querying the target table according to the calculation parameter includes: Searching the target table for data in a data column corresponding to the calculation parameter to obtain first data; When the first data is a data interval expressed in an interval manner, determining whether the calculation parameter belongs to the data interval; When the calculation parameter belongs to the data interval, determining a data row where the behavior of the first data satisfies the calculation parameter; When there are multiple calculation parameters for limiting the target variable, the data rows that satisfy all the calculation parameters and the data columns corresponding to the target variable are determined as the data corresponding to the target variable.
3. The method for reading a table in an actuarial model according to claim 2, characterized in that: The data interval includes a first endpoint value, a second endpoint value less than the first endpoint value, a first symbol indicating whether the first endpoint value is included, and a second symbol indicating whether the second endpoint value is included, wherein the endpoint values include a first character representing positive infinity and a second character representing negative infinity.
4. The method for reading a table in an actuarial model according to claim 1, characterized in that: The step of determining the table where the target variable is located as the target table includes: Parsing the configuration information of the target variable, wherein the configuration information of the variable includes a variable type, the variable type includes a table, and when the variable type is a table, the configuration information also includes an associated table of the variable; If it is parsed that the variable type of the target variable is a table, the associated table of the target variable is determined to be the target table.
5. The method for reading a table in an actuarial model according to claim 4, characterized in that: The configuration information of the variable also includes the node to which the variable belongs in a preset tree structure, the tree structure includes at least two layers of nodes, and the step of querying in the target table according to the calculation parameter includes: Searching the target table for data matching a target node, wherein the target node is the node to which the target variable belongs in the tree structure; When no data matching the target node is found, obtaining upper-layer nodes of the target node layer by layer from bottom to top until data matching a node in the tree structure is found; and The data matching the node is searched for data satisfying the calculation parameter.
6. The method for reading a table in an actuarial model according to claim 4, characterized in that: Also includes: Determine the reference relationship between the variable and the table according to the association table of the variable; Determine the inclusion relationship between tables according to the table names in the association table; A relationship diagram between variables and tables is constructed according to the reference relationship and the inclusion relationship.
7. The method for reading a table in an actuarial model according to claim 1, characterized in that: The step of querying the target table according to the calculation parameter and the step of continuing to query the table corresponding to the table name both include the following steps: Determine whether the data volume of the table to be queried exceeds a preset data volume threshold; When the data volume of the table to be queried exceeds the preset data volume threshold, splitting the table to be queried into at least two table fragments according to the table dimension; Read the table fragments of the dimension where the query condition is located into memory for query.
8. A device for reading a table in an actuarial model, characterized in that: include: The parsing module is used to parse the variables to be used in the calculation process of the actuarial model to obtain the target variables; An acquisition module, used for acquiring calculation parameters that define the target variable according to the calculation task; A determination module, used for determining the table where the target variable is located as the target table; A query module, used for querying the target table according to the calculation parameters; The judgment module is used to judge whether the currently queried data is a table name or a constant; The query module is also used to continue querying in a table corresponding to the table name when the currently queried data is a table name, and to determine the value of the target variable according to the constant when the currently queried data is a constant.
9. A computer device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, characterized in that: When the processor executes the computer program, the steps of the method according to any one of claims 1 to 7 are implemented.
10. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the steps of the method according to any one of claims 1 to 7 are implemented.