Machine learning model generation method and system for code generation

By building a model code database and generating corresponding code tags, the problems of low efficiency and insufficient applicability of machine learning model code generation in the existing technology are solved, and more efficient and accurate automatic code generation is achieved.

CN119473247APending Publication Date: 2025-02-18SHENZHEN WEIYAN TECH CO LTD
View PDF 1 Cites 0 Cited by

Patent Information

Application Number
CN202411531548.9
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-10-30
Publication Date
2025-02-18

AI Technical Summary

Technical Problem

When generating machine learning model code, the development threshold is high and the efficiency is low. If a suitable existing model code cannot be found, it cannot be implemented, and there is a problem of insufficient applicability.

Method used

By building a model code database, collecting and classifying historical machine learning model code, forming a subset of code and generating corresponding code tags, used to generate machine learning models. The specific steps include receiving the generation task, analyzing the target and selecting the appropriate model type, building a basic code framework, coding and arranging and combining codes, generating multiple model codes, and trial running filtering.

Benefits of technology

It improves the efficiency and accuracy of automatic code generation, provides more optional code selection, and can adjust the matching degree as needed, reducing the workload of post-adjustment.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119473247A_ABST
    Figure CN119473247A_ABST
Patent Text Reader

Abstract

The invention relates to a code-generated machine learning model generation method and system, and the method comprises the following steps: receiving a machine learning model generation task, and constructing a basic code frame for achieving a task target under a selected model type; carrying out primary matching in the corresponding code subset according to the purpose needing to be realized of each part in the basic code framework, and taking a matching result meeting the requirement as a preselection item; analyzing one or more characteristic tags set by the business application and / or the system environment for each part in the basic code framework; performing secondary matching in the corresponding pre-selected items by taking the characteristic tags as matching items, and screening out codes of which the matching degrees are lower than a first set value; performing permutation and combination on the residual codes to generate a plurality of machine learning model codes; by means of the method, the efficiency and precision of automatic code generation can be greatly improved, and the workload of later adjustment of the codes obtained through automatic screening is small.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the technical field of machine learning models, and more specifically, to a method and system for generating a machine learning model for code generation. Background Art

[0002] A machine learning model is a mathematical function that adjusts model parameters by learning training data to minimize the error between the predicted output and the true label; the development of machine learning model code usually requires a high degree of manual participation from business problem experts, data scientists, algorithm experts, etc., resulting in a high threshold for the development of machine learning model code and low development efficiency; China application, application number 202310849920.X A method and device for generating machine learning model code, discloses a method for processing and generating target model code through existing model code with the same business application and system environment. Although this method can solve the above problems to a certain extent, it has great limitations. If no suitable existing model code that meets the requirements can be found, it cannot be implemented at all. A machine learning model generation method and system with higher applicability is needed. Summary of the invention

[0003] The technical problem to be solved by the present invention is that, in view of the above-mentioned defects of the prior art, a method for generating a machine learning model for code generation is provided, and a system for generating a machine learning model for code generation is also provided.

[0004] The technical solution adopted by the present invention to solve its technical problem is:

[0005] A code-generated machine learning model generation method is constructed, which includes the following steps:

[0006] Step 1: Create a model code database:

[0007] Collect historical machine learning model codes belonging to the same industry and build a historical model database;

[0008] The historical model database is classified according to the model type to form multiple type modules;

[0009] The model codes belonging to the same type of module are classified according to the purpose of each specific code to form multiple code subsets. The names of the code subsets are named according to the code purpose.

[0010] At the same time, the corresponding code label is generated according to the characteristics of each specific code;

[0011] Step 2: Generate a machine learning model:

[0012] Receive machine learning model generation tasks, analyze task objectives and select appropriate model types, and build the basic code framework to achieve task objectives under the selected model type;

[0013] According to the purpose that each part of the basic code framework needs to achieve, a match is performed in the corresponding code subset, and the matching results that meet the requirements are used as pre-selected items;

[0014] Analyze the business application and / or system environment to set one or more feature tags for each part of the basic code framework;

[0015] Perform secondary matching on the corresponding pre-selected items using the characteristic tags as matching items, and filter out the codes whose matching degree is lower than the first set value;

