## 3 Model Establishment
### Parameter Determination  
When the value of \(\sigma\) is different, the image of the Gaussian kernel function is also different. Figure 4 shows the image of the Gaussian kernel function when the value of \(\sigma\) is different.  
It can be seen from the figure that the larger the value of \(\sigma\), the wider the Gaussian kernel function. When the value of \(\sigma\) is larger, more data are used in the regression, and when \(\sigma\) is too large, the curve-fitting effect decreases. When the value of \(\sigma\) is small, the data used for the regression are closer to the prediction point, but a too-small \(\sigma\) value leads to the overfitting of the curve.  
Therefore, by choosing an appropriate value for \(\sigma\), the fitting effect of the weighted linear regression can be effectively improved.  
If all regression data are directly used to verify the prediction results, the error of the model prediction is very low, and the impact of the model on non-measured values  
\begin{table}
\begin{tabular}{c c c c} \hline  & \(\varphi\) & \(y\) \\ \hline
378.99 & \(-3.863\) & 2.140 & 99.228 \\ \hline \end{tabular}
\end{table}
Table 6: Coefficient matrix and prediction results.  
Figure 4: Gaussian kernel function image under different \(\sigma\) values.  
cannot be verified. Therefore, this paper extracted the data from 40 MPa of pressure and a temperature of 70 \({}^{\circ}\)C and did not participate in the regression of the model. We compared the advantages and disadvantages of each model through the performance of the model in two groups of non-training sets.  
The average error of the model can be calculated using the following formula:  
\[\text{E}\text{r}\text{o}=\frac{1}{n}\sum_{i=1}^{n}\frac{\left|y_{i}^{*}-y_{i} \right|}{y_{i}} \tag{6}\]  
where \(y_{i}^{*}\) is the predicted value and \(y_{i}\) is the measured value.  
Taking the rheological experimental data of the Tianan 1 well as an example, the appropriate sigma value can be selected through the method of minimum average error.  
After obtaining experimental data, the average error of the prediction method was calculated for sigma values between 0.1 and 1, with an interval of 0.1. The relative error is shown in Figure 5.  
It can be seen from Figure 5 that the overall average error decreases first and then increases with the increase in the value of \(\sigma\). This is because when the value of \(\sigma\) is too large, the fitting of the curve is not good enough. When the value of \(\sigma\) is too small, the curve is overfitted, and the prediction performance for non-datasets is reduced. When \(\sigma\) is 0.7, the overall error is the smallest, so 0.7 is the optimal value.  
The relationship between the measured value and the predicted value of the model at each speed when the value of \(\sigma\) is 0.7 is shown in Figure 6.  
Figure 5: Comparison of average error under different \(\sigma\) values.  
Figure 6: Comparison between predicted value and actual value (\(\sigma=0.7\)).  
It can be seen from the figure that the error between the predicted value and the true value of the readings for each rotating speed is predominantly within \(\pm\)10%, and only the individual abnormal points with rotating speeds of 200 and 300 have large errors. The model established in this paper has a good prediction effect on the readings of the drilling fluid viscometer.