A bad material prediction method, a bad material prediction device, and an electronic device
By combining time series forecasting models and machine learning models, and integrating the prediction results of multiple models, the problem of inaccurate prediction of defective material ratio in existing technologies has been solved, achieving higher prediction accuracy.
Patent Information
- Application Number
- CN202210296251.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-03-24
- Publication Date
- 2026-03-03
- Estimated Expiration
- 2042-03-24
AI Technical Summary
Existing technology cannot accurately predict the proportion of defective materials, resulting in discrepancies between manufacturers' material preparation and actual demand.
A method combining multiple time series forecasting models and machine learning models is adopted. The target time series forecasting model and the machine learning model of the relationship between material characteristics are verified by historical defective material data. The prediction results of multiple models are integrated to improve accuracy.
It significantly improves the accuracy of defective material prediction. By combining the prediction results of multiple models, it makes full use of the black-box features of machine learning and the trend of time series, thereby improving the accuracy of prediction.
Smart Images

Figure CN114757397B_ABST
Abstract
Description
Technical Field
[0001] This application belongs to the field of materials management technology, and in particular relates to a defective material prediction method, defective material prediction device, electronic device and computer-readable storage medium. Background Technology
[0002] Materials management is an indispensable part of modern production. Manufacturers need to prepare materials for each product in advance to ensure timely delivery. Considering the possibility of material damage, manufacturers need to take into account the proportion of defective materials in the next production cycle to reduce the occurrence of insufficient materials.
[0003] Currently, manufacturers either approximate the defective material ratio for each production cycle as a fixed value or manually predict the defective material ratio. Neither of these methods can accurately predict the defective material ratio, leading to discrepancies between the manufacturer's material preparation and actual demand. Summary of the Invention
[0004] This application provides a defective material prediction method, defective material prediction device, electronic device, and computer-readable storage medium, which can improve the accuracy of defective material ratio prediction.
[0005] Firstly, this application provides a method for predicting defective materials, including:
[0006] Based on historical defective material data, at least two preset time series prediction models are validated to determine the target time series prediction model, wherein the time series prediction model is used to describe the pattern of defective material ratio changing over time.
[0007] Based on historical material data, at least two preset machine learning models are trained and validated to determine the target machine learning model, wherein the machine learning model is used to describe the relationship between the proportion of defective materials and material characteristics.
[0008] The first defective material ratio of the target material is predicted by the target time series prediction model.
[0009] The second defective material ratio of the target material is predicted by the target machine learning model.
[0010] By combining the first defective material ratio value and the second defective material ratio value, the target defective material ratio value is obtained.
[0011] Secondly, this application provides a defective material prediction device, comprising:
[0012] The first determination module is used to verify at least two preset time series prediction models based on historical defective material data in order to determine the target time series prediction model, wherein the time series prediction model is used to describe the law of change of defective material ratio over time.
[0013] The second determination module is used to train and validate at least two preset machine learning models based on historical material data in order to determine the target machine learning model, wherein the machine learning model is used to describe the relationship between the proportion of defective materials and material characteristics.
[0014] The first prediction module is used to predict the first defective material ratio of the target material through the target time series prediction model.
[0015] The second prediction module is used to predict the second defective material ratio of the target material through the target machine learning model.
[0016] The fusion module is used to fuse the first defective material ratio value and the second defective material ratio value to obtain the target defective material ratio value.
[0017] Thirdly, this application provides an electronic device, which includes a memory, a processor, and a computer program stored in the memory and executable on the processor. When the processor executes the computer program, it implements the steps of the method described in the first aspect.
[0018] Fourthly, this application provides a computer-readable storage medium storing a computer program that, when executed by a processor, implements the steps of the method described in the first aspect above.
[0019] Fifthly, this application provides a computer program product comprising a computer program that, when executed by one or more processors, implements the steps of the method described in the first aspect.
[0020] The advantages of this application compared to existing technologies are as follows: When predicting the defective material ratio, instead of manual prediction or prediction using a single model, multiple models are used to predict from multiple perspectives, and the prediction results of multiple models are integrated. Specifically, the process is as follows: First, based on historical defective material data, at least two preset time-series prediction models are validated to determine the target time-series prediction model, which describes the pattern of defective material ratio changes over time. Second, based on historical material data, at least two preset machine learning models are trained and validated to determine the target machine learning model, which describes the relationship between the defective material ratio and material characteristics. Then, not only can the first defective material ratio value of the target material be predicted using the target time-series prediction model, but also the second defective material ratio value can be predicted using the target machine learning model. Finally, by integrating the first and second defective material ratio values, the target defective material ratio value can be obtained. This process fully utilizes the black-box characteristics of machine learning and the trends of time series data, significantly improving the accuracy of defective material prediction.
[0021] It is understood that the beneficial effects of the second to fifth aspects mentioned above can be found in the relevant descriptions in the first aspect mentioned above, and will not be repeated here. Attached Figure Description
[0022] To more clearly illustrate the technical solutions in the embodiments of this application, the drawings used in the description of the embodiments or the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments of this application. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.
[0023] Figure 1 This is a schematic diagram illustrating the implementation process of the defective material prediction method provided in the embodiments of this application;
[0024] Figure 2 This is a structural block diagram of the defective material prediction device provided in the embodiments of this application;
[0025] Figure 3 This is a schematic diagram of the structure of the electronic device provided in the embodiments of this application. Detailed Implementation
[0026] In the following description, specific details such as particular system architectures and techniques are set forth for illustrative purposes and not for limitation, in order to provide a thorough understanding of the embodiments of this application. However, those skilled in the art will understand that this application may also be implemented in other embodiments without these specific details. In other instances, detailed descriptions of well-known systems, apparatuses, circuits, and methods have been omitted so as not to obscure the description of this application with unnecessary detail.
[0027] To illustrate the technical solution proposed in this application, specific embodiments are described below.
[0028] The following mainly uses the prediction of the defective material ratio for the next quarter as an example to illustrate the defective material prediction method proposed in this application. It is understood that this application embodiment can also be used to predict the defective material ratio for the next month or the next year, etc., and the application purpose of this application embodiment is not limited here. Please refer to... Figure 1 The implementation process of this defective material prediction method is detailed below:
[0029] Step 101: Based on historical bad data, validate at least two preset time series prediction models to determine the target time series prediction model.
[0030] In this embodiment, the electronic device incorporates at least two time series prediction models. It is understood that although these time series prediction models serve the same purpose—describing the change in defective material ratio over time—the performance of different types of time series prediction models may differ in specific scenarios. To ensure the accuracy of the final prediction result, the electronic device may consider validating the performance of at least two time series prediction models based on historical defective material data to identify the best-performing model. This best-performing time series prediction model can be determined as the target time series prediction model.
[0031] Step 102: Based on historical material data, train and validate at least two preset machine learning models to determine the target machine learning model.
[0032] In this embodiment, the electronic device incorporates at least two machine learning models. It is understood that although these machine learning models serve the same purpose—describing the relationship between defective material ratio and material characteristics—the performance of different types of machine learning models may differ in specific scenarios. To ensure the accuracy of the final prediction result, the electronic device may consider validating the performance of at least two machine learning models based on historical material data to identify the best-performing model. This best-performing machine learning model can be determined as the target machine learning model.
[0033] Step 103: Predict the first defective material ratio of the target material using the target time series prediction model.
[0034] In this embodiment, once the target time series forecasting model is determined, it can be put into use. Based on the input data requirements of the target time series forecasting model, relevant data of the target material (i.e., the material whose defective material ratio is to be predicted) are found, and the relevant data is input into the target time series forecasting model to obtain the first defective material ratio value y1 for the target material in the next quarter.
[0035] Step 104: The second defective material ratio of the target material is predicted by the target machine learning model.
[0036] In this embodiment, once the target machine learning model is determined, it can be put into use. Based on the input data requirements of the target machine learning model, relevant data of the target material is found, and this relevant data is input into the target machine learning model to obtain the second defective material ratio value y2 for the target material in the next quarter.
[0037] Step 105: Combine the first defective material ratio value and the second defective material ratio value to obtain the target defective material ratio value.
[0038] In this embodiment, the first defective material ratio value is the defective material ratio predicted from the perspective of the change in defective material ratio over time; the second defective material ratio value is the defective material ratio predicted from the perspective of the relationship between defective material ratio and material characteristics. That is, although both are defective material ratio values predicted for the target material, they consider different perspectives. To obtain the best prediction effect, the electronic device can combine the two to obtain the final target defective material ratio value.
[0039] In some embodiments, historical defective material data may include defective material data for each material within each first historical time period; wherein the length of each first historical time period may be equal or unequal, and is not limited here. As an example only, the defective material data may specifically include the production defect rate and the incoming material defect rate; the electronic equipment may specifically divide the first historical time period based on a month. Of course, the electronic equipment may also divide the first historical time period based on days, weeks, quarters, or years, etc., and is not limited here.
[0040] Based on historical defective data, step 101 may specifically include:
[0041] A1. Electronic devices trigger various time series prediction models to make predictions based on the first historical defect data, and obtain the corresponding time series prediction results.
[0042] As examples, time series forecasting models can be categorized as follows: simple exponential smoothing models, Holt models, Holt-Winters models, and Autoregressive Integrated Moving Average (ARIMA) models. These time series forecasting models do not require training and can be used directly.
[0043] To facilitate understanding, a simple example is provided below:
[0044] Taking the material currently under consideration as material a, and electronic equipment as an example based on the first historical time period divided by month:
[0045] The historical defect data obtained by the electronic equipment includes the production defect rate and incoming defect rate of material 'a' for each past month. Based on this, a first set of historical defect data to be input can be constructed. This first set of historical defect data includes historical sample values of the production defect rate and the incoming defect rate, and can be expressed as:
[0046] Historical values of production defect rate sample = [m1, m2, m3, ..., m i-1 ]
[0047] Historical sample value of defective incoming materials = [n1, n2, n3, ..., n i-1 ]
[0048] Using any time series forecasting model, the production defect rate and incoming material defect rate for the next three months can be predicted, which can be expressed as:
[0049] Production defect rate prediction value = [m' i ,m' i+1 ,m' i+2 ]
[0050] Predicted percentage of defective incoming materials = [n' i ,n' i+1 ,n' i+2 ]
[0051] It should be noted that the next three months here are relative to month i-1.
[0052] Based on the production defect rate and incoming material defect rate predicted by any time series forecasting model for the next three months, the predicted defect rate for the corresponding quarter can be obtained. This predicted defect rate is the time series forecast result of the time series forecasting model, and can be expressed as:
[0053] Time series prediction result = (m' i +m' i+1 +m' i+2) / 3+(n' i +n' i+1 +n' i+2 ) / 3
[0054] As can be understood, in the above representation, m is the production defect rate for a certain month (i.e., a certain first historical period); n is the incoming material defect rate for a certain month (i.e., a certain first historical period); the subscript represents the sequence number of the corresponding first historical period. Obviously, the smaller the subscript, the earlier the corresponding first historical period.
[0055] A2. Based on the prediction results of each time series, the second historical bad data and the preset first evaluation index, select the target time series prediction model from at least two time series prediction models.
[0056] Electronic equipment can obtain the actual defective material data for the first historical time period corresponding to the time series prediction results from historical defective material data, that is, the actual production defective ratio and incoming material defective ratio for the next three months, which can be expressed as:
[0057] Production defective percentage label historical value = [m i ,m i+1 ,m i+2 ]
[0058] Incoming material defective ratio label historical value = [n i ,n i+1 ,n i+2 ]
[0059] Based on the actual production defect rate and incoming material defect rate for the next three months, a second historical defect data can be constructed, which can be represented as:
[0060] Second historical bad data = (m i +m i+1 +m i+2 ) / 3+(n i +n i+1 +n i+2 ) / 3
[0061] As can be seen from the subscripts, the time period corresponding to the first historical defect data (the first first historical time period, the second first historical time period to the (i-1)th first historical time period) is earlier than the time period corresponding to the second historical defect data (the i-th first historical time period, the (i+1)th first historical time period to the (i+1)th first historical time period); and the time period corresponding to the second historical defect data is the same as the time period corresponding to the time series prediction result.
[0062] It is understandable that for each first historical defect data point, the electronic device can construct a second historical defect data point as a label, and each time series prediction model can output the time series prediction result corresponding to the first historical defect data point through the above process, thereby realizing multiple verifications of various time series prediction models. The verification process can be briefly described as follows: the electronic device can compare each time series prediction result with the corresponding second historical defect data point based on a first evaluation metric, such as Mean Absolute Error (MAE), to find the best-performing time series prediction model as the target time series prediction model.
[0063] In some embodiments, historical material data includes: material data for each material within each second historical time period; wherein the length of each second historical time period is equal or unequal, and is not limited here. As an example only, the material data may include, in addition to the defective material data shown above (e.g., production defect rate and incoming defect rate), relevant data affecting defective materials and reserves, such as worker data handling materials and material price data, etc., which will not be elaborated here. The electronic equipment may specifically divide the second historical time period based on days, weeks, months, or quarters. Based on the historical material data, step 101 may specifically include:
[0064] B1. Divide the historical material data into training set, test set and validation set.
[0065] Electronic devices can first construct a dataset based on historical material data, including a training set, a test set, and a validation set. For example, taking the second historical time period divided by quarter, the material data of the previous quarter (i.e., quarter i-1) can be set as the training set, and the material data of this quarter (i.e., quarter i) as the test set, with the label "defective material ratio". In addition, electronic devices can also use a five-fold cross-validation method to split the historical material data to obtain the training and validation sets.
[0066] In some embodiments, considering that material data for a single quarter may be limited, the electronic device may consider expanding the training set to include material data for three historical quarters (i.e., quarters i-1, i-2, and i-3).
[0067] In some embodiments, data filtering can be performed before constructing the dataset, the process of which is as follows:
[0068] For consumable materials, the material data itself is inaccurate, and the recorded defective material ratio is usually all 0. Based on this, electronic equipment can filter out the material data of consumable materials from the historical material data.
[0069] Historical material data may contain samples with abnormally high defect rates, which can negatively impact the learning of machine learning models. Therefore, electronic devices can set a defect threshold (e.g., 0.2) based on the business scenario. This allows the electronic device to filter out samples with defect rates exceeding this threshold from the historical material data. Furthermore, the electronic device can further filter out samples with abnormally high defect rates within each material based on box plot principles.
[0070] In some embodiments, the electronic device can also process the generated "defective material ratio" label accordingly. Typically, the "defective material ratio" labels extracted and generated from historical material data exhibit a long-tailed distribution. The electronic device can adjust this distribution to a near-normal distribution through logarithmic processing. Specifically, the processing method is as follows:
[0071] The processed "percentage of defective materials" label = ln(y label +0.001)
[0072] Among them, y label This is a "defective material ratio" label extracted and created from historical material data (i.e., the "defective material ratio" label before processing).
[0073] It is understandable that, based on the processed "proportion of defective materials" label, after obtaining the prediction result output by the machine learning model during training, this prediction result should be restored using a restoration formula to obtain the true prediction value (this true prediction value is related to y). label Correspondingly, this restoration formula can be understood as the inverse operation of the previous logarithmic processing. The restoration formula is:
[0074] The actual predicted value = e y预测 -0.001
[0075] Among them, y 预测 These are the predicted values output by the machine learning model during the training process.
[0076] B2. Train various machine learning models based on the divided training set to obtain various trained machine learning models.
[0077] As examples, machine learning models can be categorized as follows: linear regression models, random forest models, XGBoost (eXtreme Gradient Boosting) models, and LGB (Light Gradient Boosting DecisionTree) models.
[0078] As described earlier, machine learning models learn the relationship between the percentage of defective materials and material characteristics. As an example only, material characteristics may include, but are not limited to, the following categories:
[0079] Basic characteristics of materials: category and price, etc.;
[0080] Historical shift characteristics: the proportion of total defective materials in the previous quarter, the proportion of total defective materials in the previous two quarters, the amount due in the previous quarter, and the trend of total defective materials in the previous quarter, etc.
[0081] Material statistical characteristics: historical total defective material ratio, mean, standard deviation, and median, etc.
[0082] Category statistical characteristics: mean, standard deviation, and median of the total historical defective material ratio for each category;
[0083] Worker data characteristics include: number of workers, male-to-female ratio, mean, standard deviation, and median of years of service. Specifically, the correspondence between workers and materials can be established based on the working time, and the worker-related characteristics for each material can be obtained.
[0084] B3. Based on the predefined validation set, test set, and predefined second evaluation metric, select the target machine learning model from at least two trained machine learning models.
[0085] Based on the pre-defined validation set, electronic devices can use cross-validation to find the optimal hyperparameters for each machine learning model. In other words, for each machine learning model, the best trained machine learning model is obtained based on the pre-defined validation set.
[0086] For example, through step B2, the electronic device can obtain two or more trained linear regression models. Among these models, the electronic device then uses cross-validation based on the partitioned validation set to find the best trained linear regression model. This process continues until the electronic device can ultimately find the best trained linear regression model, the best trained random forest model, the best trained XGBoost model, and the best trained LGB model.
[0087] It is important to note that training typically involves multiple rounds, and the validation set serves as a cross-validation tool after each round of training. In other words, the optimal trained machine learning model for each machine learning model is determined through multiple rounds of training and multiple rounds of cross-validation based on the validation set.
[0088] Then, based on the divided test set, the best of the various trained machine learning models are tested, and the best performing model is determined according to the second evaluation metric. This model is the target machine learning model.
[0089] For example, an electronic device acquires the output data of the best trained linear regression model, the best trained random forest model, the best trained XGBoost model, and the best trained LGB model on a test set, and evaluates the output data of each best machine learning model according to a second evaluation metric. As an example only, if the evaluation determines that the best trained LGB model outperforms the best trained linear regression model, the best trained random forest model, and the best trained XGBoost model, then the LGB model can be identified as the target machine learning model.
[0090] In some embodiments, the second evaluation metric includes MAE and win rate.
[0091] The MAE is calculated as follows: for each material, the absolute value of the error between the predicted value obtained through the machine learning model and the actual defective material ratio is calculated, denoted as d = |y 预测 -y 实际 Then, the average of the absolute values of the errors, d, for all materials is calculated. It can be understood that the MAE (Average Error Value) can be used to measure the overall error.
[0092] The win rate is calculated as the proportion of materials whose predicted error is less than the absolute value of the engineering department's adjustment error, out of the total number of materials. In other words, the win rate can be used to describe the proportion of times the model's prediction is more accurate than the engineering department's adjustment result.
[0093] In some embodiments, after determining the target machine learning model, before step 104, bootstrap aggregating (Bagging) can be used to perform ensemble learning on the target machine learning model, so that the target machine learning model can obtain more accurate prediction results after being put into use. The process can be briefly described as follows: the target machine learning model is trained several times (e.g., 5 times) using the same algorithm, but the training set used for each training is different. It can be understood that because the training set is different, the model parameters used in the final target machine learning model are also different. Taking the LGB model as an example, the training process is as follows:
[0094] C1. Random sampling: Randomly select samples of a first proportion from the training set, and randomly select material features of a second proportion during training to train the LGB model. The first proportion can be any value between 50% and 90%, and the second proportion can also be any value between 50% and 90%. The first and second proportions can be the same or different; no restrictions are imposed here.
[0095] C2. Step C1 is repeated several times, for example, 5 times. Since the sample and material characteristics are randomly selected, 5 different LGB models are finally trained. For easy distinction, they can be referred to as the first LGB model, the second LGB model, the third LGB model, the fourth LGB model, and the fifth LGB model.
[0096] Accordingly, step 104 can be represented as:
[0097] C3. Based on several trained LGB models, predict the defective material ratio of the target material to obtain several second defective material ratio sub-values. Merge these second defective material ratio sub-values to obtain the second defective material ratio value.
[0098] The fusion process can be specifically described as follows: each second bad component ratio sub-value is divided by the number of second bad component ratio sub-values (i.e., the number of trained LGB models obtained in step C2), and then all are summed. As an example, when 5 different LGB models are obtained, the second bad component ratio value can be expressed as follows:
[0099] y2=(y LGB1 +y LGB2+ y LGB3+ y LGB4+ y LGB5 ) / 5
[0100] Among them, y LGBi This represents the second defective material ratio sub-value of the i-th LGB model for the target material, for example, y LGB1 This represents the second defective material ratio sub-value of the first LGB model for the target material, and so on, which will not be elaborated here. It can be understood that i is a positive integer not greater than N, where N is the number of trained LGB models obtained in step C2.
[0101] The ensemble learning approach described above reduces the variance of the target machine learning model, thereby improving accuracy and generalization ability. It can be understood that steps B1-B3 have already yielded a trained target machine learning model, but its generalization ability may still have room for improvement. Steps C1-C2 are essentially retraining the target machine learning model. The trained target machine learning model obtained through steps C1-C2 typically has stronger generalization ability compared to the trained target machine learning model obtained through steps B1-B3.
[0102] In some embodiments, commonly used loss functions for regression problems are the L1 function (absolute value loss function) and the L2 function (squared loss function). For some manufacturers, it is desirable to adjust the preferences of the target machine learning model used based on business scenarios. For example, in some application scenarios, it is desirable to predict a higher defective material ratio (i.e., more reserve loss); in other application scenarios, it is desirable to predict a lower defective material ratio (i.e., less reserve loss). Based on this, embodiments of this application propose a custom loss function to adjust the preferences of the target machine learning model to meet business requirements. Therefore, after determining the target machine learning model, before putting it into use, the electronic device can also retrain or re-train the target machine learning model. It can be understood that retraining refers to training the original, untrained target machine learning model from scratch; re-training refers to further training the already trained target machine learning model. Taking retraining as an example, before step 104, the electronic device can perform the following operations:
[0103] D1. Optimize the loss function according to different application scenarios.
[0104] D2. Based on the optimized loss function, retrain the target machine learning model to obtain the retrained target machine learning model.
[0105] Accordingly, step 104 can be represented as:
[0106] D3. The second defective material ratio of the target material is predicted by the retrained target machine learning model.
[0107] Taking the target machine learning model as the LGB model, and the original loss function as the squared loss function as an example, when optimizing the loss function, the existence of the first and second derivatives must be satisfied.
[0108] The loss function before optimization can be expressed as:
[0109] Loss=(y 预测 -y 实际 ) 2
[0110] The optimized loss function can be expressed as:
[0111]
[0112] Among them, both a and b are coefficients, and there is no constraint relationship between a and b. When a > b, during the process of the electronic device training the LGB model using the optimized loss function, the penalty for the case where the predicted value is greater than or equal to the actual value is increased, thereby making the predicted value smaller; when a < b, during the process of the electronic device training the LGB model using the optimized loss function, the penalty for the case where the predicted value is less than the actual value is increased, thereby making the predicted value larger; when a = b, it is equivalent to the loss function before optimization, that is, the model preference is not adjusted. Only as an example, in the model training of actual business, a = 5 and b = 1 can be set to make the predicted value of the final LGB model larger, and the material reserve loss is increased with a smaller accuracy loss.
[0113] It can be understood that the process of performing ensemble learning on the target machine learning model by adopting the bagging method in the embodiments of this application can be combined with the optimized loss function. For example, during the process of performing ensemble learning on the target machine learning model by adopting the bagging method, when performing steps C1 and step C2, specifically, the target machine learning model (such as the LGB model) can be trained several times based on the optimized loss function to obtain several trained target machine learning models with adjusted and different preferences.
[0114] Only as an example, for the training of the machine learning model, there are several possible scenarios as follows:
[0115] In the first scenario, after the electronic device trains and screens out the target machine learning model through steps B1 - B3, the trained target machine learning model obtained at this time can be put into application.
[0116] In the second scenario, after the electronic device trains and screens out the target machine learning model through steps B1 - B3, the target machine learning model can be retrained through steps C1 - C2 again to obtain multiple different trained target machine learning models and put them into application. The application process can refer to step C3. Compared with the first scenario, this method improves the generalization ability of the target machine learning model.
[0117] In the third scenario, after the electronic device trains and screens out the target machine learning model through steps B1 - B3, the target machine learning model can be retrained through steps D1 - D2 again to obtain a trained target machine learning model with adjusted preference and put it into application. The application process can refer to step D3. Compared with the first scenario, this method adjusts the preference of the target machine learning model and can better meet the specific requirements of the business.
[0118] In the fourth scenario, after training and selecting the target machine learning model through steps B1-B3, the electronic device can retrain the target machine learning model again through steps C1-C2 combined with steps D1-D2 (that is, combining ensemble learning with the optimized loss function). This results in multiple trained target machine learning models with adjusted preferences, which can then be deployed. The application process can be referenced from steps C3 and D3. Compared to the first scenario, this approach not only improves the generalization ability of the target machine learning model but also adjusts its preferences, better meeting the specific needs of the business.
[0119] In some embodiments, to ensure that the target defective material ratio obtained by fusion is more realistic, step 105 may specifically include:
[0120] E1. Determine the optimal weighting combination for the target material. This optimal weighting combination includes the first weight corresponding to the first defective material ratio and the second weight corresponding to the second defective material ratio.
[0121] It can be understood that for any weight combination, the sum of the first and second weights in that combination is 1. Based on an understanding of business knowledge, it is generally assumed that materials of the same category share some similar characteristics; that is, materials of the same category tend to have more consistent preferences for the model. When fusing the prediction results output by the model, the fusion approach adopted is to apply different weights to the prediction results output by different models according to the material category.
[0122] As an example, for a certain material category (i.e., a certain type of material), let w be the weight of the prediction result of the target time series prediction model and w be the weight of the prediction result of the target machine learning model. Let w be 0.1, 0.2...0.9 respectively. Use grid search to find the weight combination that makes the MAE smaller and the win rate higher. This weight combination is the optimal weight combination for this material category.
[0123] As an example only, this application provides a material category-optimal weight combination lookup table, which describes the correspondence between material categories and optimal weight combinations. This material category-optimal weight combination lookup table can be described as follows:
[0124] As shown in Table 1:
[0125] Material Category First weight Second weight A <![CDATA[w A ]]> <![CDATA[1-w A ]]> B <![CDATA[w B ]]> <![CDATA[1-w B ]]> C <![CDATA[w C ]]> <![CDATA[1-w C ]]> … … …
[0126] Table 1
[0127] Considering the complexity of actual calculations, all materials can be pre-classified into two categories based on model preference: Category 1 materials, which are more inclined towards time series prediction models, and Category 2 materials, which are more inclined towards machine learning models. Category 1 materials perform better on time series prediction models, meaning that when predicting the defective proportion of Category 1 materials using time series prediction models, the results are relatively better. Category 2 materials perform better on machine learning models, meaning that when predicting the defective proportion of Category 2 materials using machine learning models, the results are relatively better. Similar to the scheme described above, electronic devices can use a grid search method for Category 1 and Category 2 materials respectively to obtain the optimal weight combination that results in a smaller MAE and a higher win rate. As an example only, this application provides a model preference category-optimal weight combination lookup table, describing the correspondence between model preference categories and optimal weight combinations. This model preference category-optimal weight combination lookup table is shown in Table 2 below:
[0128] Model Tendency Category First weight Second weight Category 1 <![CDATA[w1]]> <![CDATA[1-w1]]> Category 2 <![CDATA[w2]]> <![CDATA[1-w2]]>
[0129] The electronic device can first determine the model tendency category to which the target material belongs, and then find the optimal weight combination corresponding to the model tendency category to which the target material belongs by looking up the model tendency category-optimal weight combination lookup table. This optimal weight combination is the optimal weight combination adopted for the target material.
[0130] E2. Based on the first weight and the second weight, the first defective material ratio value and the second defective material ratio value are combined to obtain the target defective material ratio value.
[0131] As an example only, let w be the first weight in the optimal weight combination used for the target material. target The second weight is 1-w target Then the target defective material ratio value y final It can be determined using the following formula:
[0132] y final =y1*w target +y2*(1-w target )
[0133] It is understood that the electronic devices mentioned in the embodiments of this application can be ordinary personal computers (PCs), smartphones, or smart tablets, or they can be servers or server clusters. As an example only, the personal computer can execute the various steps of the embodiments of this application to directly obtain the target defective material ratio; alternatively, the personal computer can send a defective material prediction request to the server, which then executes the various steps of the embodiments of this application to obtain the target defective material ratio before pushing it back to the personal computer. The possible execution scenarios of the defective material prediction method are not elaborated here. That is, the embodiments of this application do not limit the executing entity (i.e., the electronic device) of the defective material prediction method.
[0134] As can be seen from the above, through the embodiments of this application, when predicting the defective material ratio, prediction is no longer done manually or using a single model. Instead, multiple models are used to predict from multiple perspectives, and the prediction results of multiple models are fused. The specific process is as follows: On the one hand, based on historical defective material data, at least two preset time series prediction models are validated to determine the target time series prediction model, wherein the time series prediction model is used to describe the law of change of defective material ratio over time; on the other hand, based on historical material data, at least two preset machine learning models are trained and validated to determine the target machine learning model, wherein the machine learning model is used to describe the relationship between defective material ratio and material characteristics. Then, not only can the first defective material ratio value of the target material be predicted through the target time series prediction model, but also the second defective material ratio value of the target material can be predicted through the target machine learning model. Finally, by fusing the first and second defective material ratio values, the target defective material ratio value of the target material can be obtained. The above process fully utilizes the black-box characteristics of machine learning and the trend of time series, significantly improving the accuracy of defective material prediction.
[0135] Corresponding to the defective material prediction method provided above, this application also provides a defective material prediction device. Please refer to... Figure 2 The defective material prediction device 200 includes:
[0136] The first determining module 201 is used to verify at least two preset time series prediction models based on historical defective material data, so as to determine the target time series prediction model, wherein the aforementioned time series prediction model is used to describe the law of change of defective material ratio over time.
[0137] The second determining module 202 is used to train and verify at least two preset machine learning models based on historical material data in order to determine the target machine learning model, wherein the machine learning model is used to describe the relationship between the proportion of defective materials and material characteristics.
[0138] The first prediction module 203 is used to predict the first defective material ratio of the target material through the above-mentioned target time series prediction model.
[0139] The second prediction module 204 is used to predict the second defective material ratio of the target material through the above-mentioned target machine learning model.
[0140] The fusion module 205 is used to fuse the first defective material ratio value and the second defective material ratio value to obtain the target defective material ratio value of the target material.
[0141] Optionally, the aforementioned historical defective material data includes: defective material data for various materials within each first historical time period; correspondingly, the aforementioned first determining module 201 includes:
[0142] The time series prediction result acquisition unit is used to perform predictions based on the first historical bad data by various time series prediction models mentioned above, and obtain the corresponding time series prediction results.
[0143] The target time series prediction model screening unit is used to select the target time series prediction model from at least two time series prediction models based on the above-mentioned time series prediction results, the second historical bad data and the preset first evaluation index.
[0144] The time period corresponding to the first historical defective data is earlier than the time period corresponding to the second historical defective data.
[0145] Optionally, the historical material data includes: material data for various types of materials within each second historical time period; correspondingly, the aforementioned second determining module 202 includes:
[0146] The data partitioning unit is used to divide the aforementioned historical material data into training set, test set, and validation set.
[0147] The machine learning model training unit is used to train various machine learning models based on the divided training set to obtain various trained machine learning models.
[0148] The target machine learning model screening unit is used to select the target machine learning model from the at least two trained machine learning models based on the previously divided validation set, the above-mentioned test set, and the preset second evaluation index.
[0149] Optionally, the aforementioned defective material prediction device 200 further includes:
[0150] The optimization module is used to optimize the loss function according to different application scenarios;
[0151] The retraining module is used to retrain the target machine learning model based on the optimized loss function to obtain the retrained target machine learning model.
[0152] Accordingly, the second prediction module is specifically used to predict the second defective material ratio of the target material through the retrained target machine learning model.
[0153] Optionally, the aforementioned fusion module 205 includes:
[0154] The optimal weight combination determination unit is used to determine the optimal weight combination adopted for the target material. The optimal weight combination includes the first weight corresponding to the first defective material ratio and the second weight corresponding to the second defective material ratio, wherein the sum of the first weight and the second weight is 1.
[0155] The defective material ratio fusion unit is used to fuse the first defective material ratio value and the second defective material ratio value according to the first weight and the second weight to obtain the target defective material ratio value.
[0156] Optionally, the above-mentioned optimal weight combination determination unit includes:
[0157] The model tendency category determination sub-unit is used to determine the model tendency category to which the above target material belongs;
[0158] The optimal weight combination determination sub-unit is used to determine the optimal weight combination for the target material based on the above model tendency category.
[0159] As can be seen from the above, through the embodiments of this application, when predicting the defective material ratio, prediction is no longer done manually or using a single model. Instead, multiple models are used to predict from multiple perspectives, and the prediction results of multiple models are fused. The specific process is as follows: On the one hand, based on historical defective material data, at least two preset time series prediction models are validated to determine the target time series prediction model, wherein the time series prediction model is used to describe the law of change of defective material ratio over time; on the other hand, based on historical material data, at least two preset machine learning models are trained and validated to determine the target machine learning model, wherein the machine learning model is used to describe the relationship between defective material ratio and material characteristics. Then, not only can the first defective material ratio value of the target material be predicted through the target time series prediction model, but also the second defective material ratio value of the target material can be predicted through the target machine learning model. Finally, by fusing the first and second defective material ratio values, the target defective material ratio value of the target material can be obtained. The above process fully utilizes the black-box characteristics of machine learning and the trend of time series, significantly improving the accuracy of defective material prediction.
[0160] Corresponding to the defective component prediction method provided above, this application also provides an electronic device. Please refer to... Figure 3 The electronic device 3 in this application embodiment includes: a memory 301, and one or more processors 302. Figure 3 (Only one is shown) and a computer program stored in memory 301 and executable on the processor. Memory 301 stores software programs and units. The processor 302 executes various functional applications and data processing by running the software programs and units stored in memory 301 to obtain resources corresponding to the aforementioned preset events. Specifically, the processor 302 performs the following steps when running the aforementioned computer program stored in memory 301:
[0161] Based on historical defective material data, at least two preset time series prediction models are validated to determine the target time series prediction model, wherein the aforementioned time series prediction model is used to describe the pattern of defective material ratio changing over time.
[0162] Based on historical material data, at least two preset machine learning models are trained and validated to determine the target machine learning model, wherein the machine learning model is used to describe the relationship between the proportion of defective materials and material characteristics.
[0163] The first defective material ratio of the target material is predicted by the above target time series prediction model;
[0164] The second defective material ratio of the target material is predicted by the above-mentioned machine learning model.
[0165] By combining the first defective material ratio value and the second defective material ratio value, the target defective material ratio value is obtained.
[0166] Assuming the above is the first possible implementation, in the second possible implementation based on the first possible implementation, the aforementioned historical defective material data includes: defective material data for various types of materials in each first historical time period; correspondingly, the above-mentioned verification of at least two preset time series prediction models based on the historical defective material data to determine the target time series prediction model includes:
[0167] The various time series prediction models mentioned above are based on the first historical defective data to make predictions and obtain the corresponding time series prediction results.
[0168] Based on the above-mentioned time series prediction results, the second historical bad data and the preset first evaluation index, the above-mentioned target time series prediction model is selected from at least two time series prediction models.
[0169] The time period corresponding to the first historical defective data is earlier than the time period corresponding to the second historical defective data.
[0170] In the third possible implementation provided based on the first possible implementation described above, the historical material data includes: material data for various types of materials within each second historical time period; correspondingly, the above-mentioned training and validation of at least two preset machine learning models based on the historical material data to determine the target machine learning model includes:
[0171] The aforementioned historical material data is divided into a training set, a test set, and a validation set;
[0172] Based on the divided training set, the various machine learning models are trained to obtain the various trained machine learning models.
[0173] Based on the defined validation set and the preset second evaluation metric, the target machine learning model is selected from the at least two trained machine learning models.
[0174] In the fourth possible implementation provided based on the first possible implementation described above, before the second defective material ratio value of the target material is predicted by the target machine learning model described above, the processor 302 further performs the following steps when running the computer program stored in the memory 301:
[0175] Optimize the loss function according to different application scenarios;
[0176] Based on the optimized loss function, the target machine learning model is retrained to obtain the retrained target machine learning model.
[0177] Accordingly, the second defective material ratio value of the target material predicted by the aforementioned target machine learning model includes:
[0178] The second defective material ratio of the target material is predicted by the retrained machine learning model.
[0179] In the fifth possible implementation provided based on the first possible implementation described above, the above-mentioned merging of the first defective material ratio value and the second defective material ratio value to obtain the target defective material ratio value includes:
[0180] The optimal weighting combination for the target material is determined. The optimal weighting combination includes the first weight corresponding to the first defective material ratio and the second weight corresponding to the second defective material ratio, wherein the sum of the first weight and the second weight is 1.
[0181] The target defective material ratio is obtained by combining the first defective material ratio and the second defective material ratio based on the first weight and the second weight.
[0182] In the sixth possible implementation provided based on the fifth possible implementation described above, the optimal weight combination used to determine the target material includes:
[0183] Determine the model preference category to which the above target materials belong;
[0184] Based on the above model's tendency category, determine the optimal weight combination for the target material.
[0185] It should be understood that, in the embodiments of this application, the processor 302 may be a central processing unit (CPU), but it may also be other general-purpose processors, digital signal processors (DSPs), application-specific integrated circuits (ASICs), field-programmable gate arrays (FPGAs), or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc. The general-purpose processor may be a microprocessor or any conventional processor.
[0186] Memory 301 may include read-only memory and random access memory, and provides instructions and data to processor 302. Some or all of memory 301 may also include non-volatile random access memory. For example, memory 301 may also store device category information.
[0187] As can be seen from the above, through the embodiments of this application, when predicting the defective material ratio, prediction is no longer done manually or using a single model. Instead, multiple models are used to predict from multiple perspectives, and the prediction results of multiple models are fused. The specific process is as follows: On the one hand, based on historical defective material data, at least two preset time series prediction models are validated to determine the target time series prediction model, wherein the time series prediction model is used to describe the law of change of defective material ratio over time; on the other hand, based on historical material data, at least two preset machine learning models are trained and validated to determine the target machine learning model, wherein the machine learning model is used to describe the relationship between defective material ratio and material characteristics. Then, not only can the first defective material ratio value of the target material be predicted through the target time series prediction model, but also the second defective material ratio value of the target material can be predicted through the target machine learning model. Finally, by fusing the first and second defective material ratio values, the target defective material ratio value of the target material can be obtained. The above process fully utilizes the black-box characteristics of machine learning and the trend of time series, significantly improving the accuracy of defective material prediction.
[0188] Those skilled in the art will clearly understand that, for the sake of convenience and brevity, the above-described division of functional units and modules is merely an example. In practical applications, the above functions can be assigned to different functional units and modules as needed, that is, the internal structure of the above device can be divided into different functional units or modules to complete all or part of the functions described above. The functional units and modules in the embodiments can be integrated into one processing unit, or each unit can exist physically separately, or two or more units can be integrated into one unit. The integrated unit can be implemented in hardware or as a software functional unit. Furthermore, the specific names of the functional units and modules are only for easy differentiation and are not intended to limit the scope of protection of this application. The specific working process of the units and modules in the above system can be referred to the corresponding process in the foregoing method embodiments, and will not be repeated here.
[0189] In the above embodiments, the descriptions of each embodiment have different focuses. For parts that are not described in detail or recorded in a certain embodiment, please refer to the relevant descriptions of other embodiments.
[0190] Those skilled in the art will recognize that the units and algorithm steps of the various examples described in conjunction with the embodiments disclosed herein can be implemented in electronic hardware, or a combination of external device software and electronic hardware. Whether these functions are implemented in hardware or software depends on the specific application and design constraints of the technical solution. Those skilled in the art can use different methods to implement the described functions for each specific application, but such implementation should not be considered beyond the scope of this application.
[0191] In the embodiments provided in this application, it should be understood that the disclosed apparatus and methods can be implemented in other ways. For example, the system embodiments described above are merely illustrative. For instance, the division of modules or units described above is only a logical functional division, and in actual implementation, there may be other division methods. For example, multiple units or components may be combined or integrated into another system, or some features may be ignored or not executed. Furthermore, the coupling or direct coupling or communication connection shown or discussed may be an indirect coupling or communication connection between devices or units through some interfaces, and may be electrical, mechanical, or other forms.
[0192] The units described above as separate components may or may not be physically separate. The components shown as units may or may not be physical units; that is, they may be located in one place or distributed across multiple network units. Some or all of the units can be selected to achieve the purpose of this embodiment according to actual needs.
[0193] If the integrated units described above are implemented as software functional units and sold or used as independent products, they can be stored in a computer-readable storage medium. Based on this understanding, all or part of the processes in the methods of the above embodiments can also be implemented by a computer program instructing associated hardware. The computer program can be stored in a computer-readable storage medium, and when executed by a processor, it can implement the steps of the various method embodiments described above. The computer program includes computer program code, which can be in the form of source code, object code, executable files, or certain intermediate forms. The computer-readable storage medium can include: any entity or device capable of carrying the computer program code, a recording medium, a USB flash drive, a portable hard drive, a magnetic disk, an optical disk, a computer-readable storage device, a read-only memory (ROM), a random access memory (RAM), an electrical carrier signal, a telecommunication signal, and a software distribution medium, etc. It should be noted that the contents of the aforementioned computer-readable storage media may be appropriately added to or subtracted from the contents according to the requirements of legislation and patent practice in the jurisdiction. For example, in some jurisdictions, according to legislation and patent practice, computer-readable storage media may not include electrical carrier signals and telecommunication signals.
[0194] The above embodiments are only used to illustrate the technical solutions of this application, and are not intended to limit them. Although this application has been described in detail with reference to the foregoing embodiments, those skilled in the art should understand that modifications can still be made to the technical solutions described in the foregoing embodiments, or equivalent substitutions can be made to some of the technical features. Such modifications or substitutions do not cause the essence of the corresponding technical solutions to deviate from the spirit and scope of the technical solutions of the embodiments of this application, and should all be included within the protection scope of this application.
Claims
1. A method for predicting defective materials, characterized in that, include: Based on historical defective material data, at least two preset time series prediction models are validated to determine the target time series prediction model, wherein the time series prediction model is used to describe the pattern of defective material ratio changing over time. Based on historical material data, at least two preset machine learning models are trained and validated to determine the target machine learning model. The historical material data has filtered out samples of salvageable materials with a defective material ratio of 0, and / or has filtered out abnormal samples with a defective material ratio greater than a preset threshold. The machine learning model is used to describe the relationship between the defective material ratio and material characteristics, and the defective material ratio label has been adjusted to a near-normal distribution through logarithmic processing. The first defective material ratio of the target material is predicted by the target time series prediction model. The second defective material ratio of the target material is predicted by the target machine learning model. By combining the first defective material ratio value and the second defective material ratio value, the target defective material ratio value is obtained. The step of predicting the second defective material ratio of the target material through the target machine learning model includes: training multiple target machine learning models using the same algorithm and different training sets through Bagging ensemble learning, and fusing the second defective material ratio sub-values predicted by each of the target machine learning models to obtain the second defective material ratio value.
2. The defective material prediction method as described in claim 1, characterized in that, The historical defective material data includes: defective material data for each material in each first historical time period; Accordingly, the process of validating at least two preset time series prediction models based on historical bad data to determine the target time series prediction model includes: Each of the aforementioned time series prediction models makes predictions based on the first historical defective material data, and obtains the corresponding time series prediction results. Based on the various time series prediction results, the second historical defect data, and the preset first evaluation index, the target time series prediction model is selected from the at least two time series prediction models; The time period corresponding to the first historical defective data is earlier than the time period corresponding to the second historical defective data.
3. The defective material prediction method as described in claim 1, characterized in that, The historical material data includes: material data for each material in each second historical time period; Accordingly, the process of training and validating at least two preset machine learning models based on historical material data to determine the target machine learning model includes: The historical material data is divided into a training set, a test set, and a validation set; The various machine learning models are trained based on the divided training set to obtain the various trained machine learning models. Based on the defined validation set, the test set, and the preset second evaluation metric, the target machine learning model is selected from the at least two trained machine learning models.
4. The defective material prediction method as described in claim 1, characterized in that, Before the second defective material ratio value of the target material is predicted by the target machine learning model, the defective material prediction method further includes: Optimize the loss function according to different application scenarios; Based on the optimized loss function, the target machine learning model is retrained to obtain the retrained target machine learning model. Accordingly, the step of predicting the second defective material ratio of the target material through the target machine learning model includes: The second defective material ratio of the target material is predicted by the retrained target machine learning model.
5. The defective material prediction method as described in claim 1, characterized in that, The process of fusing the first defective material ratio value and the second defective material ratio value to obtain the target defective material ratio value includes: The optimal weighting combination for the target material is determined. The optimal weighting combination includes a first weight corresponding to the first defective material ratio and a second weight corresponding to the second defective material ratio, wherein the sum of the first weight and the second weight is 1. The target defective material ratio is obtained by fusing the first defective material ratio value and the second defective material ratio value with the first weight and the second weight.
6. The defective material prediction method as described in claim 5, characterized in that, The determination of the optimal weight combination for the target material includes: Determine the model preference category to which the target material belongs; Based on the model's tendency category, determine the optimal weight combination for the target material.
7. A defective material prediction device, characterized in that, include: The first determining module is used to verify at least two preset time series prediction models based on historical defective material data, so as to determine the target time series prediction model, wherein the time series prediction model is used to describe the law of change of defective material ratio over time. The second determining module is used to train and validate at least two preset machine learning models based on historical material data to determine the target machine learning model. The historical material data has filtered out samples of salvageable materials with a defective material ratio of 0, and / or has filtered out abnormal samples with a defective material ratio greater than a preset threshold. The machine learning model is used to describe the relationship between the defective material ratio and material characteristics, and the defective material ratio label has been adjusted to a near-normal distribution through logarithmic processing. The first prediction module is used to predict the first defective material ratio of the target material through the target time series prediction model. The second prediction module is used to predict the second defective material ratio of the target material through the target machine learning model, including: training multiple target machine learning models using the same algorithm and different training sets through Bagging ensemble learning, and fusing the second defective material ratio sub-values predicted by each of the target machine learning models to obtain the second defective material ratio value. The fusion module is used to fuse the first defective material ratio value and the second defective material ratio value to obtain the target defective material ratio value.
8. The defective material prediction device as described in claim 7, characterized in that, The defective material prediction device also includes: The optimization module is used to optimize the loss function according to different application scenarios; The retraining module is used to retrain the target machine learning model according to the optimized loss function to obtain the retrained target machine learning model. Accordingly, the second prediction module is specifically used to predict the second defective material ratio of the target material through the retrained target machine learning model.
9. An electronic 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, it implements the method as described in any one of claims 1 to 6.
10. A computer-readable storage medium storing a computer program, characterized in that, When the computer program is executed by a processor, it implements the method as described in any one of claims 1 to 6.
Citation Information
Patent Citations
Method and device for predicting quality of machined part and computer equipment
CN111814385A
Material processing method and device, terminal equipment and storage medium
CN113283846A