[0016] Arrange and combine the remaining codes to generate multiple machine learning model codes;

[0017] Generate a machine learning model based on the machine learning model code, and run it for trial operation to screen out machine learning models with code error rates higher than a second set value.

[0018] The machine learning model generation method for code generation of the present invention, wherein the code is classified according to the purpose of each specific code segment to form multiple code subsets, and the code subsets are named according to the code purpose. The method is as follows:

[0019] Obtain model code text and translate the model code text into code semantics;

[0020] Perform semantic analysis to group codes with related semantics into one section;

[0021] Perform semantic analysis to obtain the semantics of a piece of code and summarize the purpose of the code;

[0022] Each piece of code with semantic meaning is regarded as a code subset, and the purpose of the code is regarded as the name of the code subset.

[0023] The machine learning model generation method for code generation of the present invention, wherein the method for generating corresponding code labels according to the characteristics of each specific code segment adopts:

[0024] Based on the semantic analysis results of each piece of code, regular words in the semantics are screened out, and the remaining words are used as feature words to generate corresponding code tags.

[0025] The machine learning model generation method for code generation of the present invention, wherein the analysis of the business application and / or system environment sets one or more characteristic tags for each part of the basic code framework using the method:

[0026] Traverse each part of the basic code framework and classify each part into industry general code and industry special code;

[0027] For industry-wide common codes, set industry-wide common feature labels;

[0028] For industry-specific codes, set feature labels that meet the requirements of actual business applications and / or system environments.

[0029] The code-generated machine learning model generation method described in the present invention, wherein the types of models are divided into neural network models, neuroscience models, decision tree models, probability models and nearest neighbor models.

[0030] A machine learning model generation system for code generation, applied to the machine learning model generation method for code generation as described above, wherein the system comprises a model code database construction unit and a machine learning model generation unit;

[0031] The model code database construction unit is used to collect historical machine learning model codes belonging to the same industry and construct a historical model database; the historical model database is classified according to the type of model to form multiple type modules; the model codes belonging to the same type of module are classified according to the purpose achieved by each specific code segment to form multiple code subsets, and the names of the code subsets are named according to the code purposes; and corresponding code tags are generated according to the characteristics of each specific code segment;

[0032] The machine learning model generation unit is used to receive a machine learning model generation task, analyze the task objectives and select a suitable model type, and construct a basic code framework for achieving the task objectives under the selected model type; perform a match in the corresponding code subset according to the purpose that each part in the basic code framework needs to achieve, and use the matching results that meet the requirements as pre-selected items; analyze the business application and / or system environment to set one or more characteristic tags for each part in the basic code framework; perform a secondary match in the corresponding pre-selected items using the characteristic tags as matching items, and filter out codes with a matching degree lower than a first set value; arrange and combine the remaining codes to generate multiple machine learning model codes; generate a machine learning model based on the machine learning model code, and test run it to filter out machine learning models with a code error rate higher than a second set value.

[0033] The machine learning model generation system for code generation of the present invention, wherein the code is classified according to the purpose achieved by each specific code segment to form multiple code subsets, and the code subsets are named according to the code purpose using the following method:

[0034] Obtain model code text and translate the model code text into code semantics;

[0035] Perform semantic analysis to group codes with related semantics into one section;

[0036] Perform semantic analysis to obtain the semantics of a piece of code and summarize the purpose of the code;

[0037] Each piece of code with semantic meaning is regarded as a code subset, and the purpose of the code is regarded as the name of the code subset.

[0038] The machine learning model generation system for code generation of the present invention, wherein the method for generating corresponding code labels according to the characteristics of each specific code segment is as follows:

[0039] Based on the semantic analysis results of each piece of code, regular words in the semantics are screened out, and the remaining words are used as feature words to generate corresponding code tags.

[0040] The machine learning model generation system for code generation of the present invention, wherein the analysis of the business application and / or system environment sets one or more characteristic tags for each part of the basic code framework using the method:

[0041] Traverse each part of the basic code framework and classify each part into industry general code and industry special code;

[0042] For industry-wide common codes, set industry-wide common feature labels;

[0043] For industry-specific codes, set feature labels that meet the requirements of actual business applications and / or system environments.

