# An Affordable Fast Early Warning System for Edge Computing in Assembly Line
## 3 Proposed Affordable Fast Early Warning System
### Hybrid Fault Model  
We used the hybrid fault model, combining DBSCAN [15], SMOTE [16], and RF [46], to predict normal and abnormal events during process, as shown in Figure 4.  
Figure 3: Proposed AFEWS implementation: (**a**) door trim assembly line, (**b**) workstation, (**c**) edge device. We collected an experimental dataset during initial implementation to evaluate performance of the proposed model. The collected dataset included 614 instances (378 normal and 236 abnormal), each with 10 attributes as follows:  
* Gyroscope X, Y, and Z directions (gyroX, gyroY, and gyroZ, respectively). * Accelerometer X, Y, and Z directions (accX, accY, and accZ, respectively). * Temperature (temp). * Relative humidity (hum). * Ambient light (lux). * Air quality (air). Random forest classification was employed to learn and generate a robust model from the collected dataset, which was then installed into each edge device to ensure prediction from sensor data could be generated and presented in fast response. We used preprocessing to remove inappropriate data and correct for missing values, with attribute and class parameters shown in Table 2. The air quality sensor provided categorical values (clean (CL), light pollution (LP), moderate pollution (MP), and severe pollution (SP)), hence the statistical distribution could not be derived for this attribute. Figure 5 shows the information gain [28] significance for each attribute. Gyroscope Z and Y directions (gyroZ and gyroY, respectively) had the maximum affect for abnormal events. \begin{table}
\begin{tabular}{c c c c c c c c c} \hline \hline \multirow{2}{*}{**Attributes**} & \multicolumn{5}{c}{**Normal Data**} & \multicolumn{5}{c}{**Abnormal Data**} \\ \cline{2-10}  & **Min** & **Max** & **Mean** & **STD** & **Min** & **Max** & **Mean** & **STD** \\ \hline gyroX & 2.07 & 17.63 & 8.90 & 4.02 & 1.53 & 20.14 & 8.61 & 4.41 \\ gyroY & 1.89 & 34.21 & 19.04 & 8.54 & 2.51 & 30.87 & 18.65 & 7.81 \\ gyroZ & 121.60 & 165.25 & 136.38 & 16.52 & 121.49 & 157.96 & 145.76 & 14.34 \\ accX & \(-\)0.16 & 0.18 & \(-\)0.02 & 0.03 & \(-\)0.23 & 0.19 & 0.001 & 0.05 \\ accY & \(-\)0.42 & 0.28 & 0.01 & 0.06 & \(-\)0.25 & 0.30 & 0.03 & 0.06 \\ accZ & 0.77 & 1.22 & 1.01 & 0.03 & 0.86 & 1.21 & 1.02 & 0.03 \\ temp & 23 & 25 & 23.73 & 0.96 & 23 & 25 & 24.50 & 0.87 \\ hum & 16 & 18 & 16.91 & 0.80 & 16 & 17 & 16.31 & 0.46 \\ lux & 870 & 925 & 907.71 & 10.09 & 879 & 924 & 902.77 & 11.13 \\ air & - & - & - & - & - & - & - \\ \hline \hline \end{tabular} Notes: Min = minimum; Max = maximum; STD = standard deviation; air quality sensor provided categorical values, hence statistical distribution could not be derived; attribute labels are defined in the main text above.  
\end{table} 
Table 2: Experimental dataset distributions. Figure 4: Hybrid fault model using density based spatial clustering of applications with noise (DBSCAN) outlier detection, synthetic minority oversampling technique (SMOTE) class balancing and random forest (RF) classification model. Due to imperfect sensing devices and network connection problems, some sensor data may be significantly noisy or outliers. Therefore, we filtered the sensor data using DBSCAN [15] implemented in R V3.5.1 [47] to remove outliers, having previously determined optimal values for epsilon (_eps_ = 4) and minimum points (_MinPts_ = 5), neighborhood radius around a data point and minimum value of neighboring data points, respectively. We defined _eps_ by calculating the average distance of every point to its k-nearest neighbors, using R V3.5.1 [47]. Figure 6a,b show the sorted k-nearest neighbor (NN) distribution and DBSCAN outlier detection, respectively. DBSCAN grouped the sensor data into four clusters, labelled 1-4, with cluster 0 representing un-clustered data, regarded as outliers. A total of 39 outlier instances were identified (of 614), and the remaining 575 were used for further analysis.