TECHNICAL FIELD
The present invention relates to the field of computer data science and technology, and particularly relates to a method for constructing an intelligent computation engine of an artificial intelligence cross-platform model on the basis of knowledge self-evolution.
BACKGROUND
With the advancement of science and technology and rising demands of the people amid economic globalization, the discrete manufacturing has undergone tremendous changes, and emergencies such as rush orders, cancellation of orders, personalized customization, equipment failures and material coordination have made the production process complex and variable. However, the existing discrete manufacturing systems are hard to be used in dynamic complex scenarios and often require manual intervention. Being trained in specific static scenarios, these existing systems are difficult to cope with the frequent changes in manufacturing information during actual production. Dynamic parameters or system model structures of a workshop system often change due to changes in the actual operating conditions, as well as internal and external conditions of the workshop. Therefore, there is an urgent need for a knowledge self-evolution technology that enables a discrete manufacturing model to evolve over time, adapt to current dynamic scenarios, and realize a truly intelligent and dynamic discrete manufacturing system.
SUMMARY
The present invention provides a method for constructing an intelligent computation engine of an artificial intelligence cross-platform model on the basis of knowledge self-evolution, which can shorten the time for the convergence of model parameters, and the present invention has great application value for the training of a dynamic discrete manufacturing model, which is disturbed with time in actual production.
In order to solve the above technical problem, the present invention provides a method for constructing intelligent computation engine of artificial intelligence cross-platform model on basis of knowledge self-evolution, including following steps:
- step 1. determining a source moment and a target moment; and dividing a discrete manufacturing system data set at a certain moment into a plurality of data sets according to a division rule and on the basis of artificial experience:
- step 2. initializing a dynamic discrete manufacturing system model;
- step 3: preprocessing data to construct a task pool, where a part of the data is used to train a source model, and the other part of the data is used to train a target neural network;
- step 4. constructing a meta learning framework, which includes training the meta learning model and quickly adjusting the target neural network, such that rapid migration among a plurality of tasks is realized;
- step 5. changing the target moment, and quickly migrating a trained neural network to a new task by using the meta learning framework;
- step 6: iterating the step 5 until the dynamic discrete manufacturing system model converges, and storing the model parameters after convergence; and
- step 7. using the dynamic discrete manufacturing system model for a new environment task, and testing the performance of the dynamic discrete manufacturing system model.
Preferably, in the step 1, determining a source moment and a target moment; and dividing a discrete manufacturing system data set at a certain moment into a plurality of data sets according to a division rule and on the basis of artificial experience specifically includes:
- step 11. selecting the source moment s and the target moment t, and inputting discrete manufacturing data of the two time periods; and
- step 12. dividing the data sets of the two time periods into optimal Ns and Nt static discrete manufacturing data sets according to the division rule such as equal division, production cost or product quantity and on the basis of artificial experience.
Preferably, in the step 2, initializing a dynamic discrete manufacturing system model specifically includes:
- step 21. selecting an appropriate deep reinforcement learning neural network Q based on a deep reinforcement learning algorithm, and initializing a parameter θ of the dynamic discrete manufacturing system model; and
- step 22. defining two hyperparameters α and β of a meta learning algorithm, and determining a specific value after a plurality of experiments.
Preferably, in the step 3, preprocessing data to construct a task pool, where a part of the data is used to train a source model, and the other part of the data is used to train a target neural network specifically includes:
- step 31: according to the data divided in the step 12, Ns categories at the source moment are called meta-train classes, and are used to train a meta learning model Qs. which represents a static model applicable to a current moment and operating conditions; and Nt categories at the target moment are called meta-test classes, and are used to a target model Qt, which represents the dynamic discrete manufacturing system model applicable to the new moment and new operating conditions after dynamic parameters are adjusted;
- step 32: setting a task extraction method to M way-K shot, and constructing a data set for training the meta learning model; and selecting Ms categories from the meta-train classes, selecting Ls samples (Ls>Ks) for each of the categories to form a task Ts. where Ks samples are selected from each of the categories and taken as a training set of a current task, which is called a support set, remaining Ms*(Ls−Ks) samples are taken as a test set of the current task, which is called a query set; and a task is repeatedly and randomly extracted from the meta—train classes to form a task pool composed of a plurality of T, and distribution of the task pool is defined as p(Ts); and
- step 33: constructing a data set for training the target model; and selecting Mt categories from meta—test classes, selecting Lt samples (Lt>Kt) for each of the categories to form a task Tt, where Kt samples are selected from each of the categories and taken as a training set of a current task, which is called a support set, remaining Mt*(Lt−Kt) samples are taken as a test set of the current task, which is called a query set; and a task is repeatedly and randomly extracted from the meta—test classes to form a task pool composed of a plurality of T, and distribution of the task pool is defined as p(Tt).
Preferably, in the step 4, constructing a meta learning framework, which includes training the meta learning model and quickly adjusting the target neural network, such that rapid migration among a plurality of tasks is realized, which specifically includes following steps:
- step 41. training the meta learning model Qs, specifically including following sub-steps:
- (a) randomly initializing a model parameter θs of the meta learning model Qs;
- (b) randomly sampling ns tasks T from the task pool to form a batch, where each of the tasks Ti(i=1,2,3 . . . , ns) satisfies distribution of Ti˜p(Ts);
- (c) calculating a gradient ∇θsLTi(fθs) of the model parameter θs by using the support set in a certain task Ti of the batch, with a formula for updating the model parameter θs as follows:
- in the formula, θ′si is a parameter of the meta learning model Qs updated based on Ti, and ∇θsLTi(fθs) is a loss gradient function of θs calculated based on Ti;
- (d) repeating the step (c) based on every task in the batch for na times, such that a first updating of the gradient is completed, and the updated parameter θs is obtained;
- (e) performing a second updating of the gradient: calculating a loss gradient of θs by using the query set in each of the tasks Ti in the batch, and then calculating a sum of losses of the batch, and updating the gradient by using the sum of losses, with a formula updating the gradient as follows:
- in this way, updating the second gradient is completed, and training of the meta learning model on the batch is ended;
- (f) returning to the step (b), and re-sampling to form a next batch;
- step 42. obtaining an initialized parameter θs of the meta learning model Qs after the training is completed, dynamically adjusting the model parameters according to the data set at the target moment to have the target model adapted to new internal and external production environments, and the training of the target model Qt specifically includes following steps:
- (g) initializing the model parameter of the target model Qt, and assigning Qt to the model parameter Qs; that is, θt=θs;
- (h) randomly sampling nt tasks T from the task pool, where each of the tasks Ti(i=1,2,3 . . . , n) satisfies distribution of Ti˜p(Tt);
- (i) calculating a gradient ∇θtLTi(fθt) of the model parameter θt by using the support set in a certain task Ti of the batch, with a formula for updating the model parameter θt as follows:
- in the formula, θ′ti is a parameter of the updated target model Qt based on Ti; and
- (j) employing the formula in the step (i) to the parameter θt initialized in the step (g) based on each of the tasks randomly extracted in the step (h) to obtain nt updated parameters θ′ti, and averaging the updated parameters to obtain final model parameters, with a formula as follows:
- the above is a training process of the target model Qt, a neural network model Qt applicable to the target moment t is finally obtained, and dynamic adjustment of parameters and rapid migration of the dynamic discrete manufacturing system model are implemented.
Preferably, in the step 5, changing the target moment, and quickly migrating a trained neural network to a new task by using the meta learning framework specifically include following steps:
- step 51. taking the trained target neural network model Qt as the source model, and a next moment t+1 as a new target moment, and then quickly migrating the neural network model from the target moment t to the moment t+1;
- step 52. performing data preprocessing according to the step 3 to construct the task pool; and
- step 53. obtaining a parameter θt+1 of a new target neural network Qt+1 according to the step 4.
Preferably, in the step 6: iterating the step 5 until the dynamic discrete manufacturing system model converges, and storing the model parameters after convergence specifically include following steps:
- step 61: iterating the step 5 to continuous obtain neural network models Qt, Qt+1, Qt+2 . . . at next moments until the model parameters converge, indicating that the dynamic discrete manufacturing system model can adapt well to production environments with different operating conditions in different time periods, and can output an optimal decision, regardless of internal and external conditions; and
- step 62: storing the model parameters after the model converges to obtain the final dynamic discrete manufacturing system model.
Preferably, in the step 7, using the dynamic discrete manufacturing system model for a new environment task, and testing the performance of the dynamic discrete manufacturing system model, specifically: when the dynamic discrete manufacturing system model can output a scheduling strategy well in a new environment, and has higher efficiency than the original system, it indicates the results meet the expectation, and the training is completed; and going back to the step 1 to perform the training again when the results fail to meet the expectation.
Beneficial effects of the present invention are as follows: the present invention involves few small calculations and good generalization performance. Based on a training set composed of a small number of samples of different types, the present invention employs the meta learning framework to achieve the learning of common features across multiple categories, thereby improving the generalization performance of the dynamic discrete manufacturing model. The model parameters converge quickly and exhibit strong transferability. By loading the optimized parameters trained by meta-learning as initialization parameters for a new task, the present invention can complete the model parameters for the discrete manufacturing model at a new moment only through a few training steps, facilitating rapid task migration, and the more similar the new task is to the original task, the less time is required. Compared with randomly initializing parameters or loading the existing network model parameters, the algorithm enables rapid fine-tuning of the neural network, and shortens the time for the convergence of the model parameters, and the present invention has great application value for the training of a dynamic discrete manufacturing model, which is disturbed with time in actual production.
BRIEF DESCRIPTION OF THE DRAWINGS
FIG. 1 is a schematic flowchart of a method according to the present invention.
FIG. 2 is a structural schematic diagram of a meta learning framework according to the present invention.
DETAILED DESCRIPTIONS OF THE EMBODIMENTS
As shown in FIGS. 1-2, a method for constructing intelligent computation engine of artificial intelligence cross-platform model on basis of knowledge self-evolution is provided, including following steps:
- step 1. determining a source moment and a target moment; dividing a discrete manufacturing system data set at a certain moment into a plurality of data sets according to a division rule and on the basis of artificial experience; selecting data sets of two time periods from dynamic discrete manufacturing data, the data sets of the two time periods represent different workshop operating conditions and internal and external conditions, dynamic parameters of a workshop system change accordingly, such that the workshop system needs to realize self-evolution to adjust the dynamic parameters by itself, so as to adapt to complex and changeable workshop production conditions. The two data sets are called data sets at the source moment and the target moment respectively, the data set at the source moment represents data used to train a static discrete manufacturing production model, the data set at the target moment represents data after the workshop operating conditions and the internal and external conditions have changed, indicating that the dynamic discrete manufacturing system model is applicable to a new moment after the dynamic parameters are adjusted, and adaptive adjustment of the dynamic discrete manufacturing system model is achieved. Next, the discrete manufacturing system data set at the source moment is divided into a plurality of data sets according to the division rule and on the basis of artificial experience (completely dividing the data set equally, dividing the data set into a plurality of data sets with a same corresponding cost according to a production cost or dividing the data set according to a number of produced products).
Specifically:
- step 11. selecting the source moment s and the target moment t, and inputting discrete manufacturing data of the two time periods; and
- step 12. dividing the data sets of the two time periods into optimal Ns and Nt static discrete manufacturing data sets according to the division rule such as equal division, production cost or product quantity and on the basis of artificial experience.
Step 2. initializing the dynamic discrete manufacturing system model, specifically:
- step 21. selecting an appropriate deep reinforcement learning neural network Q based on a deep reinforcement learning algorithm, and initializing a parameter θ of the dynamic discrete manufacturing system model;
- step 22. defining two hyperparameters α and β of a meta learning algorithm, and determining a specific value after a plurality of experiments.
Step 3: preprocessing data to construct a task pool, where a part of the data is used to train a source model, and the other part of the data is used to train a target neural network; and specifically includes following steps:
- step 31: according to the data divided in the step 12, Ns categories at the source moment are called meta—train classes, and are used to train a meta learning model Qs. which represents a static model applicable to a current moment and operating conditions; and Nt categories at the target moment are called meta-test classes, and are used to a target model Qt, which represents the dynamic discrete manufacturing system model applicable to the new moment and new operating conditions after dynamic parameters are adjusted;
- step 32: setting a task extraction method to M way-K shot, and constructing a data set for training the meta learning model; and selecting Ms categories from the meta-train classes, selecting Ls samples (Ls>Ks) for each of the categories to form a task Ts, where Ks samples are selected from each of the categories and taken as a training set of a current task, which is called a support set, remaining Ms*(Ls−Ks) samples are taken as a test set of the current task, which is called a query set; and a task is repeatedly and randomly extracted from the meta—train classes to form a task pool composed of a plurality of T. and distribution of the task pool is defined as p(Ts); and
- step 33: constructing a data set for training the target model; and selecting Mt categories from meta—test classes, selecting Lt samples (Lt>Kt) for each of the categories to form a task Tt, where Kt samples are selected from each of the categories and taken as a training set of a current task, which is called a support set, remaining Mt*(Lt−Kt) samples are taken as a test set of the current task, which is called a query set; and a task is repeatedly and randomly extracted from the meta—test classes to form a task pool composed of a plurality of T, and distribution of the task pool is defined as p(Tt).
Step 4. constructing a meta learning framework, which includes training the meta learning model and quickly adjusting the target neural network, such that rapid migration among a plurality of tasks is realized, specifically including following steps:
- step 41. training the meta learning model Qs, specifically including following steps:
- (a) randomly initializing a model parameter θs of the meta learning model Qs;
- (b) randomly sampling ns tasks T from the task pool to form a batch, where each of the tasks Ti(i=1,2,3 . . . , ns) satisfies distribution of Ti˜p(Ts);
- (c) calculating a gradient ∇θsLTi(fθs) of the model parameter θs by using the support set in a certain task Ti of the batch, with a formula for updating the model parameter θs as follows:
- in the formula, θ′si is a parameter of the updated meta learning model Qs based on Ti, and ∇θsLTi(fθs) is a loss gradient function of θs calculated based on Ti;
- (d) repeating the step (c) based on every task in the batch for nα times, such that a first updating of the gradient is completed, and the updated parameter θs is obtained;
- (e) performing a second updating of the gradient: calculating a loss gradient of θs by using the query set in each of the tasks Ti in the batch, and then calculating a sum of losses of the batch, and updating the gradient by using the sum of losses, with a formula updating the gradient as follows:
- in this way, updating the second gradient is completed, and training of the meta learning model on the batch is ended;
- (f) returning to the step (b), and re-sampling to form a next batch;
- step 42. obtaining an initialized parameter θs of the meta learning model Qs after the training is completed, dynamically adjusting the model parameters according to the data set at the target moment to have the target model adapted to new internal and external production environments, and the training of the target model Qt specifically includes following steps:
- (g) initializing the model parameter of the target model Qt, and assigning Qt to the model parameter Qs; that is, θt=θs;
- (h) randomly sampling nt tasks T from the task pool, where each of the tasks Ti(i=1,2,3 . . . , n) satisfies distribution of Ti˜p(Tt);
- (i) calculating a gradient ∇θtLTi(fθt) of the model parameter θt by using the support set in a certain task Ti of the batch, with a formula for updating the model parameter θt as follows:
- in the formula, θ′ti is a parameter of the updated target model Qt based on Ti; and
- (j) employing the formula in the step (i) to the parameter θt initialized in the step (g) based on each of the tasks randomly extracted in the step (h) to obtain nt updated parameters θ′ti, and averaging the updated parameters to obtain final model parameters, with a formula as follows:
- the above is a training process of the target model Qt, a neural network model Qt applicable to the target moment t is finally obtained, and dynamic adjustment of parameters and rapid migration of the dynamic discrete manufacturing system model are implemented.
Step 5. changing the target moment, and quickly migrating a trained neural network to a new task by using the meta learning framework, specifically including following steps:
- step 51. taking the trained target neural network model Qt as the source model, and a next moment t+1 as a new target moment, and dividing the data sets of the two time periods according to the step 12; and then quickly migrating the neural network model from the target moment t to the moment t+1;
- step 52. performing data preprocessing according to the step 3 to construct the task pool; and
- step 53. obtaining a parameter θt+1 of a new target neural network Qt+1 according to the step 4.
Step 6: iterating the step 5 until the dynamic discrete manufacturing system model converges, and storing the model parameters after convergence; specifically including following steps:
- step 61: iterating the step 5 to continuous obtain neural network models Qt, Qt+1, Qt+2 . . . at next moments until the model parameters converge, indicating that the dynamic discrete manufacturing system model can adapt well to production environments with different operating conditions in different time periods, and can output an optimal decision, regardless of internal and external conditions; and
- step 62: storing the model parameters after the model converges to obtain the final dynamic discrete manufacturing system model.
Step 7. using the dynamic discrete manufacturing system model for a new environment task, and testing the performance of the dynamic discrete manufacturing system model, specifically: when the dynamic discrete manufacturing system model can output a scheduling strategy well in a new environment, and has higher efficiency than the original system, it indicates the results meet the expectation, and the training is completed; and going back to the step 1 to perform the training again when the results fail to meet the expectation.