[0044] The code-generated machine learning model generation system described in the present invention, wherein the types of models are divided into neural network models, neuroscience models, decision tree models, probability models and nearest neighbor models.

[0045] The beneficial effects of the present invention are: by applying the method of the present application, by classifying data code types, mining the meaning of the codes and setting labels, the historical machine learning model codes of the entire industry are used as a database. When generating machine learning models, there are more optional code choices, and the matching degree can be adjusted as needed, which can greatly improve the efficiency and accuracy of automatic code generation, and the workload of later adjustment of the automatically screened codes is also small. BRIEF DESCRIPTION OF THE DRAWINGS

[0046] In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the present invention will be further described below in conjunction with the accompanying drawings and embodiments. The drawings described below are only some embodiments of the present invention. For those of ordinary skill in the art, other drawings can be obtained based on these drawings without creative work:

[0047] Figure 1 It is a flow chart of a method for generating a machine learning model by code generation according to a preferred embodiment of the present invention;

[0048] Figure 2 It is a flow chart of a method for generating a machine learning model by code generation according to a preferred embodiment of the present invention;

[0049] Figure 3 It is a flow chart of a method for generating a machine learning model by code generation according to a preferred embodiment of the present invention;

[0050] Figure 4 It is a principle block diagram of a machine learning model generation system for code generation according to a preferred embodiment of the present invention. DETAILED DESCRIPTION

[0051] In order to make the purpose, technical solutions and advantages of the embodiments of the present invention clearer, the following will be described clearly and completely in combination with the technical solutions in the embodiments of the present invention. Obviously, the described embodiments are partial embodiments of the present invention, not all embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work belong to the protection scope of the present invention.

[0052] The machine learning model generation method for code generation of a preferred embodiment of the present invention is as follows: Figure 1 See also Figure 2 and Figure 3 , including the following steps:

[0053] S01: Establish model code database:

[0054] S010: Collect historical machine learning model codes belonging to the same industry and build a historical model database;

[0055] S011: The historical model database is classified according to the type of model to form multiple type modules;

[0056] S012: Classify the model codes belonging to the same type of module according to the purpose of each specific code to form multiple code subsets, and name the code subsets according to the code purpose;

[0057] S013: Generate corresponding code labels according to the characteristics of each specific code segment;

[0058] S02: Generate Machine Learning Model:

[0059] S020: Receive machine learning model generation tasks, analyze task objectives and select appropriate model types, and build a basic code framework to achieve task objectives under the selected model type;

[0060] S021: Perform a match in the corresponding code subset according to the purpose to be achieved by each part in the basic code framework, and use the matching results that meet the requirements as pre-selected items;

[0061] S022: Analyze the business application and / or system environment to set one or more feature tags for each part of the basic code framework;

[0062] S023: performing secondary matching on the corresponding pre-selected items using the characteristic tag as a matching item, and filtering out codes with a matching degree lower than a first set value;

[0063] S024: Arrange and combine the remaining codes to generate multiple machine learning model codes;

[0064] S025: Generate a machine learning model based on the machine learning model code, conduct a trial run, and screen out machine learning models with a code error rate higher than a second set value;

[0065] By applying the method of the present application, by classifying data code types, mining the meaning of the codes and setting labels, and using the historical machine learning model codes of the entire industry as a database, there will be more optional code choices when generating machine learning models, and the matching degree can be adjusted as needed, which can greatly improve the efficiency and accuracy of automatic code generation, and the workload of later adjustment of the automatically screened codes is also relatively small.

[0066] Preferably, each specific code is classified according to its purpose to form multiple code subsets, and the code subsets are named according to the code purpose. The method is as follows:

[0067] Obtain model code text and translate the model code text into code semantics;

[0068] Perform semantic analysis to group codes with related semantics into one section;

[0069] Perform semantic analysis to obtain the semantics of a piece of code and summarize the purpose of the code;

[0070] Each piece of code with semantic meaning is regarded as a code subset, and the code purpose is regarded as the name of the code subset;

[0071] Based on semantic analysis technology, semantics can be analyzed more accurately and segmented, and the subsequent characteristic word lifting operation can make this step easy to implement.

