Algorithm configuration method, device, computer equipment and storage medium
By obtaining and analyzing the algorithm from the target page data, and using the basic algorithm and configuration parameters to configure the calculation formula, it solves the problem of low development efficiency of a large number of similar algorithms in enterprise operations, realizes the automatic configuration and efficient reuse of the algorithm, and reduces the development and Maintenance costs.
Patent Information
- Application Number
- CN201810919755.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2018-08-14
- Publication Date
- 2024-09-13
- Estimated Expiration
- Not applicable · inactive patent
AI Technical Summary
In the era of big data, a large amount of business data in enterprise operations requires the development of a large number of similar algorithms, resulting in redundant algorithms, high resource usage, increased maintenance costs, and low efficiency.
By obtaining the target algorithm from the target page data, the calculation formula is obtained through analysis, and the calculation formula is configured using the basic algorithm, operators and configuration parameters to realize automatic analysis and configuration of the algorithm and improve the reuse rate of the basic algorithm.
Development time and costs are reduced, and algorithm configuration efficiency and system performance are improved.
Smart Images

Figure CN109189385B
Abstract
Description
Technical Field
[0001] The present invention relates to the field of computer software, and in particular to an algorithm configuration method, device, computer equipment and storage medium. Background Art
[0002] With the advent of the big data era and the continuous development of cloud computing technology, data information is changing rapidly. The operation and development of enterprises increasingly require the support of efficient and accurate data calculations. Algorithms play an increasingly important supporting role in the process of data processing.
[0003] Developers need to develop a large number of algorithms for data calculations when faced with a large amount of business data from enterprise operations. In the process of algorithm development, many business data will use some of the same algorithms. Many algorithms are basically the same, but their configuration parameters or combinations are different. A large number of algorithms not only increases the workload of developers, makes the algorithms too redundant, occupies system resources, and increases maintenance costs, but also makes the efficiency of algorithm development and use very low. Summary of the invention
[0004] The embodiments of the present invention provide an algorithm configuration method, apparatus, computer equipment and storage medium to improve the efficiency of algorithm development and use.
[0005] An algorithm configuration method, comprising:
[0006] Acquire target page data, and acquire a target algorithm from the target page data;
[0007] Parsing the target algorithm according to the algorithm structure of the target algorithm to obtain a calculation formula, wherein the calculation formula includes a basic algorithm identifier, an operator, and a parameter variable;
[0008] According to the basic algorithm identifier, query the algorithm table and obtain the corresponding basic algorithm from the algorithm table;
[0009] Query the target page data according to the parameter variable to obtain the configuration parameters corresponding to the parameter variable;
[0010] The calculation formula is configured using the basic algorithm, the operator and the configuration parameters.
[0011] An algorithm configuration device, comprising:
[0012] A target page data acquisition module, used to acquire target page data and acquire a target algorithm from the target page data;
[0013] A target algorithm parsing module, used for parsing the target algorithm according to the algorithm structure of the target algorithm to obtain a calculation formula, wherein the calculation formula includes a basic algorithm identifier, an operator and a parameter variable;
[0014] A basic algorithm acquisition module, used to query an algorithm table according to the basic algorithm identifier, and acquire a basic algorithm corresponding to the basic algorithm identifier from the algorithm table;
[0015] A configuration parameter acquisition module, used to query the target page data according to the parameter variable and acquire the configuration parameters corresponding to the parameter variable;
[0016] A calculation formula configuration module is used to configure the calculation formula using the basic algorithm, the operator and the configuration parameters.
[0017] A computer device comprises a memory, a processor and a computer program stored in the memory and executable on the processor, wherein the processor implements the steps of the above algorithm configuration method when executing the computer program.
[0018] A computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the steps of the above algorithm configuration method are implemented.
[0019] The above-mentioned algorithm configuration method, device, computer equipment and storage medium obtain the target algorithm from the target page data, parse the target algorithm to obtain the calculation formula, and then configure the calculation formula using the operator, the basic algorithm in the algorithm table and the configuration parameters in the target page data, so that the algorithm can be automatically parsed and configured to improve the reuse rate of the basic algorithm and reduce development time and cost. BRIEF DESCRIPTION OF THE DRAWINGS
[0020] In order to more clearly illustrate the technical solutions of the embodiments of the present invention, the accompanying drawings required for use in the description of the embodiments of the present invention will be briefly introduced below. Obviously, the accompanying drawings in the following description are only some embodiments of the present invention. For ordinary technicians in this field, other accompanying drawings can be obtained based on these accompanying drawings without paying creative labor.
[0021] Figure 1 is a schematic diagram of an application environment of an algorithm configuration method in one embodiment of the present invention;
[0022] Figure 2 is a schematic diagram of an implementation of an algorithm configuration method provided in an embodiment of the present invention;
[0023] Figure 3 yes Figure 2 A schematic diagram of an implementation of step S10;
[0024] Figure 4 yes Figure 2 A schematic diagram of an implementation of step S20;
[0025] Figure 5 yes Figure 2 A schematic diagram of an implementation of step S40;
[0026] Figure 6 is another implementation schematic diagram of the algorithm configuration method provided in one embodiment of the present invention;
[0027] Figure 7 is a schematic diagram of an algorithm configuration device in one embodiment of the present invention;
[0028] Figure 8 is a schematic diagram of a computer device in one embodiment of the present invention. DETAILED DESCRIPTION
[0029] The following will be combined with the drawings in the embodiments of the present invention to clearly and completely describe the technical solutions in the embodiments of the present invention. Obviously, the described embodiments are part of the embodiments of the present invention, not all of the embodiments. According to the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.
[0030] The algorithm configuration method provided in this application can be applied in Figure 1 In the application environment, the client communicates with the server through the network. The user initiates a query request through the client, and the server obtains the target page data according to the query request, and parses and configures the target algorithm in the target page data. The client can be, but is not limited to, various personal computers, laptops, smart phones, tablet computers, and portable wearable devices. The server can be implemented with an independent server or a server cluster consisting of multiple servers.
[0031] Figure 2 The schematic diagram of the algorithm configuration method in this embodiment is shown. The algorithm configuration method is applied in the server to automatically configure the algorithm to improve the reuse rate of the basic algorithm, reduce development time and cost, and improve system efficiency. Figure 2 As shown, the algorithm configuration method includes the following steps:
[0032] S10: Obtain target page data, and obtain a target algorithm from the target page data.
[0033] The target page data refers to the data information configuration table based on the product dimension, and the target page data includes the target algorithm. For example, the insurance contract information configuration table of a certain insurance product obtained according to user needs is the target page data. In the insurance contract information configuration table, business personnel record transaction-related information and customize the corresponding target algorithm according to specific business needs.
[0034] The target algorithm refers to the algorithm used to calculate the business data corresponding to the product, which is filled in by the business personnel in the target page data according to the actual business needs. For example, the target algorithm of the effective insurance amount in the insurance contract information configuration table is max (premium paid for the main insurance, cash value of the main insurance) * risk coefficient. This target algorithm is used to calculate the amount of the effective insurance amount of the insurance business.
[0035] Specifically, the server may automatically obtain the target page data at regular intervals or at predetermined time intervals, or may obtain the target page data based on a query request input by a user from a client, and obtain the target algorithm from the target page data.
[0036] S20: parsing the target algorithm according to the algorithm structure of the target algorithm to obtain a calculation formula, where the calculation formula includes a basic algorithm identifier, an operator, and parameter variables.
[0037] Among them, the algorithm structure of the target algorithm refers to the logical combination structure of the target algorithm, and the calculation formula refers to the formula used for calculation obtained after parsing the target algorithm. For example, the target algorithm of the effective insurance amount in the insurance contract information configuration table is: max (premium paid for the main insurance, cash value of the main insurance) * risk coefficient. According to the algorithm structure of the target algorithm, the target algorithm is parsed to obtain the calculation formula BD_SA = || max (Abc_01, Abc_02) || * cs_BD.
[0038] The basic algorithm identifier is an identifier used to distinguish different basic algorithms. Among them, the basic algorithm refers to an algorithm with pre-configured program code, that is, the commonly used algorithm scripts are stored, and the scripts can be directly called for subsequent use without rewriting. Basic algorithms are commonly used algorithms in the calculation process, and are often used in combination in target algorithms. Operators refer to calculation symbols based on mathematical function operations, which can include arithmetic operators, connection operators, relational operators, assignment operators, logical operators, and function operators. Parameter variables are variables used to represent calculation data in calculation formulas. Parameter variables are not specific parameters, but variables representing a type of data.
[0039] Specifically, the target algorithm is parsed according to its logical combination structure to obtain a calculation formula. For example, the calculation formula of the effective insurance amount target algorithm BD_SA = || max(Abc_01, Abc_02) || *cs_BD includes the function operator "max()" (clustering function) and the arithmetic operator "*", while Abc_01 and Abc_02 are basic algorithm identifiers, and cs_BD represents the risk coefficient, which is a parameter variable in the calculation formula. Because different insurance policies have different corresponding risk coefficients, parameter variables are used instead, and different configuration parameters can be configured according to different insurance policies.
[0040] S30: querying an algorithm table according to the basic algorithm identifier, and obtaining a basic algorithm corresponding to the basic algorithm identifier from the algorithm table.
[0041] Among them, the algorithm table refers to a table storing basic algorithms. The basic algorithm is an algorithm with pre-configured program code. The algorithm table stores basic algorithms with pre-configured program code, that is, the script of the basic algorithm is stored in the algorithm table, and the basic algorithm can be directly called in subsequent use without rewriting.
[0042] Specifically, the algorithm table is searched according to the basic algorithm identifier to obtain the basic algorithm corresponding to the basic algorithm identifier in the algorithm table, and the program code of the basic algorithm is stored in the algorithm table.
[0043] S40: Query the target page data according to the parameter variables, and obtain configuration parameters corresponding to the parameter variables.
[0044] Specifically, a parameter variable is a variable used to represent calculation data in a calculation formula, and a parameter variable represents a type of data. A parameter variable is a variable in a calculation formula, and the target page data stores the configuration parameters required by the calculation formula of the target algorithm. The target page data is queried according to the parameter variable to obtain the configuration parameters corresponding to the parameter variable.
[0045] Configuration parameters refer to the data in the target page data used for calculation according to the calculation formula, that is, the specific parameters that need to be input when calculating the calculation formula. For example, the parameter data that needs to be input to calculate the claim amount of the insurance business based on the claim amount calculation algorithm.
[0046] S50: configuring a calculation formula using basic algorithms, operators, and configuration parameters.
[0047] Specifically, the basic algorithm found in the algorithm table is used to configure the basic algorithm identifier corresponding to the basic algorithm in the calculation formula, the configuration parameters are used to configure the parameter variables corresponding to the configuration parameters in the calculation formula, and then the basic algorithm and the configuration parameters are connected through operators to obtain the configured calculation formula.
[0048] In this embodiment, by obtaining the target page data and obtaining the target algorithm from the target page data, the target algorithm can be directly obtained by parsing the target page data, which simplifies the operation process. The target algorithm is then parsed to obtain a calculation formula, which automates the analysis of the target algorithm. The calculation formula is then configured using the basic algorithm, operators, and configuration parameters to complete the configuration of the target algorithm, thereby improving the reuse rate of the basic algorithm, streamlining the algorithm configuration process, reducing development time and cost, and improving the efficiency of the system in algorithm configuration.
[0049] In one embodiment, if Figure 3 As shown, in step S10, the target page data is obtained, and the target algorithm is obtained from the target page data, which specifically includes the following steps:
[0050] S11: Obtain a query request, query the database according to the query request, and obtain target page data.
[0051] The query request refers to a request triggered by a user to query the target page data, and the database stores the target page data uploaded by the business personnel.
[0052] In a specific implementation, the user may input the policy number from the client, the client generates a query request based on the policy number input by the user, and sends the query request to the server, the server queries the database based on the policy number in the query request, and obtains the target page data corresponding to the policy number, so that the specified target page data can be obtained as required.
[0053] S12: Use the indexOf function to search for a target algorithm preset field in the target page data.
[0054] The indexOf function is used to find the preset field of the target algorithm in the target page data, and can locate the specific position of the preset field of the target algorithm in the target page data. The preset field of the target algorithm refers to the field corresponding to the target algorithm when it is stored in the target page data, and is used to indicate the target algorithm in the target page data.
[0055] Specifically, the indexOf function is used to query the preset field of the target algorithm in the target page data. For example, by setting the preset field "formula" of the target algorithm, traversing the target page data, the indexOf function is used to find out whether the preset field "formula" exists in the target page data. Correspondingly, the target algorithm in the target page data is stored based on the field "formula". When the indexOf function finds the preset field of the target algorithm in the target page field, it returns an integer value indicating the position of the preset field of the target algorithm in the target page data. If the substring is not found, -1 is returned.
[0056] S13: Obtain the target algorithm according to the preset fields of the target algorithm.
[0057] Specifically, according to the preset field of the target algorithm, the target algorithm corresponding to the preset field of the target algorithm in the target page data is obtained. Furthermore, if the preset field of the target algorithm of the target page data is found, the corresponding field value is read, and it is determined whether there is an operator combination in the field value, that is, whether there is an "=" operator and other operators, other operators include method arithmetic operators, connection operators, relational operators, assignment operators, logical operators or function operators. If a field value includes an "=" operator and at least one other operator, the field value is the target algorithm. If there is an operator combination in the field value, the field value is obtained as the target algorithm; if there is no operator combination in the field value, the field value is abandoned.
[0058] In this embodiment, the target algorithm in the target page data is found out through the indexOf function, the target page data can be automatically parsed, and the target algorithm in the target page data can be obtained, which simplifies the operation process.
[0059] In one embodiment, if Figure 4 As shown, in step S20, the target algorithm is parsed according to the algorithm structure of the target algorithm to obtain a calculation formula, which includes a basic algorithm identifier, an operator and a parameter variable, and specifically includes the following steps:
[0060] S21: Read the target algorithm and use regular expressions to identify operators in the target algorithm.
[0061] Among them, a regular expression is a string matching pattern that can be used to check whether a string contains a certain character pattern and process it. As a template, a regular expression matches a certain character pattern with the searched string to identify specific characters in the string. Among them, the method of constructing a regular expression is to use a variety of metacharacters and logical operators to combine small expressions to create larger expressions. The components of a regular expression can be a single character, a character set, a character range, a choice between characters, or any combination of all these components.
[0062] Specifically, the set of all operators that can be used in the target page data is used as a regular expression, the target algorithm is read, the target algorithm is parsed, the string of the target algorithm is obtained, and the string of the target algorithm is matched with the metacharacters of the regular expression one by one. If the target algorithm string has the same character as that in the regular expression, the character is identified as an operator and recorded. For example, the regular expression containing all operators in the target page data is a set of all operators such as {+, ﹣, *, / , max(), min(), ∑, =, ..........}, and the string of the target algorithm is parsed to be "max (premium paid by the main insurance, cash value of the main insurance) * risk coefficient". The characters of the string of the target algorithm "max (premium paid by the main insurance, cash value of the main insurance) * risk coefficient" are matched one by one with the operator set of the regular expression, and it can be identified that "max()" and "*" exist in the string of the target algorithm, so that the operators "max()" and "*" existing in the target algorithm can be identified.
[0063] S22: Use the indexOf function to identify the basic algorithm identifier and parameter variables of the target algorithm.
[0064] Among them, the basic algorithm identifier and parameter variables are distinguished by specific identification characters, that is, the basic algorithm identifier of each basic algorithm carries a specific identification character, which can be a specific prefix field of each basic algorithm identifier. The code of the basic algorithm is prefixed with a specific identification character to distinguish it. For example, the code of the basic algorithm is "01, 02, 03", and the code of the basic algorithm "01, 02, 03" is prefixed with a specific identification character "Abc_" to obtain the basic algorithm identifier "Abc_01, Abc_02, Abc_03". For example: the basic algorithm is identified by the specific identification character "Abc_" in the query field. If a field value contains the "Abc_" field, it can be considered that the field is a basic algorithm.
[0065] Each parameter variable is also set with a specific variable identifier for distinction. For example, a prefix specific identification character "cs_" is set in the character string of the parameter variable, and the parameter variable is obtained by identifying the identification character "cs_".
[0066] Specifically, the indexOf function is used to identify specific identification characters in the target algorithm, and the specific identification characters "Abc_" or "cs_" in the target algorithm are searched. If the specific identification character "Abc_" exists, the field corresponding to the specific identification character "Abc_" is read as the basic algorithm identifier. If the specific identification character "cs_" exists, the field corresponding to the specific identification character "cs_" is read as the parameter variable.
[0067] S23: combining the operators, basic algorithm identifiers and parameter variables according to the combination logic of the target algorithm to obtain a calculation formula.
[0068] Specifically, the operators, basic algorithm identifiers and parameter variables read by the analysis are combined according to the combination logic of the target algorithm to obtain a calculation formula. For example, the target algorithm for the effective insurance amount in the insurance contract information configuration table is: max (premium paid for the main insurance, cash value of the main insurance) * risk coefficient. The operators "max()" and "*" in the target algorithm are identified based on regular expressions. Based on the specific identifier "Abc_" of the target algorithm, the two target algorithm identifiers Abc_01 and Abc_02 in the target algorithm are obtained. Based on the specific identification character "cs_" of the parameter variable, the parameter variable cs_BD in the target algorithm is obtained. The operator, basic algorithm identifier and parameter variable are combined according to the combination logic of the target algorithm, and the calculation formula for the effective insurance amount can be obtained as BD_SA = || max(Abc_01, Abc_02) || * cs_BD.
[0069] In this embodiment, regular expressions are used to read operators in the target algorithm, and the indexOf function is used to identify basic algorithms and parameter variables in the target algorithm. The operators, basic algorithms and parameter variables in the target algorithm can be quickly read out, thereby improving the parsing efficiency of the target algorithm.
[0070] In one embodiment, if Figure 5 As shown, in step S40, the target page data is queried according to the parameter variable to obtain the configuration parameters corresponding to the parameter variable, which specifically includes the following steps:
[0071] S41: According to the parameter variable, query the target page data, and obtain the field value corresponding to the parameter variable from the target page data.
[0072] Specifically, the target page data is queried according to the parameter variable, and if there is a field in the target page data that matches the parameter variable, the field value corresponding to the field is obtained.
[0073] S42: Query the relationship comparison table according to the field value to obtain the configuration parameters corresponding to the field value.
[0074] The relationship comparison table is a table established in advance based on commonly used business requirements, by associating and storing in advance the business data of all possible business requirements and the standard configuration parameters corresponding to the business data.
[0075] The relational table stores the standard configuration parameters corresponding to all business data in a systematic and complete manner in the form of key-value. For example, in the insurance business, different age groups of insured persons correspond to different serious illness risk factors. The risk factor is 8% for 0-17 years old, 5% for 18-34 years old, 15% for 35-54 years old, and 25% for 55-80 years old. In the relational table, the risk factor value is used as the key, and each age value corresponding to the risk factor is used as the value. The risk factor key and the age value form a risk factor-age mapping relationship. For example, the age value mapped to the risk factor key of 5% is 18-34 years old.
[0076] Specifically, the corresponding field value in the target page data is parsed, and the parsed field value is queried based on the relationship comparison table to obtain the corresponding key value. For example, if the age in the target page data is 45 years old, the relationship comparison table is queried, and based on the risk factor-age mapping relationship, the corresponding risk factor key can be obtained as 15%, and 15% is returned as a configuration parameter.
[0077] In this embodiment, the corresponding field value in the target page data is obtained according to the parameter variable, and the configuration parameters corresponding to the field value are queried through the relationship comparison table. The relationship comparison table can be queried very conveniently to obtain the correct configuration parameters, reducing the problem of incorrect configuration parameters caused by human errors.
[0078] In one embodiment, if Figure 6 As shown, before step S30, that is, before the step of querying the algorithm table according to the basic algorithm identifier and obtaining the basic algorithm corresponding to the basic algorithm identifier from the algorithm table, the algorithm configuration method further includes the following steps:
[0079] S301: Obtain existing algorithms and count the usage frequency of each existing algorithm.
[0080] The existing algorithm refers to the algorithm that has been used in the target page data.
[0081] Specifically, existing algorithms are acquired, statistics are collected on the existing algorithms, and the usage frequency of each existing algorithm is obtained, so as to determine whether the existing algorithm is a frequently used algorithm.
[0082] S302: Using an existing algorithm whose usage frequency is greater than a frequency threshold as a basic algorithm, wherein the basic algorithm includes a basic algorithm identifier.
[0083] The frequency threshold is a threshold preset by the user, and an existing algorithm whose usage frequency is greater than the frequency threshold is a frequently used algorithm, that is, a basic algorithm. It can be understood that the basic algorithm refers to an existing algorithm whose usage frequency reaches the frequency threshold in actual use.
[0084] Specifically, existing algorithms with a usage frequency greater than a frequency threshold are selected as basic algorithms, so that the basic algorithms with high usage frequency are stored in the algorithm table. Furthermore, the frequency threshold can be set according to user needs. For example, among the existing algorithms of the target page data, the algorithm with a usage frequency exceeding 60% is set as the basic algorithm, and the frequency threshold is 60%. The setting of the frequency threshold is related to the total number and usage frequency of the existing algorithms.
[0085] S303: Store the basic algorithm in the algorithm table.
[0086] Specifically, by setting the basic algorithm identifier as the identification identifier of the basic algorithm, the basic algorithm is stored in the algorithm table based on the basic algorithm identifier, so that the basic algorithm uniquely determines the corresponding storage position through the basic algorithm identifier.
[0087] In the algorithm configuration method provided in the embodiment of the present invention, by statistics and analysis of existing algorithms, existing algorithms with a usage frequency higher than a frequency threshold are obtained as basic algorithms, and existing algorithms with high usage frequencies are accurately filtered out, thereby meeting the actual needs of users, enabling the basic algorithms to adapt to the usage frequency requirements, reducing the development workload, and improving the reuse rate of the basic algorithms.
[0088] It should be understood that the order of execution of the steps in the above embodiment does not necessarily mean the order of execution. The execution order of each process should be determined by its function and internal logic, and should not constitute any limitation on the implementation process of the embodiment of the present invention.
[0089] In one embodiment, an algorithm configuration device is provided, and the algorithm configuration device corresponds one-to-one to the algorithm configuration method in the above embodiment. Figure 7 As shown, the algorithm configuration device includes a target page data acquisition module 10, a target algorithm parsing module 20, a basic algorithm acquisition module 30, a configuration parameter acquisition module 40 and a calculation formula configuration module 50. The functional modules are described in detail as follows:
[0090] The target page data acquisition module 10 is used to acquire the target page data and obtain the target algorithm from the target page data;
[0091] A target algorithm parsing module 20 is used to parse the target algorithm according to the algorithm structure of the target algorithm to obtain a calculation formula, where the calculation formula includes a basic algorithm identifier, an operator and a parameter variable;
[0092] A basic algorithm acquisition module 30 is used to query an algorithm table according to a basic algorithm identifier, and acquire a basic algorithm corresponding to the basic algorithm identifier from the algorithm table;
[0093] The configuration parameter acquisition module 40 is used to query the target page data according to the parameter variables and obtain the configuration parameters corresponding to the parameter variables;
[0094] The calculation formula configuration module 50 is used to configure the calculation formula using basic algorithms, operators and configuration parameters.
[0095] Preferably, the target page data acquisition module 10 includes: a query request acquisition unit 11 , a preset field search unit 12 and a target algorithm acquisition unit 13 .
[0096] A query request acquisition unit 11 is used to acquire a query request, query a database according to the query request, and acquire target page data;
[0097] A preset field search unit 12 is used to use an indexOf function to search for a target algorithm preset field in the target page data;
[0098] The target algorithm acquisition unit 13 is used to acquire the target algorithm according to the preset fields of the target algorithm.
[0099] Preferably, the target algorithm parsing module 20 includes: an operator identification unit 21 , an indexOf function identification unit 22 and a calculation formula combination unit 23 .
[0100] An operator identification unit 21 is used to read a target algorithm and identify operators in the target algorithm using regular expressions;
[0101] An indexOf function identification unit 22, used to identify a basic algorithm identifier and parameter variables of a target algorithm using an indexOf function;
[0102] The calculation formula combination unit 23 is used to combine the operators, basic algorithm identifiers and parameter variables according to the combination logic of the target algorithm to obtain a calculation formula.
[0103] Preferably, the configuration parameter acquisition module 40 includes: a field value acquisition unit 41 and a field value query unit 42 .
[0104] The field value acquisition unit 41 is used to query the target page data according to the parameter variable and acquire the corresponding field value from the target page data;
[0105] The field value query unit 42 is used to query the relationship comparison table according to the field value to obtain the configuration parameters corresponding to the field value.
[0106] Preferably, the algorithm configuration device further includes: an existing algorithm statistics module 301 , a basic algorithm screening module 302 and a basic algorithm storage module 303 .
[0107] An existing algorithm statistics module 301 is used to obtain existing algorithms and count the usage frequency of each existing algorithm;
[0108] A basic algorithm screening module 302, used to select an existing algorithm with a usage frequency greater than a frequency threshold as a basic algorithm, wherein the basic algorithm includes a basic algorithm identifier;
[0109] The basic algorithm storage module 303 is used to store the basic algorithm in the algorithm table.
[0110] For the specific definition of the algorithm configuration device, please refer to the definition of the algorithm configuration method above, which will not be repeated here. Each module in the above algorithm configuration device can be implemented in whole or in part by software, hardware and a combination thereof. The above 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 of the computer device in the form of software, so that the processor can call and execute the operations corresponding to the above modules.
[0111] 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 8 As shown. The computer device includes a processor, a memory and a network interface 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 and a computer program. The internal memory provides an environment for the operation of the operating system and the computer program in the non-volatile storage medium. 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 algorithm configuration method is implemented.
[0112] 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:
[0113] Obtain target page data, and obtain target algorithm from the target page data;
[0114] Analyzing the target algorithm according to the algorithm structure of the target algorithm to obtain a calculation formula, where the calculation formula includes a basic algorithm identifier, an operator, and a parameter variable;
[0115] Query the algorithm table according to the basic algorithm identifier, and obtain the basic algorithm corresponding to the basic algorithm identifier from the algorithm table;
[0116] Query the target page data according to the parameter variables and obtain the configuration parameters corresponding to the parameter variables;
[0117] The calculation formula is configured using basic algorithms, operators, and configuration parameters.
[0118] 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:
[0119] Obtain target page data, and obtain target algorithm from the target page data;
[0120] Analyzing the target algorithm according to the algorithm structure of the target algorithm to obtain a calculation formula, where the calculation formula includes a basic algorithm identifier, an operator, and a parameter variable;
[0121] Query the algorithm table according to the basic algorithm identifier, and obtain the basic algorithm corresponding to the basic algorithm identifier from the algorithm table;
[0122] Query the target page data according to the parameter variables and obtain the configuration parameters corresponding to the parameter variables;
[0123] The calculation formula is configured using basic algorithms, operators, and configuration parameters.
[0124] Those skilled in the art can understand that all or part of the modules in the above-mentioned embodiment method 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 modules 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 the present application can include non-volatile and / or volatile memory. Non-volatile memory may include read-only memory (ROM), programmable ROM (PROM), electrically programmable ROM (EPROM), electrically erasable programmable ROM (EEPROM) or flash memory. Volatile memory may 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).
[0125] Those skilled in the art can clearly understand that for the convenience and simplicity of description, only the division of the above-mentioned functional units and modules is used as an example. In actual applications, the above-mentioned functions can be distributed and completed by different functional units and modules as needed, that is, the internal structure of the device can be divided into different functional units or modules to complete all or part of the functions described above.
[0126] The embodiments described above are only used to illustrate the technical solutions of the present invention, rather than to limit the same. Although the present invention has been described in detail with reference to the aforementioned embodiments, those skilled in the art should understand that the technical solutions described in the aforementioned embodiments may still be modified, or some of the technical features may be replaced by equivalents. Such modifications or replacements do not deviate the essence of the corresponding technical solutions from the spirit and scope of the technical solutions of the embodiments of the present invention, and should all be included in the protection scope of the present invention.
Claims
1. An algorithm configuration method, characterized in that: include: Acquire target page data, and acquire a target algorithm from the target page data; Parsing the target algorithm according to the algorithm structure of the target algorithm to obtain a calculation formula, wherein the calculation formula includes a basic algorithm identifier, an operator, and a parameter variable; According to the basic algorithm identifier, an algorithm table is searched to obtain a basic algorithm corresponding to the basic algorithm identifier from the algorithm table; Query the target page data according to the parameter variable to obtain the configuration parameters corresponding to the parameter variable; The calculation formula is configured using the basic algorithm, the operator and the configuration parameters; Before the step of querying the algorithm table according to the basic algorithm identifier and obtaining the basic algorithm corresponding to the basic algorithm identifier from the algorithm table, the algorithm configuration method further includes: Obtain existing algorithms, and count the usage frequency of each of the existing algorithms; Using the existing algorithm whose usage frequency is greater than the frequency threshold as a basic algorithm, wherein the basic algorithm includes the basic algorithm identifier; Storing the basic algorithm in the algorithm table; The step of analyzing the target algorithm according to the algorithm structure of the target algorithm to obtain a calculation formula includes: Read the target algorithm, and identify the operator in the target algorithm using a regular expression; Use the indexOf function to identify the specific identification characters in the target algorithm. If there is a specific identification character prefixing the code of the basic algorithm, read the corresponding field as the basic algorithm identifier. If there is a specific identification character prefixing the string of the parameter variable, read the corresponding field as the parameter variable. The operator, the basic algorithm identifier and the parameter variable are combined according to the combination logic of the target algorithm to obtain the calculation formula.
2. The algorithm configuration method according to claim 1, characterized in that: Obtaining target page data, and obtaining a target algorithm from the target page data, including: Obtaining a query request, querying a database according to the query request, and obtaining the target page data; Using the indexOf function to search for a target algorithm preset field in the target page data; The target algorithm is obtained according to the preset field of the target algorithm.
3. The algorithm configuration method according to claim 1, characterized in that: The step of querying the target page data according to the parameter variable to obtain configuration parameters corresponding to the parameter variable includes: According to the parameter variable, query the target page data, and obtain the field value corresponding to the parameter variable from the target page data; The relationship comparison table is queried according to the field value to obtain the configuration parameters corresponding to the field value.
4. An algorithm configuration device, characterized in that: include: A target page data acquisition module, used to acquire target page data and acquire a target algorithm from the target page data; A target algorithm parsing module, used for parsing the target algorithm according to the algorithm structure of the target algorithm to obtain a calculation formula, wherein the calculation formula includes a basic algorithm identifier, an operator and a parameter variable; A basic algorithm acquisition module, used to query an algorithm table according to the basic algorithm identifier, and acquire a basic algorithm corresponding to the basic algorithm identifier from the algorithm table; A configuration parameter acquisition module, used to query the target page data according to the parameter variable, and acquire the configuration parameters corresponding to the parameter variable; A calculation formula configuration module, used to configure the calculation formula using the basic algorithm, the operator and the configuration parameters; The algorithm configuration device also includes: An existing algorithm statistics module is used to obtain existing algorithms and count the usage frequency of each existing algorithm; A basic algorithm screening module, used to select an existing algorithm with a usage frequency greater than a frequency threshold as a basic algorithm, wherein the basic algorithm includes a basic algorithm identifier; A basic algorithm storage module, used for storing the basic algorithm in an algorithm table; The target algorithm parsing module includes: An operator identification unit, used for reading the target algorithm and identifying the operator in the target algorithm using a regular expression; An indexOf function recognition unit is used to use the indexOf function to recognize a specific identification character in the target algorithm. If there is a prefix specific identification character of the code of the basic algorithm, the corresponding field is read as the basic algorithm identifier. If there is a prefix specific identification character of the string of the parameter variable, the corresponding field is read as the parameter variable. A calculation formula combination unit is used to combine the operator, the basic algorithm identifier and the parameter variable according to the combination logic of the target algorithm to obtain the calculation formula.
5. The algorithm configuration device according to claim 4, characterized in that: The configuration parameter acquisition module includes: A field value acquisition unit, used to query the target page data according to the parameter variable, and acquire the field value corresponding to the parameter variable from the target page data; The field value query unit is used to query the relationship comparison table according to the field value to obtain the configuration parameters corresponding to the field value.
6. 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 algorithm configuration method according to any one of claims 1 to 3 are implemented.
7. A computer-readable storage medium storing a computer program, characterized in that: When the computer program is executed by a processor, the steps of the algorithm configuration method according to any one of claims 1 to 3 are implemented.
