Index generation method and device, computer equipment and storage medium
By disassembling and vectorizing the indicator description information, querying matching indicator elements using vector databases to generate indicator structures, the problem of lack of business information in indicators is solved, and more accurate and industry-specific indicator generation is achieved.
Patent Information
- Application Number
- CN202411410118.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-10-10
- Publication Date
- 2025-02-14
AI Technical Summary
Currently, the indicators produced by multiple industries lack matching business information, resulting in the indicators not having industry characteristics, the generated indicators are inaccurate or the true meaning of the indicators is unclear.
By obtaining the description information of the indicator to be generated, the feature is disassembled and vectorized, the vector database is used to query matching indicator elements to generate the indicator structure. This method includes steps such as word participle, part-of-speech annotation, semantic similarity calculation and maximum probability determination.
The generated indicators are more accurate, have industry characteristics, and the true meaning of the indicators is clear, which can clearly distinguish the differences between their respective industries.
Smart Images

Figure CN119441316A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the technical field of indicator management, and in particular to an indicator generation method, device, computer equipment and storage medium. Background Art
[0002] An indicator is a quantitative measurement, such as an average, ratio, and percentage. The value of an indicator is always a number rather than text, and is generally implemented through structured query language (SQL). The role of text2Sql is to convert human language expressions into SQL corresponding to the indicator. The development of text2Sql can be traced back to the 1960s. However, due to the limitations of the conditions at that time, it was mainly based on rules and used some fixed methods to convert natural query language into SQL queries, which was not very effective. After entering the era of large models, thanks to the emergence of large pre-trained language models, text2SQL has made significant progress. After pre-training based on sufficient and complex corpora, these models can understand more complex language structures and contexts, and have powerful representation capabilities.
[0003] First, different industries have different types of indicators. For example, e-commerce focuses on the conversion rates of each major stage, while the credit industry may pay more attention to the overdue rate after the money is lent out. Second, the indicators are complex. Some indicators are very complex to express in words, and the real meaning of the same indicator is different in different scenarios.
[0004] The current large model lacks a specific corpus for model fine-tuning and has a short memory. The text description in text2SQL comes from the metadata of the data warehouse table, such as the comments of the table and field. These texts belong to technical metadata and lack business information. Therefore, the indicators currently produced by multiple industries lack matching business information, resulting in the indicators not having industry characteristics, the generated indicators are inaccurate, or the true meaning of the indicators is unclear. Summary of the invention
[0005] Based on this, an indicator generation method, device, computer equipment and storage medium are provided to solve the technical problems that the indicators currently produced by multiple industries lack matching business information, resulting in the indicators not having industry characteristics, the generated indicators are inaccurate or the true meaning of the indicators is unclear.
[0006] In one aspect, a method for generating an indicator is provided, the method comprising:
[0007] Obtaining description information of the indicator to be generated, the description information including statistical business data, statistical time range of the business data, statistical range of the business data, and statistical dimension of the business data;
[0008] Decomposing the description information into business data element fields, business data statistical time range element fields, business data statistical range element fields, and business data statistical dimension element fields, and vectorizing the elements to form atomic indicator elements, statistical period elements, business limitation elements, and statistical dimension elements;
[0009] According to the atomic indicator element, the statistical period element, the business limitation element and the statistical dimension element, searching for matching indicator elements in the vector database and returning them;
[0010] The returned indicator elements are obtained, and an indicator structure is generated according to the indicator elements, wherein the indicator structure is y=f(x), wherein x is the indicator element, and y is the generated indicator name.
[0011] In one embodiment, the decomposing the description information into business data element fields, business data statistical time range element fields, business data statistical range element fields, and business data statistical dimension element fields includes:
[0012] Using a word segmenter in combination with Chinese grammar to split the description information into nouns, adjectives and quantifiers;
[0013] Determine the nouns that belong to the atomic indicator table or the statistical dimension table among the split nouns, select noun one and noun two among the nouns after word segmentation, assume that one of the nouns belongs to the atomic indicator table and the other noun belongs to the statistical dimension table, calculate the semantic similarity using the cosine distance in the atomic indicator table and the statistical dimension table in the vector database, and determine the atomic indicator table and the statistical dimension table to which the nouns after word segmentation belong by taking the overall maximum probability using the formula max[cos(noun one, atomic indicator table)*cos(noun two, statistical dimension table), cos(noun two, atomic indicator table)*cos(noun one, statistical dimension table)], and use the nouns belonging to the atomic indicator table as business data element fields, and use the nouns belonging to the statistical dimension table as business data statistical dimension element fields;
[0014] Using the split adjectives as parameters, finding the words with the highest similarity in the business definition table in the vector database as business data statistical range element fields;
[0015] The split quantifiers are used as the business data statistical time range element fields.
[0016] In one embodiment, searching for matching indicator elements in a vector database and returning the matching indicator elements according to the atomic indicator elements, the statistical period elements, the business definition elements and the statistical dimension elements includes:
[0017] An atomic indicator table, a business definition table, a statistical dimension table and a statistical period table are set in a vector database, wherein the business data noun vector is stored in the atomic indicator table, the business data statistical range noun vector is stored in the business definition table, the business data statistical dimension noun vector is stored in the statistical dimension table, and the statistical period noun vector is stored in the statistical period table;
[0018] Query the business data noun vector group that matches the atomic indicator element in the atomic indicator table, query the business data statistical range noun vector group that matches the business limitation element in the business limitation table, query the business data statistical dimension noun vector group that matches the statistical dimension element in the statistical dimension table, and query the statistical period noun vector group that matches the statistical period element in the statistical period table;
[0019] The semantic similarity of each noun vector in the business data noun vector group, the business data statistical range noun vector group, the business data statistical dimension noun vector group and the statistical period noun vector group is calculated using the cosine distance, and the noun vector with the largest overall cosine distance is taken as the matching index element, and the index element is returned.
[0020] In one embodiment, the using of cosine distance to calculate the semantic similarity of each noun vector in the business data noun vector group, the business data statistical range noun vector group, the business data statistical dimension noun vector group, and the statistical period noun vector group, and taking the noun vector with the largest overall cosine distance as the matching index element includes:
[0021] Assuming that the noun vector in the service data noun vector group is the first noun vector, the semantic similarity of the first noun vector is cos(first noun vector, atomic index table);
[0022] Assuming that the noun vector in the noun vector group of the business data statistical range is the second noun vector, the semantic similarity of the second noun vector is cos(second noun vector, business restriction table);
[0023] Assuming that the noun vector in the business data statistical dimension noun vector group is the third noun vector, the semantic similarity of the third noun vector is cos(third noun vector, statistical dimension table);
[0024] Assuming that the noun vector in the statistical period noun vector group is the fourth noun vector, the semantic similarity of the fourth noun vector is cos(fourth noun vector, statistical periodic table);
[0025] The formula for calculating the noun vector with the largest overall cosine distance is max[cos(first noun vector, atomic index table)*cos(second noun vector, business limitation table)*cos(third noun vector, statistical dimension table)*cos(fourth noun vector, statistical periodic table)], and the noun vector with the largest overall cosine distance in the combination of the first noun vector, the second noun vector, the third noun vector and the fourth noun vector is obtained as the matching index element.
[0026] In one embodiment, the indicator generation method further includes:
[0027] Register the preset indicators in the indicator registry, and perform logical dimension modeling to form a snowflake model, wherein the snowflake model includes fields of the associated fact table and dimension table;
[0028] After vectorizing the fields obtained by structurally splitting the preset indicators, the fields are classified and stored in the vector database according to atomic indicator elements, business limitation elements, statistical dimension elements and statistical period elements;
[0029] Obtain the indicator names registered in the indicator registration table, and aggregate them according to the subject domains to which the indicator names belong to form an indicator index list;
[0030] The semantic model is trained by providing a data set according to the indicator index list. The trained semantic model can decompose the input indicator description information into business data element fields, business data statistical time range element fields, business data statistical range element fields and business data statistical dimension element fields.
[0031] In one embodiment, registering the preset indicator in the indicator registration table and performing logical dimensional modeling to form a snowflake model corresponding to the preset indicator includes:
[0032] Building an indicator registry, wherein the indicator registry includes a fact table and a dimension table;
[0033] Register the preset indicator in the indicator registration table, specify a fact table and a first field associated with the fact table, specify a dimension table and a second field associated with the dimension table, set the association mode between the first field and the second field to be equal to the first field and the second field or equal after being processed by a string function, and form a snowflake model corresponding to the preset indicator.
[0034] In one embodiment, the indicator generation method further includes:
[0035] In response to generating the indicator structure, a data set is provided according to the indicator structure to perform secondary training on the semantic model, and the semantic model is optimized and adjusted.
[0036] In another aspect, an indicator generating device is provided, the device comprising:
[0037] An indicator description information input module is used to obtain description information of the indicator to be generated, wherein the description information includes statistical business data, statistical time range of business data, statistical range of business data, and statistical dimension of business data;
[0038] An indicator element decomposition module is used to decompose the descriptive information into elements, into business data element fields, business data statistical time range element fields, business data statistical range element fields and business data statistical dimension element fields, and to vectorize the elements to form atomic indicator elements, statistical period elements, business limitation elements and statistical dimension elements;
[0039] An indicator element matching query module, used to query and return matching indicator elements in a vector database according to the atomic indicator element, the statistical period element, the business limitation element and the statistical dimension element;
[0040] The indicator structure generation module is used to obtain the returned indicator elements and generate an indicator structure according to the indicator elements. The indicator structure is y=f(x), wherein x is the indicator element and y is the generated indicator name.
[0041] In another aspect, a computer device is provided, 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 following steps are implemented:
[0042] Obtaining description information of the indicator to be generated, the description information including statistical business data, statistical time range of the business data, statistical range of the business data, and statistical dimension of the business data;
[0043] Decomposing the description information into business data element fields, business data statistical time range element fields, business data statistical range element fields, and business data statistical dimension element fields, and vectorizing the elements to form atomic indicator elements, statistical period elements, business limitation elements, and statistical dimension elements;
[0044] According to the atomic indicator element, the statistical period element, the business limitation element and the statistical dimension element, searching for matching indicator elements in the vector database and returning them;
[0045] The returned indicator elements are obtained, and an indicator structure is generated according to the indicator elements, wherein the indicator structure is y=f(x), wherein x is the indicator element, and y is the generated indicator name.
[0046] In another aspect, a computer-readable storage medium is provided, on which a computer program is stored, and when the computer program is executed by a processor, the following steps are implemented:
[0047] Obtaining description information of the indicator to be generated, the description information including statistical business data, statistical time range of the business data, statistical range of the business data, and statistical dimension of the business data;
[0048] Decomposing the description information into business data element fields, business data statistical time range element fields, business data statistical range element fields, and business data statistical dimension element fields, and vectorizing the elements to form atomic indicator elements, statistical period elements, business limitation elements, and statistical dimension elements;
[0049] According to the atomic indicator element, the statistical period element, the business limitation element and the statistical dimension element, searching for matching indicator elements in the vector database and returning them;
[0050] The returned indicator elements are obtained, and an indicator structure is generated according to the indicator elements, wherein the indicator structure is y=f(x), wherein x is the indicator element, and y is the generated indicator name.
[0051] The above-mentioned indicator generation method, device, computer equipment and storage medium obtain statistical business data, statistical time range of business data, statistical range of business data and statistical dimension of business data by identifying the descriptive information of the indicator to be generated, and query matching indicator elements in the vector database from four aspects: atomic indicator elements, statistical period elements, business limitation elements and statistical dimension elements, and generate an indicator structure. Even if the indicator names are the same, but the indicator elements they constitute are different, the differences between the industries to which they belong can be clearly distinguished. The indicator structure has industry characteristics and covers the meanings of the four aspects of elements. The generated indicators are more accurate and the true meaning of the indicator expression is clear. BRIEF DESCRIPTION OF THE DRAWINGS
[0052] In order to more clearly illustrate the technical solutions in the embodiments of the present invention, the drawings required for use in the description of the embodiments will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without creative work.
[0053] Figure 1 This is an application environment diagram of an indicator generation method in one embodiment of the present application;
[0054] Figure 2 This is a flow chart of an indicator generation method in one embodiment of the present application;
[0055] Figure 3 A flowchart showing the steps of decomposing the description information into business data element fields, business data statistical time range element fields, business data statistical range element fields, and business data statistical dimension element fields in one embodiment of the present application;
[0056] Figure 4 A flowchart of a step of searching for matching indicator elements in a vector database and returning the steps according to the atomic indicator elements, the statistical period elements, the business limitation elements and the statistical dimension elements in one embodiment of the present application;
[0057] Figure 5 This is a structural block diagram of an indicator generating device in one embodiment of the present application;
[0058] Figure 6 This is a diagram of the internal structure of a computer device in one embodiment of the present application. DETAILED DESCRIPTION
[0059] In order to make the purpose, technical solution and advantages of the present application more clearly understood, the present application 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 application and are not used to limit the present application.
[0060] The indicator generation method provided in this application can be applied to Figure 1 In the application environment shown. Among them, an indicator platform, a vector database and a semantic model are set. The indicator platform includes a table registration module, an element management module and an indicator management module. The table registration module forms an indicator registration table. The element management module forms atomic indicator elements, statistical period elements, business limitation elements and statistical dimension elements to classify and store four aspects of indicator elements. The indicator management module defines the indicator name and the four aspects of indicator elements that constitute the indicator. The vector database stores the indicator registration table, four aspects of indicator elements and indicator names in the indicator platform. The semantic model obtains the description information of the indicator to be generated, decomposes and vectorizes the description information, queries the matching indicator elements in the vector database, obtains the returned indicator elements, generates an indicator structure according to the indicator elements and returns it.
[0061] The table registration module is used to register tables in the data warehouse and perform logical dimensional modeling.
[0062] On the page, use the search box to find the table you need to register from the data catalog, click Preview to view the table and field information, confirm that it is the table you need, then click Register, and then automatically enter this information on the Add page. Next, confirm the subject domain to which the table belongs, whether it is a fact table or a dimension table, the technical person in charge, the business person in charge, etc.
[0063] On the table association page, specify a fact table and the externally associated fields, then specify a table from the dimension table and the fields associated with the fact table, and determine how the two table fields are associated, such as whether they are directly equal or need to be equal after being processed by string functions, thus forming a snowflake model. The snowflake model is when one or more dimension tables are not directly connected to the fact table, but are connected to the fact table through other dimension tables. Its diagram is like multiple snowflakes connected together, so it is called a snowflake model. The snowflake model is an extension of the star model.
[0064] Among them, the indicator element management module can obtain four elements: atomic indicators, business limitations, statistical dimensions and statistical cycles by structurally splitting indicators.
[0065] Atomic indicator elements: come from the numeric type fields in the fact table, used to count the business status data in business activities. Commonly used statistical functions include sum, count, avg, max, min, etc.
[0066] Business limiting factors: They come from fact tables or dimension tables and are used to limit the statistical scope of the business. For example, to count the purchase amount of men in Shanghai, Shanghai and men are the modifiers that limit the business.
[0067] Statistical dimension elements: They come from fact tables or dimension tables and define the angles from which indicators are viewed, such as by city, by consumption level, etc.
[0068] Statistical period element: It comes from the fact table and is used to clarify the time range of data statistics, such as the last hour, the last day, etc.
[0069] The indicator management module defines the indicators and the four elements that make up the indicators. Click the new indicator page, select an atomic indicator from the atomic indicator list, and then filter out the selectable business limitations and statistical dimensions through the snowflake model obtained when the table is associated, and finally determine the statistical period. Click the preview button to view the SQL for indicator splicing, and the test run button to view the value of the indicator operation. Enter the indicator name, indicator terminology, subject domain to which the indicator belongs, indicator person in charge and other information.
[0070] Among them, the semantic model is mainly used for word segmentation and part-of-speech tagging. An indicator description can be split into nouns, adjectives and quantifiers using a word segmenter combined with Chinese grammar. Atomic indicators and dimensions are nouns, business restrictions are adjectives, and statistical periods are quantifiers.
[0071] Select the StructBERT pre-trained language model. Compared with BERT, this model further improves the representation ability of the pre-trained model. Combined with the new training goals of reconstructing the word order in sentences and judging the relationship between sentences, it better utilizes the internal and external connections of sentences to promote semantic understanding. Perform secondary training on professional data sets. The data sets here are indicator information accumulated by the industry. Manually modify the indicator names, segment the words, and tag the parts of speech to form a data set. Install AdaSeq, the sequence annotation and understanding framework provided by ModelScope. Prepare the training configuration and keep the data set, segmentation parameters, model training parameters and other information in the train.yaml file. Execute the adaseq train-c train.yaml command. After a few hours, the binary model file and related configuration files will be kept in the output folder.
[0072] Among them, the vector database is mainly used to determine the similarity between words. Install the Miluves vector database and create three new tables, corresponding to the atomic indicator table, business limitation table and statistical dimension table respectively. The existing atomic indicators, business limitations and statistical dimensions are embedded into 256-dimensional vectors through chatGPT and written into the corresponding tables respectively. The vector database can also set a statistical periodic table, in which 256-dimensional statistical periodic noun vectors are stored. The 256-dimensional noun vector is a commonly used data representation method in natural language processing (NLP), which maps the concept or meaning of a noun to a 256-dimensional vector space. 256 dimensions means that this vector consists of 256 numerical values, each of which represents the feature strength or weight of the noun in a specific dimension.
[0073] In one embodiment, Figure 2 As shown, a method for generating an indicator is provided, comprising the following steps:
[0074] Step S1, obtaining description information of the indicator to be generated, wherein the description information includes statistical business data, a statistical time range of the business data, a statistical range of the business data, and a statistical dimension of the business data;
[0075] Step S2, decomposing the description information into business data element fields, business data statistical time range element fields, business data statistical range element fields, and business data statistical dimension element fields, and vectorizing the elements to form atomic indicator elements, statistical period elements, business limitation elements, and statistical dimension elements;
[0076] Step S3, according to the atomic indicator element, the statistical period element, the business limitation element and the statistical dimension element, searching for matching indicator elements in the vector database and returning them;
[0077] Step S4, obtaining the returned indicator elements, and generating an indicator structure according to the indicator elements, wherein the indicator structure is y=f(x), wherein x is the indicator element, and y is the generated indicator name.
[0078] Among them, the indicator elements of x are atomic indicator elements, statistical period elements, business-limited elements, and statistical dimension elements that are matched in the vector database. That is, the generated indicator structure has four indicator elements, namely, atomic indicator elements, statistical period elements, business-limited elements, and statistical dimension elements, to express its true meaning. The element fields of the statistical business data, the statistical time range of the business data, the statistical range of the business data, and the statistical dimension of the business data distributed from the four aspects of atomic indicator elements, statistical period elements, business-limited elements, and statistical dimension elements can also clearly distinguish the differences in the industries to which they belong, and the generated indicators are more accurate. f() is the structural connection relationship between the indicator structure and the indicator elements, indicating that the indicator structure corresponding to an indicator name is associated with atomic indicator elements, statistical period elements, business-limited elements, and statistical dimension elements.
[0079] like Figure 3 As shown, in this embodiment, the decomposition of the description information into business data element fields, business data statistical time range element fields, business data statistical range element fields, and business data statistical dimension element fields includes:
[0080] Step S21, using a word segmenter in combination with Chinese grammar to split the description information into nouns, adjectives and quantifiers;
[0081] Step S22, determine which nouns belong to the atomic indicator table or the statistical dimension table among the split nouns, select noun 1 and noun 2 among the nouns after word segmentation, assume that one of the nouns belongs to the atomic indicator table and the other noun belongs to the statistical dimension table, calculate semantic similarity using cosine distance in the atomic indicator table and the statistical dimension table in the vector database, and use the formula max[cos(noun 1, atomic indicator table)*cos(noun 2, statistical dimension table), cos(noun 2, atomic indicator table)*cos(noun 1, statistical dimension table)] to determine the atomic indicator table and statistical dimension table to which the nouns after word segmentation belong by taking the overall maximum probability, and use the nouns belonging to the atomic indicator table as business data element fields, and use the nouns belonging to the statistical dimension table as business data statistical dimension element fields;
[0082] Step S23, using the split adjectives as parameters, finding the words with the highest similarity in the business definition table in the vector database as business data statistical range element fields;
[0083] Step S24, using the split quantifiers as the business data statistical time range element fields.
[0084] When using it, write a text description of the indicator, the semantic model splits the text description into indicator elements, queries the vector database to find similar elements, and finally generates the final indicator SQL.
[0085] Step 1: Enter an indicator description.
[0086] Step 2: Use the description information as an input parameter to call the semantic model interface, use a word segmenter combined with Chinese grammar to split the description information into nouns, adjectives, and quantifiers, and output the word segmentation and part-of-speech tagging results of the indicator description.
[0087] Step 3: Further determine the atomic index and statistical dimension from the noun list after word segmentation. First, assume that one of them is the atomic index and the other is the statistical dimension. Then use the cosine distance to calculate the semantic similarity in the atomic index table and statistical dimension table in the vector database, and take the overall maximum probability. The formula is: max[cos(noun 1, atomic index table)*cos(noun 2, statistical dimension table), cos(noun 2, atomic index table)*cos(noun 1, statistical dimension table)]. In this way, the atomic index and statistical dimension are determined in the noun list by the maximum probability.
[0088] Step 4: The adjectives after word segmentation are used as parameters, and the words with the highest similarity are found from the business limitation table by using vector similarity comparison, thus determining the business limitation of the indicator.
[0089] Step 5: Use the quantifier after word segmentation as the statistical period, and combine the above atomic indicators, statistical dimensions, and business restrictions to generate an indicator. You can preview the final SQL and test run on the page to view the indicator value.
[0090] like Figure 4 As shown, in this embodiment, according to the atomic indicator element, the statistical period element, the business limitation element and the statistical dimension element, searching the vector database for matching indicator elements and returning the elements includes:
[0091] Step S31, setting an atomic indicator table, a business definition table, a statistical dimension table and a statistical period table in a vector database, storing a 256-dimensional business data noun vector in the atomic indicator table, storing a 256-dimensional business data statistical range noun vector in the business definition table, storing a 256-dimensional business data statistical dimension noun vector in the statistical dimension table, and storing a 256-dimensional statistical period noun vector in the statistical period table;
[0092] Step S32, querying the atomic indicator table for a business data noun vector group that matches the atomic indicator element, querying the business data statistical range noun vector group that matches the business limitation element in the business limitation table, querying the business data statistical dimension noun vector group that matches the statistical dimension element in the statistical dimension table, and querying the statistical period noun vector group that matches the statistical period element in the statistical period table;
[0093] Step S33, using cosine distance to calculate the semantic similarity of each noun vector in the business data noun vector group, the business data statistical range noun vector group, the business data statistical dimension noun vector group and the statistical period noun vector group, take the noun vector with the largest overall cosine distance as the matching index element, and return the index element.
[0094] This application uses a vector database to compare semantic similarity and uses the overall maximum probability to determine the final indicator components.
[0095] In this embodiment, the semantic similarity of each noun vector in the business data noun vector group, the business data statistical range noun vector group, the business data statistical dimension noun vector group, and the statistical period noun vector group is calculated by using the cosine distance, and the noun vector with the largest overall cosine distance is taken as the matching indicator element, which includes:
[0096] Assuming that the noun vector in the service data noun vector group is the first noun vector, the semantic similarity of the first noun vector is cos(first noun vector, atomic index table);
[0097] Assuming that the noun vector in the noun vector group of the business data statistical range is the second noun vector, the semantic similarity of the second noun vector is cos(second noun vector, business restriction table);
[0098] Assuming that the noun vector in the business data statistical dimension noun vector group is the third noun vector, the semantic similarity of the third noun vector is cos(third noun vector, statistical dimension table);
[0099] Assuming that the noun vector in the statistical period noun vector group is the fourth noun vector, the semantic similarity of the fourth noun vector is cos(fourth noun vector, statistical periodic table);
[0100] The formula for calculating the noun vector with the largest overall cosine distance is max[cos(first noun vector, atomic index table)*cos(second noun vector, business limitation table)*cos(third noun vector, statistical dimension table)*cos(fourth noun vector, statistical periodic table)], and the noun vector with the largest overall cosine distance in the combination of the first noun vector, the second noun vector, the third noun vector and the fourth noun vector is obtained as the matching index element.
[0101] See also Figure 1 In this embodiment, corresponding to the interaction between the indicator platform and the semantic model, the indicator generation method further includes:
[0102] Register the preset indicators in the indicator registry, and perform logical dimension modeling to form a snowflake model, wherein the snowflake model includes fields of the associated fact table and dimension table;
[0103] After vectorizing the fields obtained by structurally splitting the preset indicators, the fields are classified and stored in the vector database according to atomic indicator elements, business limitation elements, statistical dimension elements and statistical period elements;
[0104] Obtain the indicator names registered in the indicator registration table, and aggregate them according to the subject domains to which the indicator names belong to form an indicator index list;
[0105] The semantic model is trained by providing a data set according to the indicator index list. The trained semantic model can decompose the input indicator description information into business data element fields, business data statistical time range element fields, business data statistical range element fields and business data statistical dimension element fields.
[0106] In this embodiment, registering the preset indicator in the indicator registration table and performing logical dimensional modeling to form a snowflake model corresponding to the preset indicator includes:
[0107] Building an indicator registry, wherein the indicator registry includes a fact table and a dimension table;
[0108] Register the preset indicator in the indicator registration table, specify a fact table and a first field associated with the fact table, specify a dimension table and a second field associated with the dimension table, set the association mode between the first field and the second field to be equal to the first field and the second field or equal after being processed by a string function, and form a snowflake model corresponding to the preset indicator.
[0109] See also Figure 1 In this embodiment, the indicator generation method further includes:
[0110] In response to generating the indicator structure, a data set is provided according to the indicator structure to perform secondary training on the semantic model, and the semantic model is optimized and adjusted.
[0111] In the above indicator generation method, by identifying the descriptive information of the indicator to be generated, the statistical business data, the statistical time range of the business data, the statistical range of the business data and the statistical dimension of the business data are obtained, and the matching indicator elements are queried in the vector database from four aspects: atomic indicator elements, statistical period elements, business limitation elements and statistical dimension elements. An indicator structure is generated. Even if the indicator names are the same, but the indicator elements they constitute are different, the differences between the industries to which they belong can be clearly distinguished. The indicator structure has industry characteristics and covers the meanings of the four aspects. The generated indicators are more accurate and the true meaning of the indicator expression is clear.
[0112] This application introduces a semantic model implementation mechanism for the decomposition of indicator table elements, combining NLP technology and Chinese grammar rules for word segmentation and part-of-speech tagging. Compared with traditional text2sql, the indicator platform can decompose and define indicators from a higher perspective, while providing richer business meta-information, and structured elements are more conducive to semantic model training.
[0113] This application introduces semantic models, NLP technology and Chinese grammar rules for word segmentation and part-of-speech tagging, combines semantic similarity comparison and maximum probability in the vector database to determine the four aspects of the indicator, and finally generates the indicator.
[0114] It should be understood that although Figure 2-Figure 4 The steps in the flowchart are shown in sequence as indicated by the arrows, but these steps are not necessarily executed in the order indicated by the arrows. Unless otherwise specified in this document, there is no strict order restriction for the execution of these steps, and these steps can be executed in other orders. Moreover, Figure 2-Figure 4 At least part of the steps may include multiple sub-steps or multiple stages. These sub-steps or stages are not necessarily executed at the same time, but can be executed at different times. The execution order of these sub-steps or stages is not necessarily sequential, but can be executed in turn or alternately with other steps or at least part of the sub-steps or stages of other steps.
[0115] In one embodiment, Figure 5 As shown, an indicator generating device 10 is provided, comprising: an indicator description information input module 1, an indicator element decomposition module 2, an indicator element matching query module 3, and an indicator structure generation module 4.
[0116] The indicator description information input module 1 is used to obtain description information of the indicator to be generated, and the description information includes statistical business data, statistical time range of business data, statistical range of business data and statistical dimension of business data.
[0117] The indicator element decomposition module 2 is used to decompose the descriptive information into elements, namely, business data element fields, business data statistical time range element fields, business data statistical range element fields and business data statistical dimension element fields, and vectorize the information to form atomic indicator elements, statistical period elements, business limitation elements and statistical dimension elements.
[0118] The indicator element matching query module 3 is used to query and return matching indicator elements in the vector database according to the atomic indicator elements, the statistical period elements, the business limitation elements and the statistical dimension elements.
[0119] The indicator structure generating module 4 is used to obtain the returned indicator elements and generate an indicator structure according to the indicator elements. The indicator structure is y=f(x), wherein x is the indicator element and y is the generated indicator name.
[0120] In this embodiment, the decomposition of the description information into business data element fields, business data statistical time range element fields, business data statistical range element fields, and business data statistical dimension element fields includes:
[0121] Using a word segmenter in combination with Chinese grammar to split the description information into nouns, adjectives and quantifiers;
[0122] Determine the nouns that belong to the atomic indicator table or the statistical dimension table among the split nouns, select noun one and noun two among the nouns after word segmentation, assume that one of the nouns belongs to the atomic indicator table and the other noun belongs to the statistical dimension table, calculate the semantic similarity using the cosine distance in the atomic indicator table and the statistical dimension table in the vector database, and determine the atomic indicator table and the statistical dimension table to which the nouns after word segmentation belong by taking the overall maximum probability using the formula max[cos(noun one, atomic indicator table)*cos(noun two, statistical dimension table), cos(noun two, atomic indicator table)*cos(noun one, statistical dimension table)], and use the nouns belonging to the atomic indicator table as business data element fields, and use the nouns belonging to the statistical dimension table as business data statistical dimension element fields;
[0123] Using the split adjectives as parameters, finding the words with the highest similarity in the business definition table in the vector database as business data statistical range element fields;
[0124] The split quantifiers are used as the business data statistical time range element fields.
[0125] In this embodiment, according to the atomic indicator element, the statistical period element, the business limitation element and the statistical dimension element, searching for matching indicator elements in the vector database and returning the elements includes:
[0126] An atomic indicator table, a business definition table, a statistical dimension table and a statistical period table are set in the vector database, wherein the business data noun vectors of 256 dimensions are stored in the atomic indicator table, the business data statistical range noun vectors of 256 dimensions are stored in the business definition table, the business data statistical dimension noun vectors of 256 dimensions are stored in the statistical dimension table, and the statistical period noun vectors of 256 dimensions are stored in the statistical period table;
[0127] Query the business data noun vector group that matches the atomic indicator element in the atomic indicator table, query the business data statistical range noun vector group that matches the business limitation element in the business limitation table, query the business data statistical dimension noun vector group that matches the statistical dimension element in the statistical dimension table, and query the statistical period noun vector group that matches the statistical period element in the statistical period table;
[0128] The semantic similarity of each noun vector in the business data noun vector group, the business data statistical range noun vector group, the business data statistical dimension noun vector group and the statistical period noun vector group is calculated using the cosine distance, and the noun vector with the largest overall cosine distance is taken as the matching index element, and the index element is returned.
[0129] In this embodiment, the semantic similarity of each noun vector in the business data noun vector group, the business data statistical range noun vector group, the business data statistical dimension noun vector group, and the statistical period noun vector group is calculated by using the cosine distance, and the noun vector with the largest overall cosine distance is taken as the matching indicator element, which includes:
[0130] Assuming that the noun vector in the service data noun vector group is the first noun vector, the semantic similarity of the first noun vector is cos(first noun vector, atomic index table);
[0131] Assuming that the noun vector in the noun vector group of the business data statistical range is the second noun vector, the semantic similarity of the second noun vector is cos(second noun vector, business restriction table);
[0132] Assuming that the noun vector in the business data statistical dimension noun vector group is the third noun vector, the semantic similarity of the third noun vector is cos(third noun vector, statistical dimension table);
[0133] Assuming that the noun vector in the statistical period noun vector group is the fourth noun vector, the semantic similarity of the fourth noun vector is cos(fourth noun vector, statistical periodic table);
[0134] The formula for calculating the noun vector with the largest overall cosine distance is max[cos(first noun vector, atomic index table)*cos(second noun vector, business limitation table)*cos(third noun vector, statistical dimension table)*cos(fourth noun vector, statistical periodic table)], and the noun vector with the largest overall cosine distance in the combination of the first noun vector, the second noun vector, the third noun vector and the fourth noun vector is obtained as the matching index element.
[0135] In this embodiment, if Figure 5 As shown, the indicator generation device 10 further includes: an indicator platform management module 5 and a model training module 6. The indicator platform management module 5 includes a table registration module, an element management module and an indicator management module.
[0136] The table registration module is used to register the preset indicators in the indicator registration table, and perform logical dimensional modeling to form a snowflake model, wherein the snowflake model contains fields of the associated fact table and dimension table; the element management module is used to vectorize the fields obtained by structurally splitting the preset indicators, and classify and store them in the vector database according to atomic indicator elements, business-limited elements, statistical dimension elements and statistical period elements; the indicator management module is used to obtain the indicator names registered in the indicator registration table, and summarize them according to the subject domain to which the indicator names belong to form an indicator index list.
[0137] The model training module 6 is used to train the semantic model based on the data set provided by the indicator index list. The trained semantic model can decompose the input indicator description information into business data element fields, business data statistical time range element fields, business data statistical range element fields and business data statistical dimension element fields.
[0138] In this embodiment, registering the preset indicator in the indicator registration table and performing logical dimensional modeling to form a snowflake model corresponding to the preset indicator includes:
[0139] Building an indicator registry, wherein the indicator registry includes a fact table and a dimension table;
[0140] Register the preset indicator in the indicator registration table, specify a fact table and a first field associated with the fact table, specify a dimension table and a second field associated with the dimension table, set the association mode between the first field and the second field to be equal to the first field and the second field or equal after being processed by a string function, and form a snowflake model corresponding to the preset indicator.
[0141] In this embodiment, the model training module 6 is further used for: in response to generating an indicator structure, providing a data set according to the indicator structure to perform secondary training on the semantic model, and optimizing and adjusting the semantic model.
[0142] In the above-mentioned indicator generation device, by identifying the descriptive information of the indicator to be generated, the statistical business data, the statistical time range of the business data, the statistical range of the business data and the statistical dimension of the business data are obtained, and the matching indicator elements are queried in the vector database from four aspects: atomic indicator elements, statistical period elements, business limitation elements and statistical dimension elements. An indicator structure is generated. Even if the indicator names are the same, but the indicator elements they constitute are different, the differences between the industries to which they belong can be clearly distinguished. The indicator structure has industry characteristics and covers the meanings of the four aspects of elements. The generated indicators are more accurate and the true meaning of the indicator expression is clear.
[0143] For the specific definition of the index generation device, please refer to the definition of the index generation method above, which will not be repeated here. Each module in the above-mentioned index generation device can be implemented in whole or in part by software, hardware and a combination thereof. The above-mentioned modules can be embedded in or independent of the processor in the computer device in the form of hardware, or can be stored in the memory in the computer device in the form of software, so that the processor can call and execute the operations corresponding to the above modules.
[0144] In one embodiment, a computer program product is provided, comprising a computer program, which, when executed by a processor, implements the following steps:
[0145] Obtaining description information of the indicator to be generated, the description information including statistical business data, statistical time range of the business data, statistical range of the business data, and statistical dimension of the business data;
[0146] Decomposing the description information into business data element fields, business data statistical time range element fields, business data statistical range element fields, and business data statistical dimension element fields, and vectorizing the elements to form atomic indicator elements, statistical period elements, business limitation elements, and statistical dimension elements;
[0147] According to the atomic indicator element, the statistical period element, the business limitation element and the statistical dimension element, searching for matching indicator elements in the vector database and returning them;
[0148] The returned indicator elements are obtained, and an indicator structure is generated according to the indicator elements, wherein the indicator structure is y=f(x), wherein x is the indicator element, and y is the generated indicator name.
[0149] In one embodiment, the computer program further implements the following steps when executed by a processor:
[0150] The decomposition of the description information into business data element fields, business data statistical time range element fields, business data statistical range element fields and business data statistical dimension element fields includes:
[0151] Using a word segmenter in combination with Chinese grammar to split the description information into nouns, adjectives and quantifiers;
[0152] Determine the nouns that belong to the atomic indicator table or the statistical dimension table among the split nouns, select noun one and noun two among the nouns after word segmentation, assume that one of the nouns belongs to the atomic indicator table and the other noun belongs to the statistical dimension table, calculate the semantic similarity using the cosine distance in the atomic indicator table and the statistical dimension table in the vector database, and determine the atomic indicator table and the statistical dimension table to which the nouns after word segmentation belong by taking the overall maximum probability using the formula max[cos(noun one, atomic indicator table)*cos(noun two, statistical dimension table), cos(noun two, atomic indicator table)*cos(noun one, statistical dimension table)], and use the nouns belonging to the atomic indicator table as business data element fields, and use the nouns belonging to the statistical dimension table as business data statistical dimension element fields;
[0153] Using the split adjectives as parameters, finding the words with the highest similarity in the business definition table in the vector database as business data statistical range element fields;
[0154] The split quantifiers are used as the business data statistical time range element fields.
[0155] In one embodiment, when the computer program is executed by a processor, the following steps are also implemented:
[0156] The searching for matching indicator elements in a vector database and returning the matching indicator elements according to the atomic indicator elements, the statistical period elements, the business definition elements and the statistical dimension elements includes:
[0157] An atomic indicator table, a business definition table, a statistical dimension table and a statistical period table are set in the vector database, wherein the business data noun vectors of 256 dimensions are stored in the atomic indicator table, the business data statistical range noun vectors of 256 dimensions are stored in the business definition table, the business data statistical dimension noun vectors of 256 dimensions are stored in the statistical dimension table, and the statistical period noun vectors of 256 dimensions are stored in the statistical period table;
[0158] Query the business data noun vector group that matches the atomic indicator element in the atomic indicator table, query the business data statistical range noun vector group that matches the business limitation element in the business limitation table, query the business data statistical dimension noun vector group that matches the statistical dimension element in the statistical dimension table, and query the statistical period noun vector group that matches the statistical period element in the statistical period table;
[0159] The semantic similarity of each noun vector in the business data noun vector group, the business data statistical range noun vector group, the business data statistical dimension noun vector group and the statistical period noun vector group is calculated using the cosine distance, and the noun vector with the largest overall cosine distance is taken as the matching index element, and the index element is returned.
[0160] In one embodiment, when the computer program is executed by a processor, the following steps are also implemented:
[0161] The method of calculating the semantic similarity of each noun vector in the business data noun vector group, the business data statistical range noun vector group, the business data statistical dimension noun vector group and the statistical period noun vector group by using the cosine distance, and taking the noun vector with the largest overall cosine distance as the matching indicator element includes:
[0162] Assuming that the noun vector in the service data noun vector group is the first noun vector, the semantic similarity of the first noun vector is cos(first noun vector, atomic index table);
[0163] Assuming that the noun vector in the noun vector group of the business data statistical range is the second noun vector, the semantic similarity of the second noun vector is cos(second noun vector, business restriction table);
[0164] Assuming that the noun vector in the business data statistical dimension noun vector group is the third noun vector, the semantic similarity of the third noun vector is cos(third noun vector, statistical dimension table);
[0165] Assuming that the noun vector in the statistical period noun vector group is the fourth noun vector, the semantic similarity of the fourth noun vector is cos(fourth noun vector, statistical periodic table);
[0166] The formula for calculating the noun vector with the largest overall cosine distance is max[cos(first noun vector, atomic index table)*cos(second noun vector, business limitation table)*cos(third noun vector, statistical dimension table)*cos(fourth noun vector, statistical periodic table)], and the noun vector with the largest overall cosine distance in the combination of the first noun vector, the second noun vector, the third noun vector and the fourth noun vector is obtained as the matching index element.
[0167] In one embodiment, when the computer program is executed by a processor, the following steps are also implemented:
[0168] Register the preset indicators in the indicator registry, and perform logical dimension modeling to form a snowflake model, wherein the snowflake model includes fields of the associated fact table and dimension table;
[0169] After vectorizing the fields obtained by structurally splitting the preset indicators, the fields are classified and stored in the vector database according to atomic indicator elements, business limitation elements, statistical dimension elements and statistical period elements;
[0170] Obtain the indicator names registered in the indicator registration table, and aggregate them according to the subject domains to which the indicator names belong to form an indicator index list;
[0171] The semantic model is trained by providing a data set according to the indicator index list. The trained semantic model can decompose the input indicator description information into business data element fields, business data statistical time range element fields, business data statistical range element fields and business data statistical dimension element fields.
[0172] In one embodiment, when the computer program is executed by a processor, the following steps are also implemented:
[0173] The step of registering the preset indicator in the indicator registration table and performing logical dimension modeling to form a snowflake model corresponding to the preset indicator includes:
[0174] Building an indicator registry, wherein the indicator registry includes a fact table and a dimension table;
[0175] Register the preset indicator in the indicator registration table, specify a fact table and a first field associated with the fact table, specify a dimension table and a second field associated with the dimension table, set the association mode between the first field and the second field to be equal to the first field and the second field or equal after being processed by a string function, and form a snowflake model corresponding to the preset indicator.
[0176] In one embodiment, when the computer program is executed by a processor, the following steps are also implemented:
[0177] In response to generating the indicator structure, a data set is provided according to the indicator structure to perform secondary training on the semantic model, and the semantic model is optimized and adjusted.
[0178] For the specific limitations on the steps implemented when the computer program is executed by the processor, please refer to the limitations on the indicator generation method above, which will not be repeated here.
[0179] In one embodiment, a computer device is provided. The computer device may be a server, and its internal structure diagram may be as follows: Figure 6 As shown. The computer device includes a processor, a memory, a network interface and a database connected through a system bus. Among them, the processor of the computer device is used to provide computing and control capabilities. The memory of the computer device includes a non-volatile storage medium and an internal memory. The non-volatile storage medium stores an operating system, a computer program and a database. The internal memory provides an environment for the operation of the operating system and the computer program in the non-volatile storage medium. The database of the computer device is used to store indicator generation data. The network interface of the computer device is used to communicate with an external terminal through a network connection. When the computer program is executed by the processor, an indicator generation method is implemented.
[0180] Those skilled in the art will understand that Figure 6 The structure shown in the figure is only a block diagram of a part of the structure related to the solution of the present application, and does not constitute a limitation on the computer device to which the solution of the present application is applied. The specific computer device may include more or fewer components than those shown in the figure, or combine certain components, or have a different arrangement of components.
[0181] In one embodiment, a computer device is provided, including a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor implements the following steps when executing the computer program:
[0182] Obtaining description information of the indicator to be generated, the description information including statistical business data, statistical time range of the business data, statistical range of the business data, and statistical dimension of the business data;
[0183] Decomposing the description information into business data element fields, business data statistical time range element fields, business data statistical range element fields, and business data statistical dimension element fields, and vectorizing the elements to form atomic indicator elements, statistical period elements, business limitation elements, and statistical dimension elements;
[0184] According to the atomic indicator element, the statistical period element, the business limitation element and the statistical dimension element, searching for matching indicator elements in the vector database and returning them;
[0185] The returned indicator elements are obtained, and an indicator structure is generated according to the indicator elements, wherein the indicator structure is y=f(x), wherein x is the indicator element, and y is the generated indicator name.
[0186] In one embodiment, when the processor executes the computer program, the processor further implements the following steps:
[0187] The decomposition of the description information into business data element fields, business data statistical time range element fields, business data statistical range element fields and business data statistical dimension element fields includes:
[0188] Using a word segmenter in combination with Chinese grammar to split the description information into nouns, adjectives and quantifiers;
[0189] Determine the nouns that belong to the atomic indicator table or the statistical dimension table among the split nouns, select noun one and noun two among the nouns after word segmentation, assume that one of the nouns belongs to the atomic indicator table and the other noun belongs to the statistical dimension table, calculate the semantic similarity using the cosine distance in the atomic indicator table and the statistical dimension table in the vector database, and determine the atomic indicator table and the statistical dimension table to which the nouns after word segmentation belong by taking the overall maximum probability using the formula max[cos(noun one, atomic indicator table)*cos(noun two, statistical dimension table), cos(noun two, atomic indicator table)*cos(noun one, statistical dimension table)], and use the nouns belonging to the atomic indicator table as business data element fields, and use the nouns belonging to the statistical dimension table as business data statistical dimension element fields;
[0190] Using the split adjectives as parameters, finding the words with the highest similarity in the business definition table in the vector database as business data statistical range element fields;
[0191] The split quantifiers are used as the business data statistical time range element fields.
[0192] In one embodiment, when the processor executes the computer program, the processor further implements the following steps:
[0193] The searching for matching indicator elements in a vector database and returning the matching indicator elements according to the atomic indicator elements, the statistical period elements, the business definition elements and the statistical dimension elements includes:
[0194] An atomic indicator table, a business definition table, a statistical dimension table and a statistical period table are set in the vector database, wherein the business data noun vectors of 256 dimensions are stored in the atomic indicator table, the business data statistical range noun vectors of 256 dimensions are stored in the business definition table, the business data statistical dimension noun vectors of 256 dimensions are stored in the statistical dimension table, and the statistical period noun vectors of 256 dimensions are stored in the statistical period table;
[0195] Query the business data noun vector group that matches the atomic indicator element in the atomic indicator table, query the business data statistical range noun vector group that matches the business limitation element in the business limitation table, query the business data statistical dimension noun vector group that matches the statistical dimension element in the statistical dimension table, and query the statistical period noun vector group that matches the statistical period element in the statistical period table;
[0196] The semantic similarity of each noun vector in the business data noun vector group, the business data statistical range noun vector group, the business data statistical dimension noun vector group and the statistical period noun vector group is calculated using the cosine distance, and the noun vector with the largest overall cosine distance is taken as the matching index element, and the index element is returned.
[0197] In one embodiment, when the processor executes the computer program, the processor further implements the following steps:
[0198] The method of calculating the semantic similarity of each noun vector in the business data noun vector group, the business data statistical range noun vector group, the business data statistical dimension noun vector group and the statistical period noun vector group by using the cosine distance, and taking the noun vector with the largest overall cosine distance as the matching indicator element includes:
[0199] Assuming that the noun vector in the service data noun vector group is the first noun vector, the semantic similarity of the first noun vector is cos(first noun vector, atomic index table);
[0200] Assuming that the noun vector in the noun vector group of the business data statistical range is the second noun vector, the semantic similarity of the second noun vector is cos(second noun vector, business restriction table);
[0201] Assuming that the noun vector in the business data statistical dimension noun vector group is the third noun vector, the semantic similarity of the third noun vector is cos(third noun vector, statistical dimension table);
[0202] Assuming that the noun vector in the statistical period noun vector group is the fourth noun vector, the semantic similarity of the fourth noun vector is cos(fourth noun vector, statistical periodic table);
[0203] The formula for calculating the noun vector with the largest overall cosine distance is max[cos(first noun vector, atomic index table)*cos(second noun vector, business limitation table)*cos(third noun vector, statistical dimension table)*cos(fourth noun vector, statistical periodic table)], and the noun vector with the largest overall cosine distance in the combination of the first noun vector, the second noun vector, the third noun vector and the fourth noun vector is obtained as the matching index element.
[0204] In one embodiment, when the processor executes the computer program, the processor further implements the following steps:
[0205] Register the preset indicators in the indicator registry, and perform logical dimension modeling to form a snowflake model, wherein the snowflake model includes fields of the associated fact table and dimension table;
[0206] After vectorizing the fields obtained by structurally splitting the preset indicators, the fields are classified and stored in the vector database according to atomic indicator elements, business limitation elements, statistical dimension elements and statistical period elements;
[0207] Obtain the indicator names registered in the indicator registration table, and aggregate them according to the subject domains to which the indicator names belong to form an indicator index list;
[0208] The semantic model is trained by providing a data set according to the indicator index list. The trained semantic model can decompose the input indicator description information into business data element fields, business data statistical time range element fields, business data statistical range element fields and business data statistical dimension element fields.
[0209] In one embodiment, when the processor executes the computer program, the processor further implements the following steps:
[0210] The step of registering the preset indicator in the indicator registration table and performing logical dimension modeling to form a snowflake model corresponding to the preset indicator includes:
[0211] Building an indicator registry, wherein the indicator registry includes a fact table and a dimension table;
[0212] Register the preset indicator in the indicator registration table, specify a fact table and a first field associated with the fact table, specify a dimension table and a second field associated with the dimension table, set the association mode between the first field and the second field to be equal to the first field and the second field or equal after being processed by a string function, and form a snowflake model corresponding to the preset indicator.
[0213] In one embodiment, when the processor executes the computer program, the processor further implements the following steps:
[0214] In response to generating the indicator structure, a data set is provided according to the indicator structure to perform secondary training on the semantic model, and the semantic model is optimized and adjusted.
[0215] For the specific limitations on the steps implemented when the processor executes the computer program, please refer to the limitations on the indicator generation method mentioned above, which will not be repeated here.
[0216] In one embodiment, a computer-readable storage medium is provided, on which a computer program is stored, and when the computer program is executed by a processor, the following steps are implemented:
[0217] Obtaining description information of the indicator to be generated, the description information including statistical business data, statistical time range of the business data, statistical range of the business data, and statistical dimension of the business data;
[0218] Decomposing the description information into business data element fields, business data statistical time range element fields, business data statistical range element fields, and business data statistical dimension element fields, and vectorizing the elements to form atomic indicator elements, statistical period elements, business limitation elements, and statistical dimension elements;
[0219] According to the atomic indicator element, the statistical period element, the business limitation element and the statistical dimension element, searching for matching indicator elements in the vector database and returning them;
[0220] The returned indicator elements are obtained, and an indicator structure is generated according to the indicator elements, wherein the indicator structure is y=f(x), wherein x is the indicator element, and y is the generated indicator name.
[0221] In one embodiment, when the computer program is executed by a processor, the following steps are also implemented:
[0222] The decomposition of the description information into business data element fields, business data statistical time range element fields, business data statistical range element fields and business data statistical dimension element fields includes:
[0223] Using a word segmenter in combination with Chinese grammar to split the description information into nouns, adjectives and quantifiers;
[0224] Determine the nouns that belong to the atomic indicator table or the statistical dimension table among the split nouns, select noun one and noun two among the nouns after word segmentation, assume that one of the nouns belongs to the atomic indicator table and the other noun belongs to the statistical dimension table, calculate the semantic similarity using the cosine distance in the atomic indicator table and the statistical dimension table in the vector database, and determine the atomic indicator table and the statistical dimension table to which the nouns after word segmentation belong by taking the overall maximum probability using the formula max[cos(noun one, atomic indicator table)*cos(noun two, statistical dimension table), cos(noun two, atomic indicator table)*cos(noun one, statistical dimension table)], and use the nouns belonging to the atomic indicator table as business data element fields, and use the nouns belonging to the statistical dimension table as business data statistical dimension element fields;
[0225] Using the split adjectives as parameters, finding the words with the highest similarity in the business definition table in the vector database as business data statistical range element fields;
[0226] The split quantifiers are used as the business data statistical time range element fields.
[0227] In one embodiment, when the computer program is executed by a processor, the following steps are also implemented:
[0228] The searching for matching indicator elements in a vector database and returning the matching indicator elements according to the atomic indicator elements, the statistical period elements, the business definition elements and the statistical dimension elements includes:
[0229] An atomic indicator table, a business definition table, a statistical dimension table and a statistical period table are set in the vector database, wherein the business data noun vectors of 256 dimensions are stored in the atomic indicator table, the business data statistical range noun vectors of 256 dimensions are stored in the business definition table, the business data statistical dimension noun vectors of 256 dimensions are stored in the statistical dimension table, and the statistical period noun vectors of 256 dimensions are stored in the statistical period table;
[0230] Query the business data noun vector group that matches the atomic indicator element in the atomic indicator table, query the business data statistical range noun vector group that matches the business limitation element in the business limitation table, query the business data statistical dimension noun vector group that matches the statistical dimension element in the statistical dimension table, and query the statistical period noun vector group that matches the statistical period element in the statistical period table;
[0231] The semantic similarity of each noun vector in the business data noun vector group, the business data statistical range noun vector group, the business data statistical dimension noun vector group and the statistical period noun vector group is calculated using the cosine distance, and the noun vector with the largest overall cosine distance is taken as the matching index element, and the index element is returned.
[0232] In one embodiment, when the computer program is executed by a processor, the following steps are also implemented:
[0233] The method of calculating the semantic similarity of each noun vector in the business data noun vector group, the business data statistical range noun vector group, the business data statistical dimension noun vector group and the statistical period noun vector group by using the cosine distance, and taking the noun vector with the largest overall cosine distance as the matching indicator element includes:
[0234] Assuming that the noun vector in the service data noun vector group is the first noun vector, the semantic similarity of the first noun vector is cos(first noun vector, atomic index table);
[0235] Assuming that the noun vector in the noun vector group of the business data statistical range is the second noun vector, the semantic similarity of the second noun vector is cos(second noun vector, business restriction table);
[0236] Assuming that the noun vector in the business data statistical dimension noun vector group is the third noun vector, the semantic similarity of the third noun vector is cos(third noun vector, statistical dimension table);
[0237] Assuming that the noun vector in the statistical period noun vector group is the fourth noun vector, the semantic similarity of the fourth noun vector is cos(fourth noun vector, statistical periodic table);
[0238] The formula for calculating the noun vector with the largest overall cosine distance is max[cos(first noun vector, atomic index table)*cos(second noun vector, business limitation table)*cos(third noun vector, statistical dimension table)*cos(fourth noun vector, statistical periodic table)], and the noun vector with the largest overall cosine distance in the combination of the first noun vector, the second noun vector, the third noun vector and the fourth noun vector is obtained as the matching index element.
[0239] In one embodiment, when the computer program is executed by a processor, the following steps are also implemented:
[0240] Register the preset indicators in the indicator registry, and perform logical dimension modeling to form a snowflake model, wherein the snowflake model includes fields of the associated fact table and dimension table;
[0241] After vectorizing the fields obtained by structurally splitting the preset indicators, the fields are classified and stored in the vector database according to atomic indicator elements, business limitation elements, statistical dimension elements and statistical period elements;
[0242] Obtain the indicator names registered in the indicator registration table, and aggregate them according to the subject domains to which the indicator names belong to form an indicator index list;
[0243] The semantic model is trained by providing a data set according to the indicator index list. The trained semantic model can decompose the input indicator description information into business data element fields, business data statistical time range element fields, business data statistical range element fields and business data statistical dimension element fields.
[0244] In one embodiment, when the computer program is executed by a processor, the following steps are also implemented:
[0245] The step of registering the preset indicator in the indicator registration table and performing logical dimension modeling to form a snowflake model corresponding to the preset indicator includes:
[0246] Building an indicator registry, wherein the indicator registry includes a fact table and a dimension table;
[0247] Register the preset indicator in the indicator registration table, specify a fact table and a first field associated with the fact table, specify a dimension table and a second field associated with the dimension table, set the association mode between the first field and the second field to be equal to the first field and the second field or equal after being processed by a string function, and form a snowflake model corresponding to the preset indicator.
[0248] In one embodiment, when the computer program is executed by a processor, the following steps are also implemented:
[0249] In response to generating the indicator structure, a data set is provided according to the indicator structure to perform secondary training on the semantic model, and the semantic model is optimized and adjusted.
[0250] For the specific limitations on the steps implemented when the computer program is executed by the processor, please refer to the limitations on the indicator generation method above, which will not be repeated here.
[0251] Those skilled in the art can understand that all or part of the processes in the above-mentioned embodiment methods can be completed by instructing the relevant hardware through a computer program, and the computer program can be stored in a non-volatile computer-readable storage medium. When the computer program is executed, it can include the processes of the embodiments of the above-mentioned methods. Among them, any reference to memory, storage, database or other media used in the embodiments provided in this application can include non-volatile and / or volatile memory. Non-volatile memory can include read-only memory (ROM), programmable ROM (PROM), electrically programmable ROM (EPROM), electrically erasable programmable ROM (EEPROM) or flash memory. Volatile memory can include random access memory (RAM) or external cache memory. As an illustration and not limitation, RAM is available in many forms, such as static RAM (SRAM), dynamic RAM (DRAM), synchronous DRAM (SDRAM), double data rate SDRAM (DDRSDRAM), enhanced SDRAM (ESDRAM), synchronous link (Synchlink) DRAM (SLDRAM), memory bus (Rambus) direct RAM (RDRAM), direct memory bus dynamic RAM (DRDRAM), and memory bus dynamic RAM (RDRAM).
[0252] The technical features of the above embodiments may be arbitrarily combined. To make the description concise, not all possible combinations of the technical features in the above embodiments are described. However, as long as there is no contradiction in the combination of these technical features, they should be considered to be within the scope of this specification.
[0253] The above-mentioned embodiments only express several implementation methods of the present application, and the descriptions thereof are relatively specific and detailed, but they cannot be understood as limiting the scope of the invention patent. It should be pointed out that, for a person of ordinary skill in the art, several variations and improvements can be made without departing from the concept of the present application, and these all belong to the protection scope of the present application. Therefore, the protection scope of the patent of the present application shall be subject to the attached claims.
Claims
1. A method for generating an indicator, characterized in that: include: Obtaining description information of the indicator to be generated, the description information including statistical business data, statistical time range of the business data, statistical range of the business data, and statistical dimension of the business data; Decomposing the description information into business data element fields, business data statistical time range element fields, business data statistical range element fields, and business data statistical dimension element fields, and vectorizing the elements to form atomic indicator elements, statistical period elements, business limitation elements, and statistical dimension elements; According to the atomic indicator element, the statistical period element, the business limitation element and the statistical dimension element, searching for matching indicator elements in the vector database and returning them; The returned indicator elements are obtained, and an indicator structure is generated according to the indicator elements, wherein the indicator structure is y=f(x), wherein x is the indicator element, and y is the generated indicator name.
2. The index generation method according to claim 1, characterized in that: The decomposition of the description information into business data element fields, business data statistical time range element fields, business data statistical range element fields and business data statistical dimension element fields includes: Using a word segmenter in combination with Chinese grammar to split the description information into nouns, adjectives and quantifiers; Determine the nouns that belong to the atomic indicator table or the statistical dimension table among the split nouns, select noun one and noun two among the nouns after word segmentation, assume that one of the nouns belongs to the atomic indicator table and the other noun belongs to the statistical dimension table, calculate the semantic similarity using the cosine distance in the atomic indicator table and the statistical dimension table in the vector database, and determine the atomic indicator table and the statistical dimension table to which the nouns after word segmentation belong by taking the overall maximum probability using the formula max[cos(noun one, atomic indicator table)*cos(noun two, statistical dimension table), cos(noun two, atomic indicator table)*cos(noun one, statistical dimension table)], and use the nouns belonging to the atomic indicator table as business data element fields, and use the nouns belonging to the statistical dimension table as business data statistical dimension element fields; Using the split adjectives as parameters, finding the words with the highest similarity in the business definition table in the vector database as business data statistical range element fields; The split quantifiers are used as the business data statistical time range element fields.
3. The index generation method according to claim 1, characterized in that: The searching for matching indicator elements in a vector database and returning the matching indicator elements according to the atomic indicator elements, the statistical period elements, the business definition elements and the statistical dimension elements includes: An atomic indicator table, a business definition table, a statistical dimension table and a statistical period table are set in a vector database, wherein the business data noun vector is stored in the atomic indicator table, the business data statistical range noun vector is stored in the business definition table, the business data statistical dimension noun vector is stored in the statistical dimension table, and the statistical period noun vector is stored in the statistical period table; Query the business data noun vector group that matches the atomic indicator element in the atomic indicator table, query the business data statistical range noun vector group that matches the business limitation element in the business limitation table, query the business data statistical dimension noun vector group that matches the statistical dimension element in the statistical dimension table, and query the statistical period noun vector group that matches the statistical period element in the statistical period table; The semantic similarity of each noun vector in the business data noun vector group, the business data statistical range noun vector group, the business data statistical dimension noun vector group and the statistical period noun vector group is calculated using the cosine distance, and the noun vector with the largest overall cosine distance is taken as the matching index element, and the index element is returned.
4. The index generation method according to claim 3, characterized in that: The method of calculating the semantic similarity of each noun vector in the business data noun vector group, the business data statistical range noun vector group, the business data statistical dimension noun vector group and the statistical period noun vector group by using the cosine distance, and taking the noun vector with the largest overall cosine distance as the matching indicator element includes: Assuming that the noun vector in the service data noun vector group is the first noun vector, the semantic similarity of the first noun vector is cos(first noun vector, atomic index table); Assuming that the noun vector in the noun vector group of the business data statistical range is the second noun vector, the semantic similarity of the second noun vector is cos(second noun vector, business restriction table); Assuming that the noun vector in the business data statistical dimension noun vector group is the third noun vector, the semantic similarity of the third noun vector is cos(third noun vector, statistical dimension table); Assuming that the noun vector in the statistical period noun vector group is the fourth noun vector, the semantic similarity of the fourth noun vector is cos(fourth noun vector, statistical periodic table); The formula for calculating the noun vector with the largest overall cosine distance is max[cos(first noun vector, atomic index table)*cos(second noun vector, business limitation table)*cos(third noun vector, statistical dimension table)*cos(fourth noun vector, statistical periodic table)], and the noun vector with the largest overall cosine distance in the combination of the first noun vector, the second noun vector, the third noun vector and the fourth noun vector is obtained as the matching index element.
5. The index generation method according to claim 1, characterized in that The indicator generation method also includes: Register the preset indicators in the indicator registry, and perform logical dimension modeling to form a snowflake model, wherein the snowflake model includes fields of the associated fact table and dimension table; After vectorizing the fields obtained by structurally splitting the preset indicators, the fields are classified and stored in the vector database according to atomic indicator elements, business limitation elements, statistical dimension elements and statistical period elements; Obtain the indicator names registered in the indicator registration table, and aggregate them according to the subject domains to which the indicator names belong to form an indicator index list; The semantic model is trained by providing a data set according to the indicator index list. The trained semantic model can decompose the input indicator description information into business data element fields, business data statistical time range element fields, business data statistical range element fields and business data statistical dimension element fields.
6. The index generation method according to claim 5, characterized in that: The step of registering the preset indicator in the indicator registration table and performing logical dimension modeling to form a snowflake model corresponding to the preset indicator includes: Building an indicator registry, wherein the indicator registry includes a fact table and a dimension table; Register the preset indicator in the indicator registration table, specify a fact table and a first field associated with the fact table, specify a dimension table and a second field associated with the dimension table, set the association mode between the first field and the second field to be equal to the first field and the second field or equal after being processed by a string function, and form a snowflake model corresponding to the preset indicator.
7. The index generation method according to claim 5, characterized in that: The indicator generation method also includes: In response to generating the indicator structure, a data set is provided according to the indicator structure to perform secondary training on the semantic model, and the semantic model is optimized and adjusted.
8. An indicator generating device, characterized in that: The device comprises: An indicator description information input module is used to obtain description information of the indicator to be generated, wherein the description information includes statistical business data, statistical time range of business data, statistical range of business data, and statistical dimension of business data; An indicator element decomposition module is used to decompose the descriptive information into elements, into business data element fields, business data statistical time range element fields, business data statistical range element fields and business data statistical dimension element fields, and to vectorize the elements to form atomic indicator elements, statistical period elements, business limitation elements and statistical dimension elements; An indicator element matching query module, used to query and return matching indicator elements in a vector database according to the atomic indicator element, the statistical period element, the business limitation element and the statistical dimension element; The indicator structure generation module is used to obtain the returned indicator elements and generate an indicator structure according to the indicator elements. The indicator structure is y=f(x), wherein x is the indicator element and y is the generated indicator name.
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.