A method for predicting machine tool processing energy consumption based on Hyperopt optimized neural network
Hyperopt is used to optimize the hyperparameters of the neural network and construct a BP neural network, which solves the problem of difficult hyperparameter tuning in traditional machine tool energy consumption modeling and achieves efficient and accurate machine tool processing energy consumption prediction. It is suitable for most CNC machine tools and reduces the cost of tuning. Consider time and cost.
Patent Information
- Application Number
- CN202410182816.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-02-19
- Publication Date
- 2024-09-03
- Estimated Expiration
- 2044-02-19
AI Technical Summary
Traditional machine tool energy consumption modeling methods are difficult to obtain or determine input quantities, resulting in limited prediction accuracy, and data-driven models have difficulties in hyperparameter tuning, leading to overfitting problems.
The optimization neural network method based on Hyperopt is used to construct a BP neural network to predict machine tool processing energy consumption through dynamic self-optimization of neural network hyperparameters. Hyperopt and TPE are used to optimize hyperparameters, reduce parameter adjustment time, and improve model performance.
It achieves highly accurate and rapid prediction of machine tool processing energy consumption, saves hyperparameter adjustment time, improves model performance, is suitable for most CNC machine tools, and reduces labor and time costs.
Smart Images

Figure CN118131689B
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of predicting machine tool processing energy consumption, and in particular to a method for predicting machine tool processing energy consumption based on Hyperopt optimized neural network. Background Art
[0002] CNC milling machines are one of the most widely used machine tools in today's manufacturing industry, and are used in all stages of production. The widespread use of CNC milling machines and the accompanying low energy efficiency issues make it important to develop an accurate and efficient energy consumption prediction system to reflect the energy consumption information of machine tools, which in turn is of great significance for subsequent efficiency research.
[0003] Machine tool processing is often accompanied by complex changes in tool-tool conditions such as physics, chemistry, and heat conduction. This makes it difficult to obtain or determine the input quantity of traditional machine tool energy consumption modeling methods, whether it is a mechanism or an empirical model of experiments, which limits the application scenarios of the model. In addition, since the continuous and complex processing process is idealized during the modeling process, the accuracy of the prediction is limited.
[0004] With the development of science and technology, the processing parameters and various data information generated during the processing can be continuously collected using corresponding sensors, enriching the available parameters in the field of machine tool research. Combined with the increasing maturity of various algorithms in the field of artificial intelligence, data-driven machine tool energy consumption research methods have emerged. Compared with physical models, data-driven models are easier to fit the functional relationship in complex processing processes when there is sufficient data, so their results are generally more accurate. However, although the data-driven model has high accuracy, its training requires a large amount of data, and overfitting is a common problem of data-driven methods. At the same time, the established models all contain corresponding hyperparameters. The adaptability of hyperparameters to the data-driven model is related to the performance of the entire model, and hyperparameter tuning has always been considered a difficult task. Summary of the invention
[0005] In view of the technical problems existing in the prior art, the present invention proposes a method for predicting the energy consumption of machine tool processing based on Hyperopt optimization neural network. This method constructs a dynamic self-optimizing neural network, obtains the optimal neural network hyperparameters in a short time, and then accurately predicts the energy consumption of machine tool processing. It has the characteristics of extremely high universality (applicable to most current CNC machine tools), saves test and parameter adjustment time, and has high prediction accuracy.
[0006] The present invention is implemented by the following technical scheme. The present invention proposes a method for predicting machine tool processing energy consumption based on Hyperopt optimization neural network, and the method comprises the following steps:
[0007] Step 1: During the machining process, perform material removal under different machining parameters and collect the machine energy consumption data for each material removal;
[0008] Step 2: Classify the data under different conditions collected in step 1, randomly select part of the data as the training set, and the rest as the validation set;
[0009] Step 3: Set the neural network structure;
[0010] Step 4: Build a hyperparameter search space based on Hyperopt, update the hyperparameters in the search space to the neural network structure in step 3, and perform model optimization training based on the training set;
[0011] Step 5: Randomly generate two different sets of hyperparameters during optimization training, generate two different sets of neural networks based on different hyperparameters, and calculate the loss based on the training set respectively;
[0012] Step 6: After step 5, the tree-based Bayesian optimizer TPE is introduced into the Hyperopt optimization. TPE determines to retain the optimal neural network hyperparameters based on the training loss. If the hyperparameters remain unchanged after 50 consecutive iterations or the current training step epoch_now is less than the set training step num_epoch, the loop is exited to output the optimal hyperparameters, otherwise the loop continues;
[0013] Step 7: Update the optimal hyperparameters output in step 6 to the neural network model constructed in step 3, and input the training set in step 2 to train the Hyperopt-neural network. The trained model is input into the validation set for model verification and prediction, and finally the machine tool processing energy consumption prediction result is obtained.
[0014] Furthermore, the neural network structure includes an input layer, a hidden layer, an output layer, a regularization term, an optimizer, an activation function, a loss function loss and a training step epoch.
[0015] Furthermore, in step 1, a certain model of three-axis CNC milling machine is used to process a certain workpiece material using a certain end mill to perform material removal under different processing conditions, including: the corresponding cutting depth, cutting width, feed speed, spindle speed and machine tool energy consumption corresponding to each cutting after each cutting length of 100 mm.
[0016] Furthermore, the neural network is a BP neural network, which adopts a five-layer structure, namely, 1 input layer, 3 hidden layers, and 1 output layer. The input layer contains 4 neural units including spindle speed, feed speed, cutting depth, and cutting width. The hidden layer contains n neural units. The output layer contains 1 neuron for predicting machine tool energy consumption. The hidden layer transfer function selects Relu function, the regularization term is Dropout, and the normalization method selects StandardScaler method. The optimization algorithm adopts RMSProp, the learning rate is set to α, the training step epoch is selected to 400 times, and the error loss function loss selects MSE.
[0017] Furthermore, in step 4, the hyperparameters of the BP neural network framework established in step 3 are optimized, and the number of hidden layer neurons n, learning rate α, and Dropout rate q in the BP neural network are selected as the optimized hyperparameters. The hyperparameter search space is constructed through Hyperopt, and the optimal hyperparameters are retained based on the judgment through TPE.
[0018] Furthermore, in step 4, the hyperparameter search space is a three-dimensional space, which includes the number of hidden layer neurons n, the learning rate α, and the Dropout rate q. Among them, the optimal hyperparameters are retained through TPE. To ensure efficiency, when the retained hyperparameters are still the optimal parameters after 50 iterations, the iteration is terminated and the optimal hyperparameters are output.
[0019] Furthermore, in step 5, the training set samples obtained in step 2 are input into the optimization model established in step 4, and the number of iterations is set to 500. In each iteration, the search space generates a set of hyperparameters to update the current neural network. The updated neural network obtains the loss through the training set, and the training error loss of the training set is compared with the training error loss of the previous iteration. If it is less than the previous error loss, the neural network hyperparameters are stored until the iteration ends, and the hyperparameters of the optimal neural network model under the number of iterations are obtained.
[0020] Furthermore, in step 6, the optimal hyperparameters output in step 5 are updated to the BP neural network model established in step 3, and the training set divided in step 2 is input for model training to obtain the optimal BP neural network machine tool energy consumption prediction model and save it.
[0021] The beneficial effects of the present invention can be summarized as follows:
[0022] 1. This invention predicts the energy consumption of machine tool processing by using Hyperopt to dynamically optimize the hyperparameters of the neural network. The neural network built is a BP neural network, which ensures the accuracy and speed of the prediction.
[0023] 2. The present invention uses the proposed optimization method to construct a hyperparameter search space and introduces TPE to achieve dynamic self-optimization of neural network hyperparameters. This greatly saves the time required for neural network hyperparameter adjustment and improves the performance of the neural network.
[0024] 3. The present invention uses machine tool processing parameters to predict machine tool energy consumption. The optimized neural network can complete training in a short time without the need for long-term testing; the required input information testing is simple, which can effectively reduce labor and time costs. BRIEF DESCRIPTION OF THE DRAWINGS
[0025] Figure 1 It is a flow chart of the Hyperopt optimization neural network method for predicting machine tool processing energy consumption.
[0026] Figure 2 This is the flowchart of Hyperopt optimizing neural network.
[0027] Figure 3 This is the energy consumption prediction graph of the neural network without optimizing the hyperparameters.
[0028] Figure 4 This is the energy consumption prediction diagram of the neural network after hyperparameter optimization. DETAILED DESCRIPTION
[0029] The technical solutions in the embodiments of the present invention will be described clearly and completely below in conjunction with the drawings in the embodiments of the present invention. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.
[0030] The present invention provides a method for predicting machine tool processing energy consumption based on Hyperopt optimization neural network. The method uses Hyperopt optimization neural network hyperparameters to predict machine tool processing energy consumption as a core method, and uses information such as cutting depth, cutting width, feed speed, spindle speed, etc. under different working conditions during machine tool processing to predict machine tool energy consumption through a neural network. Specifically, the method includes the following steps:
[0031] Step 1: During the machining process, perform material removal under different machining parameters and collect the machine energy consumption data for each material removal;
[0032] In step 1, a certain type of three-axis CNC milling machine is used to process a certain workpiece material with a certain end mill to perform material removal under different processing conditions, including: the corresponding cutting depth, cutting width, feed speed, spindle speed and machine tool energy consumption corresponding to each cutting after each cutting length of 100 mm;
[0033] Step 2: Classify the data under different conditions collected in step 1, randomly select part of the data as the training set, and the rest as the validation set;
[0034] Step 3: Setting the neural network structure; the neural network structure includes an input layer, a hidden layer, an output layer, a regularization term, an optimizer, an activation function, a loss function loss and a training step epoch;
[0035] Establish a BP neural network, including the number of network layers, the number of input layer neurons, the number of hidden layers, the number of output layer neurons, set the regularization term, optimizer, activation function, loss function, and training step epoch of the BP neural network.
[0036] The neural network is a BP neural network, which adopts a five-layer structure, namely, 1 input layer, 3 hidden layers, and 1 output layer. The input layer contains 4 neural units including spindle speed, feed speed, cutting depth, and cutting width. The hidden layer contains n (32 to 128) neural units. The output layer contains 1 neuron for predicting machine tool energy consumption. The hidden layer transfer function selects the Relu function, the regularization term is Dropout, and the normalization method selects the StandardScaler method. The optimization algorithm adopts RMSProp, the learning rate is set to α, the training step epoch is selected to be 400 times, and the error loss function loss selects MSE.
[0037] Step 4: Build a hyperparameter search space based on Hyperopt, update the hyperparameters in the search space to the neural network structure in step 3, and perform model optimization training based on the training set;
[0038] In step 4, the BP neural network framework established in step 3 is optimized for hyperparameters. The number of hidden layer neurons n, learning rate α, and Dropout rate q in the BP neural network are selected as the optimized hyperparameters. The hyperparameter search space is constructed through Hyperopt, and the optimal hyperparameters are retained based on the judgment through TPE.
[0039] The hyperparameter search space is a three-dimensional space, which includes the number of hidden layer neurons n (32-128), the learning rate α (0.0001-0.001), and the Dropout rate q (0.1-1). Among them, TPE is used to retain the optimal hyperparameters. To ensure efficiency, when the retained hyperparameters are still the optimal parameters after 50 iterations, the iteration is terminated and the optimal hyperparameters are output.
[0040] Step 5: Randomly generate two different sets of hyperparameters during optimization training, generate two different sets of neural networks based on different hyperparameters, and calculate the loss based on the training set respectively;
[0041] In step 5, the training set samples obtained in step 2 are input into the optimization model established in step 4, and the number of iterations is set to 500. In each iteration, the search space generates a set of hyperparameters to update the current neural network. The updated neural network obtains the loss through the training set. The training error loss of the training set is compared with the training error loss of the previous iteration. If it is less than the previous error loss, the neural network hyperparameters are stored until the iteration ends, and the hyperparameters of the optimal neural network model under the number of iterations are obtained.
[0042] Step 6: After step 5, the tree-based Bayesian optimizer TPE is introduced into the Hyperopt optimization. TPE determines to retain the optimal neural network hyperparameters based on the training loss. If the hyperparameters remain unchanged after 50 consecutive iterations or the current training step epoch_now is less than the set training step num_epoch, the loop is exited to output the optimal hyperparameters, otherwise the loop continues;
[0043] In step 6, the optimal hyperparameters output in step 5 are updated to the BP neural network model established in step 3, and the training set divided in step 2 is input for model training to obtain the optimal BP neural network machine tool energy consumption prediction model and save it.
[0044] Step 7: Update the optimal hyperparameters output in step 6 to the neural network model constructed in step 3, and input the training set in step 2 to train the Hyperopt-neural network. The trained model is input into the validation set for model verification and prediction, and finally the machine tool processing energy consumption prediction result is obtained.
[0045] In step 7, energy consumption prediction is performed on the optimal BP neural network machine tool energy consumption prediction model saved in step 6, and the verification set in step 2 is input to perform energy consumption prediction, so as to achieve accurate and efficient prediction of energy consumption of CNC machine tools.
[0046] Example:
[0047] First, this embodiment uses a three-axis CNC milling machine and a carbide end mill to process aluminum alloy to obtain energy consumption data for testing. The specific processing parameters are shown in Table 1:
[0048] Table 1. Processing parameters
[0049]
[0050] The aluminum alloy cutting length is 100mm, and the energy consumption data in the cutting process is calculated by the power meter. The full-factor experiment obtains 256 data sets. 80% of the data set is used as a training set, and 20% is used as a validation set to be substituted into the neural network for prediction.
[0051] Design a BP neural network with five layers, namely input layer, three hidden layers and output layer. The input layer includes four neural units, namely spindle speed (X1), feed speed (X2), cutting depth (X3) and cutting width (X4). The hidden layer contains n (32-128) neural units. The output layer contains one neuron for predicting machine tool energy consumption. The hidden layer transfer function selects Relu function, regularization term Dropout, and normalization method selects StandardScaler method. The optimization algorithm uses RMSProp, the learning rate is set to α, the training step epoch is selected as 400 times, and the error loss function loss selects MSE.
[0052] Substitute the above data used for network training and prediction into the training. The training and prediction process is as follows Figure 1 As shown in Figure 2 The performance comparison before and after optimization is shown in Figure 3 , 4 The hyperparameters of the neural network before optimization and the specific values after optimization are shown in Table 2.
[0053] Table 2. Hyperparameter values before and after optimization
[0054]
[0055] The above embodiments are only used to illustrate the present invention, but not to limit the present invention. Although the relevant embodiments and drawings of the present invention are disclosed for illustrative purposes, it can be understood by those skilled in the art that various substitutions, changes, and modifications are possible without departing from the spirit and scope of the present invention and the appended claims. Therefore, all equivalent technical solutions also belong to the scope of the present invention, and the patent protection scope of the present invention should be defined by the claims, and should not be limited to the contents disclosed in the best embodiment and the drawings.
Claims
1. A method for predicting machine tool processing energy consumption based on Hyperopt optimized neural network, characterized by: The method comprises the following steps: Step 1: During the machining process, perform material removal under different machining parameters and collect the energy consumption data of the machine tool for each material removal; Step 2: Classify the data under different conditions collected in step 1, randomly select some data as training set, and the rest as validation set; Step 3: Set up the neural network structure; Step 4: Build a hyperparameter search space based on Hyperopt, update the hyperparameters in the search space to the neural network structure in step 3, and perform model optimization training based on the training set; Step 5: Randomly generate two different sets of hyperparameters during optimization training, generate two different neural networks based on different hyperparameters, and calculate the loss based on the training set respectively; Step 6: After step 5, the tree-based Bayesian optimizer TPE is introduced into the Hyperopt optimization. TPE determines the optimal neural network hyperparameters based on the training loss. If the hyperparameters remain unchanged after 50 consecutive iterations or the current training step epoch_now is less than the set training step num_epoch, the loop is exited and the optimal hyperparameters are output. Otherwise, the loop continues. Step 7: Update the optimal hyperparameters output in step 6 to the neural network model constructed in step 3. At the same time, input the training set in step 2 to train the Hyperopt-neural network. Input the trained model into the validation set for model verification and prediction, and finally obtain the machine tool processing energy consumption prediction result; The neural network structure includes an input layer, a hidden layer, an output layer, a regularization term, an optimizer, an activation function, a loss function loss and a training step epoch; The neural network is a BP neural network, which adopts a five-layer structure, namely 1 input layer, 3 hidden layers, and 1 output layer. The input layer contains 4 neural units in total, namely spindle speed, feed speed, cutting depth, and cutting width. The hidden layer contains n neural units. The output layer contains 1 neuron for predicting machine tool energy consumption. The hidden layer transfer function selects the Relu function, the regularization term is Dropout, and the normalization method selects the StandardScaler method; the optimization algorithm adopts RMSProp, the learning rate is set to α, the training step epoch is selected as 400 times, and the error loss function loss selects MSE.
2. The method according to claim 1, characterized in that In step 1, a certain model of three-axis CNC milling machine is used to process a certain workpiece material using a certain end mill to perform material removal under different processing parameters, including: the corresponding cutting depth, cutting width, feed rate, spindle speed after each cutting length of 100 mm, and the corresponding machine tool energy consumption for each cutting.
3. The method according to claim 1, characterized in that In step 4, the hyperparameters of the BP neural network framework established in step 3 are optimized. The number of hidden layer neurons n, the learning rate α, and the Dropout rate q in the BP neural network are selected as the optimized hyperparameters. The hyperparameter search space is constructed through Hyperopt, and the optimal hyperparameters are retained based on the judgment through TPE.
4. The method according to claim 3, characterized in that In step 4, the hyperparameter search space is a three-dimensional space, which includes the number of hidden layer neurons n, the learning rate α, and the Dropout rate q. TPE is used to retain the optimal hyperparameters. To ensure efficiency, when the retained hyperparameters are still the optimal parameters after 50 iterations, the iteration is terminated and the optimal hyperparameters are output.
5. The method according to claim 4, characterized in that In step 5, the training set samples obtained in step 2 are input into the optimization model established in step 4, and the number of iterations is set to 500. In each iteration, the search space generates a set of hyperparameters to update the current neural network. The updated neural network obtains the loss through the training set. The training error loss of the training set is compared with the training error loss of the previous iteration. If it is less than the previous error loss, the neural network hyperparameters are stored until the iteration ends, and the hyperparameters of the optimal neural network model under the number of iterations are obtained.
6. The method according to claim 5, characterized in that In step 6, the optimal hyperparameters output in step 5 are updated to the BP neural network model established in step 3, and the training set divided in step 2 is input for model training. The optimal BP neural network machine tool energy consumption prediction model is obtained through training and saved.
Citation Information
Patent Citations
Road tunnel construction period surrounding rock deformation prediction method based on Bayes-LSTM model
CN113408190A
Denitration system inlet nitrogen oxide emission prediction method and system based on gated recurrent neural network
CN114896895A
Nuclear power material life prediction model and method of reverse neural propagation network
CN115048858A
Method and device for evaluating adsorption performance of metal organic framework on arsenic and related equipment
CN115049019A
Operation energy consumption monitoring system for digital twin numerical control machine tool
CN115562167A
