# Occupational Risk Prediction for Miners Based on Stacking Health Data Fusion
## 3 Introduction to Methods and Data Processing
### Database
#### 3.1.2 Remove Outliers Based on LOF (Local Outlier Factor)  
The LOF algorithm is commonly used for outlier detection, evaluating the degree of anomaly of a data point based on differences in local density. The fundamental principle of LOF is that if a point in a local neighborhood exhibits a significantly lower density than its neighbors, it is likely to be considered an outlier. LOF is particularly effective for high-dimensional and complex datasets, as it can identify outliers within local structures. The fundamental principle of the LOF algorithm is to compare the local density of a data point with that of its neighbors. The LOF algorithm evaluates the anomaly of each data point by comparing its local density to that of its neighbors. If a data point exhibits a significantly lower density than its neighbors, it is considered a potential outlier. The LOF algorithm utilizes \"k-Nearest Neighbor\" (KNN) to determine the local density of each data point. The density is calculated based on the distance between the data point and its k nearest neighbors. The LOF value is computed as follows:  
Reachability distance: For a data point \(p\), its reach distance \((p,o)\) is the distance between \(p\) and its neighbor \(o\). If the distance between the two is very close, the reachable distance is small; otherwise, it is larger. The formula for the accessible distance is:  
\[reachability\_distance(p,o)=max(k\_distance(o),d(p,o)) \tag{4}\]  
Locally accessible density:  
\[\text{lrd}(p)=\frac{1}{\sum\limits_{o\in N_{k}(p)}\text{reachability distance}(p,o)} \tag{5}\]  
where \(N_{k}(p)\) denotes the set of k nearest neighbors of the data point \(p\). The LOF algorithm computes the local anomaly factor for each data point, which reflects the degree of abnormality relative to its neighbors. Specifically, the LOF value is computed using the following formula:  
\[\text{LOF}(p)=\frac{\sum\limits_{o\in N_{k}(p)}\frac{\text{lrd}(o)}{\text{lrd}(p)} }{|N_{k}(p)|} \tag{6}\]  
where \(N_{k}(p)\) is the k nearest points of data point \(p\), and \(\text{lrd}(p)\) and \(\text{lrd}(o)\) are the locally accessible densities of data points \(p\) and \(o\), respectively. When the LOF value is close to one, it indicates that the density of the data point is similar to that of its neighbors, suggesting normality. A LOF value greater than one indicates that the point is an anomaly, exhibiting a significantly lower density than its neighbors. Conversely, a LOF value less than one suggests that the point has a higher density than its neighbors, potentially classifying it as a local density core point.  
After applying the LOF algorithm for outlier detection, the results indicate that certain data points are identified as anomalies. Figure 4 presents the LOF detection outcomes, with blue points representing normal data and red points indicating abnormal data. This algorithm accurately identifies outliers that deviate from their neighboring data points. As a local density-based outlier detection method, the LOF algorithm effectively detects observations that significantly differ from their neighbors. Its flexibility and unsupervised nature enable it to adapt to the requirements of various datasets, particularly in processing complex physiological features such as blood pressure, heart rate, and body temperature. By distinguishing the density of physiological data points within their local neighborhood, it becomes possible to more accurately identify outliers that deviate from neighboring data, while avoiding the exclusion of abnormalities that may hold clinical significance. Abnormal data points, potentially caused by sensor failure or other external factors, can be identified and excluded. In this study, outliers in physiological data are effectively detected and visually represented through chart visualization, offering more reliable input for the subsequent health assessment model. Thus, a more accurate and reliable database is provided for subsequent analysis and modeling.