[0072] Preferably, the method for generating corresponding code labels according to the characteristics of each specific code segment is as follows:

[0073] Based on the semantic analysis results of each piece of code, regular words in the semantics are screened out, and the remaining words are used as feature words to generate corresponding code tags.

[0074] Preferably, the method of analyzing the business application and / or system environment to set one or more characteristic tags for each part of the basic code framework is as follows:

[0075] Traverse each part of the basic code framework and classify each part into industry general code and industry special code;

[0076] For industry-wide common codes, set industry-wide common feature labels;

[0077] For industry-specific codes, set feature labels that meet the needs of actual business applications and / or system environments;

[0078] They are treated separately in the form of general code and special code. Generally speaking, it is easier to find historical code segments for general code, while it is relatively much more difficult to find special code. Therefore, this solution is based on the above-mentioned semantic analysis, and classifies the codes, sets labels, and implements this step in a label matching manner, which can ensure good accuracy while taking into account high matching efficiency.

[0079] Preferably, the types of models are divided into neural network models, neuroscience models, decision tree models, probability models and nearest neighbor models; the above types are basic types and can be further subdivided as needed.

[0080] A code-generated machine learning model generation system is applied to the code-generated machine learning model generation method as described above, such as Figure 4 As shown, the system includes a model code database construction unit 100 and a machine learning model generation unit 101;

[0081] The model code database construction unit 100 is used to collect historical machine learning model codes belonging to the same industry and construct a historical model database; the historical model database is classified according to the type of model to form multiple type modules; the model codes belonging to the same type module are classified according to the purpose achieved by each specific code segment to form multiple code subsets, and the name of the code subset is named according to the code purpose; at the same time, a corresponding code label is generated according to the characteristics of each specific code segment;

[0082] The machine learning model generation unit 101 is used to receive a machine learning model generation task, analyze the task goal and select a suitable model type, and construct a basic code framework for achieving the task goal under the selected model type; perform a match in the corresponding code subset according to the purpose that each part in the basic code framework needs to achieve, and use the matching results that meet the requirements as pre-selected items; analyze the business application and / or system environment to set one or more characteristic tags for each part in the basic code framework; perform a secondary match in the corresponding pre-selected items using the characteristic tags as matching items, and filter out codes with a matching degree lower than a first set value; arrange and combine the remaining codes to generate multiple machine learning model codes; generate a machine learning model based on the machine learning model code, and test run it to filter out machine learning models with a code error rate higher than a second set value;

[0083] The system of the present application classifies data code types, mines the meaning of codes and sets labels, and uses the historical machine learning model codes of the entire industry as a database. When generating machine learning models, there are more optional code choices, and the matching degree can be adjusted as needed. This can greatly improve the efficiency and accuracy of automatic code generation, and the workload of later adjustment of the automatically screened codes is also relatively small.

[0084] It should be understood that those skilled in the art can make improvements or changes based on the above description, and all these improvements and changes should fall within the scope of protection of the appended claims of the present invention.

Claims

1. A method for generating a machine learning model for code generation, characterized in that: The following steps are involved: Step 1: Create a model code database: Collect historical machine learning model codes belonging to the same industry and build a historical model database; The historical model database is classified according to the model type to form multiple type modules; The model codes belonging to the same type of module are classified according to the purpose of each specific code to form multiple code subsets. The names of the code subsets are named according to the code purpose. At the same time, the corresponding code label is generated according to the characteristics of each specific code; Step 2: Generate a machine learning model: Receive machine learning model generation tasks, analyze task objectives and select appropriate model types, and build the basic code framework to achieve task objectives under the selected model type; According to the purpose that each part of the basic code framework needs to achieve, a match is performed in the corresponding code subset, and the matching results that meet the requirements are used as pre-selected items; Analyze the business application and / or system environment to set one or more feature tags for each part of the basic code framework; Perform secondary matching on the corresponding pre-selected items using the characteristic tags as matching items, and filter out the codes whose matching degree is lower than the first set value; Arrange and combine the remaining codes to generate multiple machine learning model codes; Generate a machine learning model based on the machine learning model code, and run it for trial operation to screen out machine learning models with code error rates higher than a second set value.

