Magnetic separation current and product grade prediction method based on random forest algorithm
Through the multiple regression tree model based on the random forest algorithm, the problem of product grade control instability caused by experimental conditions and differences in raw ore quality in magnetic separation control is solved, and accurate prediction and stable control of magnetic separation current and product grade are achieved.
Patent Information
- Application Number
- CN202411842850.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-12-13
- Publication Date
- 2025-04-18
AI Technical Summary
In the prior art, it is difficult to effectively solve the problem of unstable product grade control caused by experimental conditions and differences in raw ore quality in magnetic separation control.
Using a method based on the random forest algorithm, the multi-regression tree model is constructed and historical data is used to predict magnetic separation current and product grade to achieve data-driven control of the magnetic separation process.
Accurate prediction of magnetic separation current and product grade is achieved, the stability and control accuracy of magnetic separation process are improved, and product grade can be predicted within the average error range of 5%.
Smart Images

Figure CN119848680A_ABST
Abstract
Description
Technical Field
[0001] The present invention belongs to the technical field of magnetic separation process quality control algorithms, and in particular relates to a method for predicting magnetic separation current and product grade based on a random forest algorithm. Background Art
[0002] Most of the iron ores in my country have the characteristics of low grade, fine embedded particle size, and complex intergrowth and packaging, which makes it difficult to enrich the minerals and the mineral processing indicators are not stable enough. Magnetic separation is an important process node in the mineral processing process of the mining industry. The grade of iron ore concentrate products can be controlled by adjusting the current of the vertical ring strong magnetic separator (excitation current control). Most of the research on controlling product grade through magnetic separation in the existing literature is based on experimental results, and these experiments have corresponding conditions and requirements, and the quality of the original ore will also affect the experimental results. Considering that there are many uncertain factors in reality, the same experiment may be difficult to reproduce in different scenarios. In these cases, experimental-based models may not be suitable for magnetic separation control.
[0003] Compared with traditional methods, data-driven methods do not need to refine the internal derivation process, but use historical data as the operation object to build mathematical relationships between data. Figure 1 , these models are based on historical data, and through some simple statistical methods, optimization methods, etc., they construct the mapping relationship between input and output, thereby realizing the nonlinear estimation of unknown samples with input samples, and their simple and efficient advantages are becoming more and more prominent. Magnetic separation is an important process node in the beneficiation process of Meishan Mining. The grade of iron ore concentrate products can be controlled by adjusting the current of the vertical ring strong magnetic separator. Meishan Mining's magnetic separation process consists of flotation (8 roughing machines and 4 scavenging machines form 4 groups of magnetic separation devices), and other adjustment points are re-selected. There are three of the four groups of devices in operation and one in reserve, and the input and output materials are the same batch. If the current needs to be adjusted, the dispatcher needs to give the adjustment value of each magnetic separator separately. At present, the roughing current and scavenging current are manually fine-tuned under stable conditions.
[0004] The core of the data-driven approach is data. A large amount of data will be recorded during the mineral processing process. As far as we know, there has been no research on using these historical data for magnetic separation control. Summary of the invention
[0005] The technical problem to be solved by the present invention is to provide a method for predicting magnetic separation current and product grade based on random forest algorithm in view of the shortcomings of the background technology.
[0006] The present invention adopts the following technical solutions to solve the above technical problems:
[0007] A method for predicting magnetic separation current and product grade based on random forest algorithm, specifically comprising the following steps;
[0008] Step 1, data preprocessing:
[0009] Step 2: The method of implementing prediction based on random forest is to construct multiple regression trees, that is, binary trees; for a regression problem, the input variables are recorded as x1, x2, …, x m , the target variables are denoted as y1,y2,…,y n ; with y i (i=1,2,…,n) as the objective function, using random forest, and using random forest to build a single regression tree model, as shown below:
[0010] y i =f(x1,x2,…,x m );
[0011] The impurity function used is:
[0012]
[0013] The specific algorithm steps of random forest are as follows:
[0014] Step 2.1, set the maximum number of trees n_trees, the maximum depth of the tree max_depth, the minimum impurity of node split min_impurity_split, and set h = 1;
[0015] Step 2.2, set the single regression tree node stop growth condition as follows: the tree reaches the maximum depth max_depth or the impurity of the node is less than min_impurity_split, hereinafter referred to as the stop growth condition;
[0016] Step 2.3: Randomly extract samples from the training set with replacement as training samples for a single regression tree, i.e. bootstrap sampling;
[0017] Step 2.4, select the optimal split variable features and split points: traverse all input variables k, where k = 1, ..., m, fix the input variable k, use the enumeration method to traverse all values of the input variable k in the current partition sample set, and obtain the optimal split variable and split point pair by solving the following formula
[0018]
[0019] in: The feature input space is represented by (k,l k ) is divided into two sub-areas, Respectively represent Y in the sub-region The value of ;
[0020] Step 2.5: If the regression tree meets the stop growth condition, go to step 2.6; otherwise, go to step 2.4 for each sub-region;
[0021] Step 2.6, calculate y i The value in each area is used as the predicted value of;
[0022] Step 2.7, h = h + 1; if h > n_trees, end the algorithm; otherwise, go to step 2.3;
[0023] Step 3, current prediction model, specifically includes the following steps:
[0024] Step 3.1, current prediction model based on random forest:
[0025] According to the input target grade index, the reference value of the excitation current adjustment of the two-stage magnetic separation is given; the data of the mineral phase, quick sample and acid slag obtained in the previous test are also used as input to establish the model;
[0026] Input: the last grinding mineral phase, grinding sample, acid slag test data, Fe, SiO2, P, S target grade values;
[0027] Output: current roughing and sweeping current data;
[0028] This problem can be regarded as a regression problem, which can be reduced to learning a mapping f, expressed as:
[0029] Roughing and scavenging current = f (mineral phase entering the mill, quick sample entering the mill, acid slag, Fe, SiO2, P, S)
[0030] The random forest regression algorithm is used, and the ratio of the training set to the test set is 9:1, that is, 90% of the data is used to train the model, and the remaining 10% of the data is not used in the training of the model, but only used to verify the model error; 10-fold cross validation is set, and the model with the best effect on the test set is retained; the mean absolute percentage error (MAPE) is used to evaluate the error, and the calculation formula is as follows:
[0031]
[0032] Step 3.2, model comparison:
[0033] Current predictions are made using the following models, including:
[0034] (1) Multiple linear regression model:
[0035] A multiple linear regression model is a linear regression model containing multiple explanatory variables, which is used to explain the linear relationship between the target variable and other multiple variables;
[0036] (2) Lasso regression:
[0037] Lasso regression is a compression estimation; it constructs a penalty function based on linear regression; this model is usually used to prevent overfitting problems caused by overly complex models. The loss function can be expressed as:
[0038]
[0039] Where MSE(θ) is a parameterized linear regression model loss function, α is the regularization parameter, and θ i represents the model parameters;
[0040] (3) Ridge regression:
[0041] When performing multiple linear regression, sometimes the coefficients obtained by least squares regression are unstable and have large variances due to collinearity between variables. The root cause is that the matrix obtained by multiplying the coefficient matrix with its transposed matrix cannot be inverted. This problem can be solved by ridge regression. Ridge regression adds an l2 regularization term to the linear regression model, which can also prevent the overfitting problem that may occur in the model. The loss function can be expressed as:
[0042]
[0043] Among them, MSE(θ) is a parameterized linear regression model loss function, α is the regularization parameter, and θ i represents the model parameters;
[0044] (4) Elastic Network:
[0045] The elastic network adds both l1 and l2 regularization terms to the linear regression model. The ratio of the two parts is controlled by a parameter. The loss function can be expressed as:
[0046]
[0047] Among them, MSE(θ) is a parameterized linear regression model loss function, α is the regularization parameter, γ represents the l1 regularization weight, and θ i represents the model parameters;
[0048] (5) Support Vector Regression:
[0049] Support vector regression is a support vector machine algorithm used to solve regression problems. It is an extension and application of support vector machines in regression estimation problems. The conclusions obtained by support vector machines for classification problems are extended to regression functions, which becomes support vector regression. It is usually used in time series prediction, nonlinear modeling and prediction, and optimization control.
[0050] Given training samples D = {(x1,y1),(x2,y2),…,(x N ,yN )},x i ∈R m ,y i ∈R, where m is the number of attribute features of the sample, y i is the value of the sample; a regression model f(x) = w is learned T x+b,w∈R m ,b∈R, where w and b are coefficients to be determined so that f(x) is as close as possible to the true output y;
[0051] Assume that we can tolerate a maximum deviation of ε between f(x) and y, that is, when the deviation is less than or equal to ε, the loss of the model is 0, and when the deviation is greater than ε, the loss caused by the deviation is calculated; the samples between the curve f(x)+ε and the curve f(x)-ε are not calculated for loss, and the samples outside are calculated for loss;
[0052] Then the SVR model is:
[0053]
[0054] where γ is the regularization constant, l ε It is the ε-insensititve loss function defined as follows:
[0055]
[0056] (6) Deep Neural Networks:
[0057] A deep neural network constructs a nonlinear mapping between input variables and output variables. It includes an input layer, a hidden layer, and an output layer. The hidden layer can have one or more layers. There is a unidirectional connection between layers, and no connection between layers.
[0059] Assume that the sample size of the training set is n, the number of neurons in the input layer is a, the number of neurons in the hidden layer is l, the number of neurons in the output layer is b, and the input of the training set is The training set output is Y, and the elements in Y are recorded as y ij , the network output is The elements are recorded as The weight matrix from the training layer to the hidden layer is W, the threshold vector of the hidden layer is θ, the weight matrix from the hidden layer to the output layer is V, and the threshold vector of the output layer is γ. Then the total number of parameters that need to be corrected in the network is N = a × l + l + l × b + b; the activation function is the tanh function, and the error matrix The performance indicator is selected as mean square error:
[0060]
[0061] Step 4, product grade prediction model:
[0062] Step 4.1, product grade prediction model based on random forest:
[0063] Input: the last test data of the mineral phase, quick sample and acid residue, and the current data of roughing and sweeping;
[0064] Output: Fe, SiO2, P, S grade prediction values;
[0065] The random forest regression algorithm is used, and the ratio of the training set to the test set is 9:1, that is, 90% of the data is used to train the model, and the remaining 10% of the data is not used in the training of the model, but only used to verify the model error; a 10-fold cross validation is set to retain the model with the best effect on the test set; the mean absolute percentage error MAPE is used to evaluate the error;
[0066] Step 4.2, model comparison:
[0067] Use the comparison model in the same way as in step 3.2 to predict product grade and record the test set error.
[0068] As a further preferred solution of the method for predicting magnetic separation current and product grade based on random forest algorithm of the present invention, the step 1 specifically comprises the following steps:
[0069] Step 1.1, read the filter sample data, regroup the data, the rows correspond to the detection time, and the columns correspond to the test indicator categories;
[0070] Step 1.2, read the mineral phase data of the mill;
[0071] Step 1.3, read the grinding sample, and average the test index results of different scans at the same time;
[0072] Step 1.4, reading acid residue;
[0073] Step 1.5, combine the data by time, and fill all the data with the previous value, that is, except for the filter fast sample data, that is, the currently input mill mineral phase, mill fast sample, and acid slag data are the last test results, to ensure that each indicator must have an input value when making a prediction at the current moment;
[0074] Step 1.6, read the current data, take the average of the rough selected current data, take the average of the scanned current data, round the current value, and integrate it according to the sorted test data time.
[0075] As a further preferred solution of the method for predicting magnetic separation current and product grade based on the random forest algorithm in the present invention, in step 3.2, the basic steps of using the LM algorithm to update the neural network weights are as follows:
[0076] Step 3.21, parameter initialization: Set the maximum number of training epochs max_epochs, target error e0, initial μ, μ increase factor μ_inc, μ decrease factor μ_dec, upper bound of μ μ_max;
[0077] Step 3.22, normalize the training data, and the normalized input and output matrices are X 0 , Y 0 ;
[0078] Step 3.23, randomly generate the initial weight matrix and threshold vector W (0) , V (0) , θ (0) , γ (0) , and set i = 0;
[0079] Step 3.24, calculate the current network output and error e (i) :
[0080]
[0081] If e (i) < e0, go to Step 9; otherwise, go to Step 5;
[0082] Step 3.25, represent the weight matrix and threshold vector as row vectors The error matrix E V (i) is represented as a vector Calculate the Jacobian matrix J of the error matrix with respect to all weights and thresholds (i) ;
[0083] Step 3.26, update the weights and thresholds according to Equation (3.6);
[0084]
[0085] Step 3.27, use the updated weights and thresholds to calculate the network error e (i) ′, if e (i) ′ < e (i) , then update μ with μ × μ_dec and go to Step 8; if e (i) ′ ≥ e (i) , then update μ with min{μ_max, μ × μ_inc} and go to Step 6;
[0086] Step 3.28, i=i+1, if i≤max_epochs, go to Step 5; otherwise, go to Step 9;
[0087] Step 3.29, W = W (i) , V = V (i) , θ=θ (i) , γ=γ (i) , output network weights and thresholds.
[0088] Compared with the prior art, the present invention adopts the above technical solution and has the following technical effects:
[0089] The present invention provides a method for predicting magnetic separation current and product grade based on a random forest algorithm. Numerical experiments show that the random forest algorithm performs well on these two problems. For a given current, the average error of predicting product grade can be within 5%, while for a given product grade, the average error of predicting current is relatively large. Considering that the performance of machine learning algorithms is closely related to the amount of data to a certain extent, and the existing amount of data is small, when more data is collected and applied to model patrols in the future, theoretically the performance of the model can be further improved. In addition, feature selection is also an important factor affecting the prediction effect. When more influencing factors are collected and involved in model training, theoretically the model performance will also be improved to a certain extent. BRIEF DESCRIPTION OF THE DRAWINGS
[0090] In order to more clearly illustrate the embodiments of the present application or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present application. For those skilled in the art, other drawings can be obtained based on these drawings without paying any creative work.
[0091] Figure 1 It is the schematic diagram of the data-driven magnetic separation control model;
[0092] Figure 2 It is the collation of test data;
[0093] Figure 3 It is the collation of all experimental data;
[0094] Figure 4 This is the random forest algorithm flow chart;
[0095] Figure 5 It is a schematic diagram of cross validation;
[0096] Figure 6 (a) Comparison between the actual value and the predicted value of the rough selection current;
[0097] Figure 6(b) Comparison between the actual value and the predicted value of the sweep current;
[0098] Figure 7 is a schematic diagram of support vector regression;
[0099] Figure 8 It is a neuron model;
[0100] Fig. 9 is the predicted current error;
[0101] Figure 10 (a) Comparison of the actual value and predicted value of Fe;
[0102] Figure 10(b) Comparison between the actual value and predicted value of SiO2;
[0103] Figure 10(c) P comparison between true value and predicted value;
[0104] Figure 10 (d) Comparison of the actual value and predicted value of S;
[0105] Fig.11 It is the comparison between the actual value and the predicted value of the predicted product grade test set;
[0106] Figure 12(a) is the export qualification rate of the original data set sample graph;
[0107] Figure 12(b) shows the domestic sales pass rate of the original data set samples. DETAILED DESCRIPTION
[0108] The technical solution of the present invention is further described in detail below in conjunction with the accompanying drawings:
[0109] The following will be combined with the drawings in the embodiments of the present invention to clearly and completely describe the technical solutions in the embodiments of the present invention. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments in 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. The present invention is described in detail below based on the drawings and preferred embodiments, and the purpose and effect of the present invention will become clearer. It should be understood that the specific embodiments described here are only used to explain the present invention and are not used to limit the present invention.
[0110] The core of the data-driven approach is data. A large amount of data will be recorded during the mineral processing process. As far as we know, there is no research on using these historical data for magnetic separation control. Based on the historical data recorded during the mineral processing process, this paper conducts the following research:
[0111] (1) According to the target grade index, the reference value of the excitation current adjustment of the two-stage magnetic separation is given;
[0112] (2) Predict the possible grade of the ore under the current excitation current conditions.
[0113] 1. Data preprocessing
[0114] Most of the data recorded in the database cannot be used directly, and are not directly corresponding in time. It is necessary to preprocess the data read from the database. The specific steps are as follows:
[0115] Step 1: Read the filter fast sample data. Since the filter fast sample data time is 20 minutes slower than the magnetic separation data, and the response time is 2 hours later, +20min-2h later it corresponds to the current data time. Recombine the data, the rows correspond to the detection time, and the columns correspond to the test index categories. Since the current data is full-minute data, the filter fast sample data is also converted into full-minute data here for easy correspondence. If the same indicator is repeatedly measured at the same time, the average is taken. After sorting, it is shown in Table 1. Table 1 is the filter fast sample data, a total of 2141 data:
[0116] Table 1
[0117]
[0118] Step 2: Read the mineral phase data of the mill and sort them out as shown in Table 2. Table 2 is a total of 89 data of mineral phase data of the mill:
[0119] Table 2
[0120]
[0121]
[0122] Step 3: Read the milling fast sample, take the average of the test index results of different scans at the same time, and sort them out as shown in Table 3. Table 3 is the milling fast sample data, a total of 722 data:
[0123] Table 3
[0124]
[0125] Step 4: Read the acid residue and sort it out as shown in Table 4. Table 4 is the acid residue data, a total of 318 data:
[0126] Table 4
[0127]
[0128] Step 5: Combine the above four parts of data by time, and use the previous value to fill all data (except the filter fast sample data), that is, the current input of the grinding mineral phase, grinding fast sample, and acid slag data are the results of the last test, to ensure that each indicator must have an input value when predicting at the current moment. After sorting, a total of 2114 data are included, such as Figure 2 As shown:
[0129] Step 6: Read the current data, take the average of the first 8 groups of rough current data, and take the average of the 9th to 12th groups of scan current data. In order to facilitate the adjustment of the current, the current value is rounded and integrated according to the sorted test data time, a total of 2004 data, such as Figure 3 As shown:
[0130] 2. Preliminary knowledge
[0131] 2.1 Random Forest
[0132] The method used for research contents (1) and (2) is random forest, which was first proposed by Leo Breiman and Adele Cutler. Random forest belongs to a branch of machine learning - ensemble learning. The basic idea of ensemble learning is to build a strong model by constructing multiple weak models, thereby improving the accuracy of model classification or reducing fitting errors. In random forest, each weak model is a decision tree. Random forest has the ability to analyze complex interactive classification features. As an emerging machine learning algorithm, random forest has a wide range of applications in classification, regression, prediction and outlier detection because of its high accuracy, fast training speed and good robustness.
[0133] The method used in this paper to achieve prediction based on random forest is to construct multiple regression trees, that is, binary trees. For a regression problem, the input variables are recorded as x1, x2, …, x m , the target variables are denoted as y1,y2,…,y n . i (i=1,2,…,n) as the objective function, using random forest, and using random forest to build a single regression tree model is as follows:
[0134] y i =f(x1,x2,…,x m )
[0135] The impurity function used is:
[0136]
[0137] The specific algorithm steps of random forest are as follows:
[0138] Step 1: Set the maximum number of trees n_trees, the maximum depth of a tree max_depth, and the minimum impurity of node splitting min_impurity_split. Set h = 1;
[0139] Step 2: Set the stop growth condition for a single regression tree node as follows: the tree reaches the maximum depth max_depth or the impurity of the node is less than min_impurity_split, hereinafter referred to as the stop growth condition;
[0140] Step 3: Randomly extract samples from the training set with replacement as training samples for a single regression tree (i.e. bootstrap sampling);
[0141] Step 4: Select the optimal splitting variable (feature) and splitting point: traverse all input variables k (k = 1, ..., m), fix the input variable k, use the enumeration method to traverse all values of the input variable k in the current partition sample set, and obtain the optimal splitting variable and splitting point pair by solving the following formula:
[0142]
[0143] in: The feature input space is represented by (k,l k ) is divided into two sub-areas, Respectively represent Y in the sub-region The value of ;
[0144] Step 5: If the regression tree meets the stop growth condition, go to Step 6; otherwise, go to Step 4 for each sub-region;
[0145] Step 6: Calculate y i The value in each area is used as the predicted value of;
[0146] Step 7: h=h+1; if h>n_trees, end the algorithm; otherwise, go to Step 3.
[0147] The basic flow chart of the random forest algorithm is as follows Figure 4 shown.
[0148] 2.2 Cross Validation
[0149] Considering the small number of existing samples, this paper adopts the cross-validation method to divide the original data set and train the model to select the model with the best generalization ability on unknown data, such as Figure 5 As shown, the steps of 10-fold cross validation are as follows:
[0150] Step 1: Randomly divide the original data into 10 parts;
[0151] Step 2: Use 9 of the data as training sets to obtain the training model, and use the remaining 1 data as the test set and calculate the test error;
[0152] Step 3: Repeat Step 2 to obtain 10 models and 10 test errors;
[0153] Step 4: Select the model with the smallest test error.
[0154] 3. Current prediction model
[0155] 3.1 Current prediction model based on random forest
[0156] According to the target grade index passed in, the reference value of the excitation current adjustment of the two-stage magnetic separation is given. Considering that the mineral phase, quick sample, acid slag, etc. entering the mill may have an impact on the current, and this part of the data may not be detected in time, and these data do not change much between two consecutive times, in order to ensure that each time has corresponding data as input, the mineral phase, quick sample, and acid slag data obtained from the last detection are also used as input to establish the model.
[0157] Input: The analysis data of the last grinding mineral phase, the grinding quick sample, the acid slag, and the target grade values of Fe, SiO2, P, and S.
[0158] Output: current roughing and scanning current data.
[0159] This problem can be viewed as a regression problem, which can be reduced to learning a mapping f, expressed as:
[0160] Roughing and scavenging current = f (mineral phase entering the mill, quick sample entering the mill, acid slag, Fe, SiO2, P, S)
[0161] The random forest regression algorithm is used, and the ratio of the training set to the test set is 9:1, that is, 90% of the data is used to train the model, and the remaining 10% of the data is not used in the training of the model, but only used to verify the model error; a 10-fold cross validation is set, and the model with the best effect on the test set is retained. The mean absolute percentage error (MAPE) is used to evaluate the error, and the calculation formula is as follows:
[0162]
[0163] The results are shown in Table 5: Table 5 is the current prediction model error:
[0164] Table 5
[0165] Current Rough Selection Scan Mean error 4.22% 14.71% 9.47%
[0166] The true value of the test set and the predicted result are plotted in a coordinate system, where the horizontal axis corresponds to the sample number and the vertical axis corresponds to the current value, as shown in Figure 6. Figure 6 compares the true value of the predicted current test set with the predicted value. The blue point corresponds to the true value and the red point corresponds to the predicted value:
[0167] It should be pointed out that for the coarse current, the range of the ordinate is 400-1000. It can be seen that the predicted value has a good simulation of the true value, and the fitting error reaches 4.22%; for the sweep current, the fitting error is larger, which is 14.71%.
[0168] 3.2 Model comparison
[0169] In order to show that the random forest model performs well in predicting current, this section uses the following models to predict current, including:
[0170] (1) Multiple Linear Regression Model
[0171] A multiple linear regression model is a linear regression model containing multiple explanatory variables, which is used to explain the linear relationship between the target variable and multiple other variables.
[0172] (2) Lasso regression
[0173] Lasso regression is a compression estimation. It constructs a penalty function based on linear regression. This model is usually used to prevent overfitting problems caused by overly complex models. The loss function can be expressed as:
[0174]
[0175] Where MSE(θ) is a parameterized linear regression model loss function, α is the regularization parameter, and θ i Represents model parameters.
[0176] (3) Ridge regression
[0177] When performing multiple linear regression, sometimes the coefficients obtained by least squares regression are unstable and have large variances due to collinearity between variables. The root cause is that the matrix obtained by multiplying the coefficient matrix with its transposed matrix cannot be inverted. This problem can be solved by ridge regression. Ridge regression adds an l2 regularization term to the linear regression model, which can also prevent the overfitting problem that may occur in the model. The loss function can be expressed as:
[0178]
[0179] Where MSE(θ) is a parameterized linear regression model loss function, a is the regularization parameter, and θ i Represents model parameters.
[0180] (4) Elastic Network
[0181] The elastic network adds both l1 and l2 regularization terms to the linear regression model. The ratio of the two parts is controlled by a parameter. The loss function can be expressed as:
[0182]
[0183] Where MSE(θ) is a parameterized linear regression model loss function, α is the regularization parameter, γ represents the l1 regularization weight, and θ i Represents model parameters.
[0184] (5) Support Vector Regression
[0185] Support vector regression is a support vector machine algorithm used to solve regression problems. It is an extension and application of support vector machines in regression estimation problems. Extending the conclusions of support vector machines for classification problems to regression functions becomes support vector regression, which is usually used in time series prediction, nonlinear modeling and prediction, optimization control, etc.
[0186] Given training samples D = {(x1,y1),(x2,y2),…,(x N ,y N )},x i ∈R m ,y i ∈R, where m is the number of attributes (features) of the sample, y i is the value of the sample. We hope to learn a regression model f(x) = w T x+b,w∈R m ,b∈R, where w and b are coefficients to be determined so that f(x) is as close as possible to the true output y.
[0187] Assume that we can tolerate a maximum deviation of ε between f(x) and y, that is, when the deviation is less than or equal to ε, the model loss is 0, and when the deviation is greater than ε, we calculate the loss caused by the deviation. Figure 7 As shown, the samples between the curve f(x)+ε and the curve f(x)-ε do not calculate the loss, and the samples outside of the curve calculate the loss.
[0188] Then the SVR model is:
[0189]
[0190] where γ is the regularization constant, l ε It is the ε-insensititve loss function defined as follows:
[0191]
[0192] (6) Deep Neural Networks
[0193] A deep neural network constructs a nonlinear mapping between input variables and output variables. It consists of an input layer, a hidden layer, and an output layer. The hidden layer can have one or more layers. There is a one-way connection between layers, and no connection between layers. Through training with sample data, the network weights and thresholds are constantly corrected to make the error function decrease along the negative gradient direction and approach the expected output. A simple neuron model such as Figure 8 shown.
[0194] The training algorithm for multi-layer networks was first proposed by Paul Werbos in 1974. It was not until the mid-1980s that the back propagation method (BP algorithm) became widely known. The most primitive back propagation method uses the gradient descent method to update the weights and thresholds of the network. However, because this algorithm leads to long training time, easy to fall into the local optimal solution and possible overfitting, it is rarely used in solving practical problems. However, some variations of the back propagation algorithm can significantly improve the efficiency and accuracy of the algorithm, making the back propagation algorithm more widely used.
[0195] Assume that the sample size of the training set is n, the number of neurons in the input layer is a, the number of neurons in the hidden layer is l, the number of neurons in the output layer is b, and the input of the training set is The training set output is Y, and the elements in Y are recorded as y ij , the network output is The element is denoted by The weight matrix from the training layer to the hidden layer is W, the threshold vector of the hidden layer is θ, the weight matrix from the hidden layer to the output layer is V, and the threshold vector of the output layer is γ. The total number of parameters that need to be corrected in the network is N = a × l + l + l × b + b. The activation function is the tanh function, and the error matrix is The performance indicator is selected as mean square error:
[0196]
[0197] The basic steps for updating the neural network weights using the LM algorithm are as follows:
[0198] Step 1: Parameter initialization: set the maximum number of training times max_epochs, target error e0, initial μ, μ increase factor μ_inc, μ decrease factor μ_dec, and upper bound μ_max of μ;
[0199] Step 2: Normalize the training data. The normalized input and output matrices are X 0 , Y 0 ;
[0200] Step 3: Randomly generate the initial weight matrix and threshold vector W (0) ,V(0) , θ (0) , γ (0) , set \(i = 0\);
[0201] Step 4: Calculate the current network output and the error \(e\) (i) :
[0202]
[0203] If \(e\) (i) \(< e_0\), go to Step 9; otherwise, go to Step 5;
[0204] Step 5: Represent the weight matrix and threshold vector as row vectors The error matrix \(E\) V (i) Represent as a vector Calculate the Jacobian matrix \(J\) of the error matrix with respect to all weights and thresholds (i) ;
[0205] Step 6: Update the weights and thresholds according to Equation (3.6);
[0206]
[0207] Step 7: Calculate the network error \(e'\) using the updated weights and thresholds. If \(e'\) (i) \(< e\) (i) ', then update \(\mu\) with \(\mu\times\mu_{dec}\), go to Step 8; if \(e'\) (i) \(\geq e\) (i) ', then update \(\mu\) with \(\min\{\mu_{max},\mu\times\mu_{inc}\}\), go to Step 6; (i)
[0208] Step 8: \(i = i + 1\). If \(i\leq max\_epochs\), go to Step 5; otherwise, go to Step 9;
[0209] Step 9: \(W = W\) (i) , \(V = V\) (i) , \(\theta=\theta\) (i) , \(\gamma=\gamma\) (i) , output the network weights and thresholds.
[0210] Use the above method for current prediction and record the test set error. The results are shown in Table 6:
[0211] Table 6 Comparison of Predicted Current Errors
[0212]
[0213] It can be seen that compared with other regression models given, the random forest model has the smallest error in predicting current, which is 9.47%.
[0214] 4. Product grade prediction model
[0215] 4.1 Product grade prediction model based on random forest
[0216] This section focuses on research content (2). Under the current excitation current condition, predict the possible grade index of the ore. As in Section 3.1, considering that the mineral phase, quick sample, acid slag, etc. entering the mill may have an impact on the product grade, in order to ensure that there is corresponding data as input each time, the mineral phase, quick sample, and acid slag data obtained from the last test are also used as input to establish the model.
[0217] Input: The last test data of the mineral phase, the quick sample and the acid residue, the current data of the roughing and scavenging. Output: Fe, SiO2, P, S grade prediction values.
[0218] The random forest regression algorithm is used, and the ratio of the training set to the test set is 9:1, that is, 90% of the data is used to train the model, and the remaining 10% of the data is not used in the training of the model, but only used to verify the model error; a 10-fold cross validation is set, and the model with the best effect on the test set is retained. The mean absolute percentage error (MAPE) is used to evaluate the error.
[0219] The error of the test set of the optimal model is shown in Table 7, which is the error of the product grade prediction model. The results are shown in Table 7:
[0220] Table 7
[0221]
[0222] The true value and predicted result of the test set are plotted in the coordinate system, where the horizontal axis corresponds to the sample number and the vertical axis corresponds to the sample grade index content value, as shown in Figure 10. The blue points correspond to the true values and the red points correspond to the predicted values:
[0223] As can be seen from Figure 10, the vertical coordinate range of Fe is 52-59, and the fitting effect is the best, with an error of 0.52%. The peak values of the other three indicators are also basically consistent, with an average error of 2.56%.
[0224] 4.2 Model Comparison
[0225] The comparison model used is the same as that in Section 3.2. The product grade is predicted and the test set error is recorded. Table 8 is a comparison of the predicted product grade error. The results are shown in Table 8:
[0226] Table 8
[0227]
[0228] It can be seen that compared with other regression models given, the random forest model has the smallest error in predicting product grade, which is 2.56%.
[0229] 5. Qualification rate analysis
[0230] Iron grade is the key indicator that determines the selling price of products, and the rest are harmful substances in steelmaking. Meishan Mining products are divided into domestic sales and export sales, which currently correspond to different indicators. Product sales conditions are shown in Table 9:
[0231] Table 9
[0232] Fe SiO2 P S Export 56.8-57.2 <5.7 <0.4 <0.12 Domestic sales 56.2-56.8 <6 0.38-0.42 <0.15
[0233] The number of qualified samples per day was counted, and the proportion of the number of qualified samples per day to the total number of samples on that day was calculated. The average qualified rate for export was 3.05%, and the average qualified rate for domestic sales was 2.6%. It can be seen that the qualified rate is low, with a maximum of no more than 40%. The qualified situation of samples per day is shown in Figure 12 (a) (b): Based on the random forest algorithm, the magnetic separation current and product grade prediction research was carried out. Numerical experiments show that the random forest algorithm performs well on these two problems. Given the current, the average error of the predicted product grade can be within 5%, while given the product grade, the average error of the predicted current is larger. Considering that the performance of machine learning algorithms is closely related to the amount of data to a certain extent, and the existing data volume is small, when more data is collected and applied to the model patrol in the future, the performance of the model can be further improved in theory. In addition, feature selection is also an important factor affecting the prediction effect. When more influencing factors are collected and involved in model training, the performance of the model will also be improved in theory.
[0234] Those skilled in the art can understand that the above are only preferred examples of the invention and are not intended to limit the invention. Although the invention is described in detail with reference to the above examples, those skilled in the art can still modify the technical solutions recorded in the above examples or replace some of the technical features with equivalents. Any modification, equivalent replacement, etc. made within the spirit and principle of the invention should be included in the protection scope of the invention. All technical features in this embodiment can be freely combined according to actual needs.
[0235] Finally, it should be noted that the above is only a preferred embodiment of the present invention and is not intended to limit the present invention. Although the present invention has been described in detail with reference to the aforementioned embodiments, it is still possible for those skilled in the art to modify the technical solutions described in the aforementioned embodiments or to make equivalent substitutions for some of the technical features therein. Any modifications, equivalent substitutions, improvements, etc. made within the spirit and principles of the present invention should be included in the protection scope of the present invention.
Claims
1. A method for predicting magnetic separation current and product grade based on random forest algorithm, characterized in that: The specific steps include: Step 1, data preprocessing: Step 2: The method of implementing prediction based on random forest is to construct multiple regression trees, that is, binary trees; for a regression problem, the input variables are recorded as x1, x2, …, x m , the target variables are denoted as y1,y2,…,y n ; with y i (i=1,2,…,n) as the objective function, using random forest, and using random forest to build a single regression tree model, as shown below: y i =f(x1,x2,…,x m ): The impurity function used is: The specific algorithm steps of random forest are as follows: Step 2.1, set the maximum number of trees n_trees, the maximum depth of the tree max_depth, the minimum impurity of node splitting min_impurity_split, and set h = 1; Step 2.2, set the single regression tree node stop growth condition as follows: the tree reaches the maximum depth max_depth or the impurity of the node is less than min_impurity_split, hereinafter referred to as the stop growth condition; Step 2.3: Randomly extract samples from the training set with replacement as training samples for a single regression tree, i.e. bootstrap sampling; Step 2.4, select the optimal split variable features and split points: traverse all input variables k, where k = 1, ..., m, fix the input variable k, use the enumeration method to traverse all values of the input variable k in the current partition sample set, and obtain the optimal split variable and split point pair by solving the following formula in: The feature input space is represented by (k,l k ) is divided into two sub-areas, Respectively represent Y in the sub-region The value of ; Step 2.5: If the regression tree meets the stop growth condition, go to step 2.6; otherwise, go to step 2.4 for each sub-region; Step 2.6, calculate y i The value in each area is used as the predicted value of; Step 2.7, h = h + 1; if h > n_trees, end the algorithm; otherwise, go to step 2.3; Step 3, current prediction model, specifically includes the following steps: Step 3.1, current prediction model based on random forest: According to the input target grade index, the reference value of the excitation current adjustment of the two-stage magnetic separation is given; the data of the mineral phase, quick sample and acid slag obtained in the previous test are also used as input to establish the model; Input: the last grinding mineral phase, grinding sample, acid slag test data, Fe, SiO2, P, S target grade values; Output: current roughing and sweeping current data; This problem can be regarded as a regression problem, which can be reduced to learning a mapping f, expressed as: Roughing and scavenging current = f (mineral phase entering the mill, quick sample entering the mill, acid slag, Fe, SiO2, P, S) The random forest regression algorithm is used, and the ratio of the training set to the test set is 9:1, that is, 90% of the data is used to train the model, and the remaining 10% of the data is not used in the training of the model, but only used to verify the model error; 10-fold cross validation is set, and the model with the best effect on the test set is retained; the mean absolute percentage error (MAPE) is used to evaluate the error, and the calculation formula is as follows: Step 3.2, model comparison: Current predictions are made using the following models, including: (1)Multivariate linear regression model: A multiple linear regression model is a linear regression model containing multiple explanatory variables, which is used to explain the linear relationship between the target variable and other multiple variables; (2) Lasso regression: Lasso regression is a compression estimation; it constructs a penalty function based on linear regression; this model is usually used to prevent overfitting problems caused by overly complex models. The loss function can be expressed as: Where MSE(θ) is a parameterized linear regression model loss function, α is the regularization parameter, and θ i represents the model parameters; (3) Ridge regression: When performing multiple linear regression, sometimes the coefficients obtained by least squares regression are unstable and have large variances due to collinearity between variables. The root cause is that the matrix obtained by multiplying the coefficient matrix with its transposed matrix cannot be inverted. This problem can be solved by ridge regression. Ridge regression adds an l2 regularization term to the linear regression model, which can also prevent the overfitting problem that may occur in the model. The loss function can be expressed as: Among them, MSE(θ) is a parameterized linear regression model loss function, α is the regularization parameter, and θ i represents the model parameters; (4) Elastic Network: The elastic network adds both l1 and l2 regularization terms to the linear regression model. The ratio of the two parts is controlled by a parameter. The loss function can be expressed as: Among them, MSE(θ) is a parameterized linear regression model loss function, α is the regularization parameter, γ represents the l1 regularization weight, and θ i represents the model parameters; (5) Support Vector Regression: Support vector regression is a support vector machine algorithm used to solve regression problems. It is an extension and application of support vector machines in regression estimation problems. The conclusions obtained by support vector machines for classification problems are extended to regression functions, which becomes support vector regression. It is usually used in time series prediction, nonlinear modeling and prediction, and optimization control. Given training samples D = {(x1,y1),(x2,y2),…,(x N ,y N )},x i ∈R m ,y i ∈R, where m is the number of attribute features of the sample, y i is the value of the sample; a regression model f(x) = w is learned T x+b,w∈R m ,b∈R, where w and b are coefficients to be determined so that f(x) is as close as possible to the true output y; Assume that the maximum deviation between f(x) and y can be tolerated is ε, that is, when the deviation is less than or equal to ε, the loss of the model is 0, and when the deviation is greater than ε, the loss caused by the deviation is calculated; the samples between the curve f(x)+ε and the curve f(x)-ε are not calculated for loss, and the samples outside are calculated for loss; Then the SVR model is: where γ is the regularization constant, l ε It is the ε-insensititve loss function defined as follows: (6) Deep Neural Networks: A deep neural network constructs a nonlinear mapping between input variables and output variables. It includes an input layer, a hidden layer, and an output layer. The hidden layer can have one or more layers. There is a unidirectional connection between layers, and no connection between layers. Assume that the sample size of the training set is n, the number of neurons in the input layer is a, the number of neurons in the hidden layer is l, the number of neurons in the output layer is b, and the input of the training set is The output of the training set is y, and the elements in y are recorded as y ij , the network output is The element is denoted by The weight matrix from the training layer to the hidden layer is W, the threshold vector of the hidden layer is θ, the weight matrix from the hidden layer to the output layer is V, and the threshold vector of the output layer is γ. Then the total number of parameters that need to be corrected in the network is N = a × l + l + l × b + b; the activation function is the tanh function, and the error matrix The performance indicator is selected as mean square error: Step 4, product grade prediction model: Step 4.1, product grade prediction model based on random forest: Input: the last test data of the mineral phase, quick sample and acid residue, and the current data of roughing and sweeping; Output: Fe, SiO2, P, S grade prediction values; The random forest regression algorithm is used, and the ratio of the training set to the test set is 9:1, that is, 90% of the data is used to train the model, and the remaining 10% of the data is not used in the training of the model, but only used to verify the model error; a 10-fold cross validation is set to retain the model with the best effect on the test set; the mean absolute percentage error MAPE is used to evaluate the error; Step 4.2, model comparison: Use the comparison model in the same way as in step 3.2 to predict product grade and record the test set error.
2. According to claim 1, a method for predicting magnetic separation current and product grade based on random forest algorithm is characterized in that: The step 1 specifically comprises the following steps: Step 1.1, read the filter sample data, regroup the data, the rows correspond to the detection time, and the columns correspond to the test indicator categories; Step 1.2, read the mineral phase data of the mill; Step 1.3, read the grinding sample, and average the test index results of different scans at the same time; Step 1.4, reading acid residue; Step 1.5, combine the data by time, and fill all the data with the previous value, that is, except for the filter fast sample data, that is, the currently input mill mineral phase, mill fast sample, and acid slag data are the last test results, to ensure that each indicator must have an input value when making a prediction at the current moment; Step 1.6, read the current data, take the average of the rough selected current data, take the average of the scanned current data, round the current value, and integrate it according to the sorted test data time.
3. According to claim 1, a method for predicting magnetic separation current and product grade based on random forest algorithm is characterized in that: In step 3.2, the basic steps for updating the neural network weights using the LM algorithm are as follows: Step 3.21, parameter initialization: set the maximum number of training times max_epochs, target error e0, initial μ, μ increase factor μ_inc, μ decrease factor μ_dec, and upper bound μ_max of μ; Step 3.22, normalize the training data. The normalized input and output matrices are X 0 , Y 0 ; Step 3.23, randomly generate the initial weight matrix and threshold vector W (0) ,V (0) ,θ (0) ,γ (0) , set i=0; Step 3.24, calculate the current network output and error e (i) : If e (i) < e0, go to Step 9; otherwise, go to Step 5; Step 3.25, represent the weight matrix and threshold vector as row vectors Error matrix E V (i) Represented as a vector Calculate the Jacobian matrix J of the error matrix with respect to all weights and thresholds (i) ; Step 3.26, update the weights and thresholds according to formula (3.6); Step 3.27, use the updated weights and thresholds to calculate the network error e (i) ′, if e (i) ' <e (i) , then update μ by μ×μ_dec and go to Step 8; if e (i) ′≥e (i) , then update μ by min{μ_max,μ×μ_inc} and go to Step 6; Step 3.28, i=i+1, if i≤max_epochs, go to Step 5; otherwise, go to Step 9; Step 3.29, W = W (i) , V = V (i) , θ=θ (i) , γ=γ (i) , output network weights and thresholds.
Citation Information
Cited By
Flotation detection method, apparatus, and computer program product
CN122548394A
Flotation detection method, apparatus, and computer program product
CN122548394B