# Optimization of Sensor Placement for Modal Testing Using Machine Learning
## 3 Machine Learning Approach for Sensor Selection  
Machine learning (ML) techniques are a promising approach for determining sensor placement in modal analysis. Machine learning techniques are able to determine a non-deterministic relationship between an output quantity and a large number of input quantities--called \"features\"--on which the output depends, through an initial process called \"training\". A large number of features are usually defined in a machine learning database, resulting in high computational costs. In an effort to reduce the computational costs of the training procedures and identify the most important factors that contribute to the desired output, several approaches have been defined to identify the most important features of the database. Examples of such approaches are the SelectKBest algorithm [27; 28], the random forest feature importance approach [29; 30], and Principal Component Analysis [31; 32]. This paper focuses on the use of the random forest feature importance approach, as discussed in the following section. The random forest (RF) feature selection approach was selected for sensor placement based on its promising performance in existing sensor selection applications [33]. The RF is a learning method for classification and regression that belongs to the CART family (CART: Classification and Regression Trees). It is considered an averaging ensemble method because it combines the results from multiple estimators and averages the predicted results to reduce variance. During the training process, the random forest algorithm constructs a multitude of decision trees with a predicted estimation of the output variables; then, the outputs of all trees are aggregated, and the algorithm returns the average prediction of the individual decision trees. This aggregation process is called a bagging method, and it highly reduces the variance and the prediction bias--either underestimation or overestimation--of the output target, thereby reducing overfitting [29]. In addition to the randomness introduced by varying the input data for each DT, random perturbations in the DTs are also introduced. Each decision tree constructed by the algorithm is composed of internal nodes and leaves; in each internal node, all features are used to make decisions on how to binary split the dataset further based on a defined criterion, such as the Gini impurity or variance reduction parameters. This criterion measures how each feature decreases the impurity of the split at each node. For each feature, it is then possible to determine how, on average, it decreases the impurity of all trees in the forest, which becomes a measure of the feature importance [30]. In this paper, the Gini index will be used to determine the feature importance. Once the algorithm calculates the feature importance for each input variable, a bar graph can be obtained to determine the most important features. Additionally, the R squared value (R2) and mean squared error (MSE) can be used to evaluate the performance of the approach. Initially, a random forest model is constructed using all the features available in the dataset. The random forest algorithm computes the feature importance of each input variable as it maps to the output variable. The regressor attributes a feature importance value that ranges between 0 and 1 to each input variable in the model. This value represents how much variance in the output is represented by each input variable. The sum of all feature importance of the model is 1. By selecting the inputs with the largest values of feature importance, we can determine which inputs are most valuable in representing the output. A number of inputs should be selected, such that a sufficient percentage of the variance of the data is represented. Conceptually, if a model has four input variables called a, b, c, and d, the RF regressor attributes a feature importance value to each input.