# Optimization of Sensor Placement for Modal Testing Using Machine Learning
## 4 Application of the Random Forest Sensor Selection Approach to a One-Dimensional Structure
### Effect of Mesh Density on Sensor Selection Using a Random Forest Regressor (Case 2)  
The previous subsection defined optimal sensor locations for modal analysis with a mesh of 100 elements. This mesh results in an element size of 2.42 mm. Since the method allows for the placement of a sensor at any given node, it can select adjacent nodes for sensor placement (Figure 7 and Table 5). This distance between nodes (element size) is impractical for physical sensors. This subsection discusses the sensitivity of the approach to the mesh size. For the second case, the mesh is reduced to 20 elements, resulting in minimum sensor distances of 12.1 mm, which is more reasonable, as shown in Figure 10. The rest of the parameters for the finite element and random forest analyses are the same as in case 1, including the applied excitation and the physical properties of the beam. Table 6 lists the first eight positions selected as the best sensor locations by the RF feature importance applied to a coarser mesh. A nodal location of 1 corresponds to the root of the cantilever beam, and 21 corresponds to the tip of the beam. The first eight features of the ODS RF (global parameter a) account for 55% of the variance, which represents a considerable improvement compared with case 1. Similar changes pertain to the other two choices of global parameter: the first ten features of the normalized ODS RF (global parameter b) account for 56% of the variance, and the first eight features of the Avg. FRF RF (global parameter c) account for 52% of the variance. This improvement is expected, as the eight most important features in case 2 account for 40% of the total nodes, whereas in case 1 the 10 most important features account for only 10% of the total nodes. The positions of the first eight sensors identified by the RF approach for the three outputs are depicted in Figure 11. It is clear that the overlapping problems identified in case 1 have been eliminated. \begin{table}
\begin{tabular}{c c c c} \hline \hline
**Feature Importance Rank** & **(a) ODS** & **(b) Normalized ODS** & **(c) Avg. FRF** \\ \hline
1 & 12 & 20 & 14 \\ \hline
2 & 11 & 21 & 13 \\ \hline
3 & 20 & 14 & 19 \\ \hline
4 & 8 & 19 & 7 \\ \hline
5 & 19 & 12 & 12 \\ \hline
6 & 21 & 7 & 17 \\ \hline
7 & 14 & 6 & 18 \\ \hline
8 & 6 & 10 & 3 \\ \hline \hline \end{tabular}
\end{table} 
Table 6: Most important sensor locations for case 2, ranked by feature importance. Figure 10: Mesh for the 20-element beam. Visualizations of the ability of the sensors to identify the modes of the beam are depicted in Figures 12 and 13. The plots were created using the same methodology as Figures 8 and 9. Examining the plots, the ODS sensor selector (global parameter a) appears to perform worse, with almost all the sensors placed at inflection points for the 7 th natural frequency. Upon comparison of the figures of the modes of case 1 (Figure 7) and 2 (Figure 11), it can be seen that the selected sensor locations are similar for both cases, suggesting the robustness of the method according to mesh size. Comparing Figures 8 and 9 with Figures 12 and 13 shows that reducing the number of elements of the beam does not affect the accuracy of the proposed methods in representing the modal characteristics of the beam. The accuracy of the method is not reduced because 20 elements are sufficient to represent the modal content of the beam up to the considered natural frequency (the first seven bending modes). Figure 11: Sensor positioning for Case 2. Figure 12: Modes 1–4, as predicted using the first 10 features, case 2. (**a**): Raw ODS, (**b**): normalized ODS, (**c**): average FRF. The ability of the method to properly select sensor locations for modal testing is further verified by extracting natural frequencies from the selected FRF using a modal analysis procedure.