# Optimization of Sensor Placement for Modal Testing Using Machine Learning
## 4 Application of the Random Forest Sensor Selection Approach to a One-Dimensional Structure
### Densely Meshed Cantilever Beam (Case 1)  
For this first case, a finite element model of the cantilever beam was created using 100 linear beam elements, corresponding to an element size and distance between nodes of 2.4 mm. The beam was subjected to a transverse broadband Gaussian white-noise excitation from 0 Hz to 50 kHz, as shown in Figure 5, applied at the free end of the beam. The database used by the RF feature importance approach was created from the transverse acceleration at each node. Transverse acceleration was chosen as the input parameter owing to the wide availability of linear accelerometers for modal testing. Figure 4: Mesh of the 100-element beam. Figure 3: Schematic of the beam model. \begin{table}
\begin{tabular}{c c} \hline
**Mode Number** & **FEA Natural Frequency (Hz)** \\ \hline
1 & 42.83 \\ \hline
2 & 268.26 \\ \hline
3 & 750.45 \\ \hline
4 & 1468.6 \\ \hline
5 & 2423.4 \\ \hline
6 & 3612.5 \\ \hline
7 & 5033.1 \\ \hline \end{tabular}
\end{table} 
Table 3: Natural frequencies of the cantilever beam. In this first example, all three definitions of the global parameter are explored. For each output option, an RF model is trained using the available data. To understand the capability of the RF to represent the output, the R\({}^{2}\) and MSE are shown in Table 4. The MSE and R\({}^{2}\) values in Table 4 appear excellent, giving confidence that the RF model is a good representation of the system and that the feature importance algorithm is reliable. The ten most important features from each global parameter selection are listed in Table 5. These features represent the first ten candidate sensor locations identified by the RF algorithm. The nodal numbering starts with \"node 1\" at the root of the beam and ends with node 101 at the tip of the beam. The contribution of each feature/sensor to the variance of the data is depicted in Figure 6. The first ten features of the ODS RF account for 31% of the variance (global parameter a), whereas the first ten features of the normalized ODS account for 34% of the \begin{table}
\begin{tabular}{c c c c} \hline \hline  & **(a) ODS** & **(b) Normalized ODS** & **(c) Avg. FRF** \\ \hline R\({}^{2}\) & 0.900 & 0.940 & 0.940 \\ \hline MSE & \(7.0\times 10^{-15}\) & \(4.4\times 10^{-9}\) & \(2.8\times 10^{-11}\) \\ \hline \hline \end{tabular}
\end{table} 
Table 4: R\({}^{2}\) and MSE of RFR for case 1. Figure 5: Applied load for case 1. \begin{table}
\begin{tabular}{c c c c} \hline \hline
**Feature Importance Rank** & **(a) ODS** & **(b) Normalized ODS** & **(c) Avg. FRF** \\ \hline
1 & 86 & 66 & 61 \\ \hline
2 & 69 & 100 & 47 \\ \hline
3 & 44 & 68 & 94 \\ \hline
4 & 12 & 92 & 42 \\ \hline
5 & 43 & 73 & 41 \\ \hline
6 & 70 & 34 & 48 \\ \hline
7 & 53 & 82 & 5 \\ \hline
8 & 101 & 20 & 82 \\ \hline
9 & 96 & 88 & 101 \\ \hline
10 & 87 & 83 & 57 \\ \hline \hline \end{tabular}
\end{table} 
Table 5: Most important sensor locations (nodes) for case 1 based on different selections of the global parameter. variance (global parameter b) The first 10 features of the average FRF account for 29% of the variance (global parameter c). The position of the first ten sensors identified by the RF approach for the three outputs are depicted in Figure 7; some of the sensors are overlapping or very close to each other (e.g., 2.4 mm between sensor locations 43 and 44 for output a), which is not physically possible in a real testing environment. For all three choices of output, approximately 20 features are needed before at least 50% of the variance is accounted for; however, output (a) exhibits slightly higher individual variance in the first three features. To estimate the mode shapes that the selected sensors will predict, the value of the actual (FEA) mode shape was taken at each candidate sensor location. To obtain the mode shapes in the figures, the numerical mode shapes were evaluated at the selected sensors' locations to verify that minimum aliasing is present with the proposed choice. The mode shapes are depicted in Figure 8 (modes 1-4) and Figure 9 (modes 4-6).