2. The method for generating a machine learning model for code generation according to claim 1, characterized in that: The code subsets are classified according to the purpose of each specific code segment to form multiple code subsets. The code subsets are named according to the code purpose. The method is as follows: Obtain model code text and translate the model code text into code semantics; Perform semantic analysis to group codes with related semantics into one section; Perform semantic analysis to obtain the semantics of a piece of code and summarize the purpose of the code; Each piece of code with semantic meaning is regarded as a code subset, and the purpose of the code is regarded as the name of the code subset.

3. The method for generating a machine learning model for code generation according to claim 2, characterized in that: The method for generating corresponding code labels according to the characteristics of each specific code segment is as follows: Based on the semantic analysis results of each piece of code, regular words in the semantics are screened out, and the remaining words are used as feature words to generate corresponding code tags.

4. The method for generating a machine learning model for code generation according to claim 3, characterized in that: The method for analyzing the business application and / or system environment to set one or more characteristic tags for each part of the basic code framework is as follows: Traverse each part of the basic code framework and classify each part into industry general code and industry special code; For industry-wide common codes, set industry-wide common feature labels; For industry-specific codes, set feature labels that meet the requirements of actual business applications and / or system environments.

5. The method for generating a machine learning model for code generation according to claim 1, characterized in that: The types of models are divided into neural network models, neuroscience models, decision tree models, probability models and nearest neighbor models.

6. A machine learning model generation system for code generation, applied to the machine learning model generation method for code generation as claimed in any one of claims 1 to 5, characterized in that: The system includes a model code database construction unit and a machine learning model generation unit; The model code database construction unit is used to collect historical machine learning model codes belonging to the same industry and construct a historical model database; the historical model database is classified according to the type of model to form multiple type modules; The model codes belonging to the same type of module are classified according to the purpose of each specific code segment to form multiple code subsets. The names of the code subsets are named according to the code purpose. At the same time, the corresponding code labels are generated according to the characteristics of each specific code segment. The machine learning model generation unit is used to receive a machine learning model generation task, analyze the task goal and select a suitable model type, and build a basic code framework for achieving the task goal under the selected model type; A match is performed in the corresponding code subset according to the purpose that each part in the basic code framework needs to achieve, and the matching results that meet the requirements are used as pre-selected items; one or more characteristic tags set for each part in the basic code framework by analyzing the business application and / or system environment; a second match is performed in the corresponding pre-selected items using the characteristic tags as matching items, and codes with a matching degree lower than a first set value are screened out; the remaining codes are arranged and combined to generate multiple machine learning model codes; a machine learning model is generated based on the machine learning model code, and a trial run is performed to screen out machine learning models with code error rates higher than a second set value.

7. The machine learning model generation system for code generation according to claim 6, characterized in that: The code subsets are classified according to the purpose of each specific code segment to form multiple code subsets. The code subsets are named according to the code purpose. The method is as follows: Obtain model code text and translate the model code text into code semantics; Perform semantic analysis to group codes with related semantics into one section; Perform semantic analysis to obtain the semantics of a piece of code and summarize the purpose of the code; Each piece of code with semantic meaning is regarded as a code subset, and the purpose of the code is regarded as the name of the code subset.

8. The machine learning model generation system for code generation according to claim 7, characterized in that: The method for generating corresponding code labels according to the characteristics of each specific code segment is as follows: Based on the semantic analysis results of each piece of code, regular words in the semantics are screened out, and the remaining words are used as feature words to generate corresponding code tags.

9. The machine learning model generation system for code generation according to claim 8, characterized in that: The method for analyzing the business application and / or system environment to set one or more characteristic tags for each part of the basic code framework is as follows: Traverse each part of the basic code framework and classify each part into industry general code and industry special code; For industry-wide common codes, set industry-wide common feature labels; For industry-specific codes, set feature labels that meet the requirements of actual business applications and / or system environments.

10. The machine learning model generation system for code generation according to claim 6, characterized in that: The types of models are divided into neural network models, neuroscience models, decision tree models, probability models and nearest neighbor models.

Citation Information

Patent Citations

  • Machine learning model code generation method and device

    CN116560631A