# Analysis of Factors Influencing the Prices of Tourist Offers
## 3 Selecting Optimal Price Predictors
### Results' Aggregation  
Although the aim of all methods mentioned above was the same, the obtained results might vary more or less. Therefore, it was necessary to propose an algorithm able to summarize the results generated by the five methods and present a final feature ranking. In the case of the first three feature selection methods, the features are assigned values, which may be treated as weights, i.e., higher mutual information or impurity reduction mean better discriminative power of a given feature. These values have been normalized to a range of \([0,1]\). In the case of sequential methods, no weights have been extracted, but the wrapper approach lets us select a subset of features that enables for creating a prediction model demonstrating satisfying accuracy. We assign 1 to the features selected by a sequential method and 0 to all the others. Figures 6 and 7 present the way an optimal subset of features is selected during the sequential procedure. The graphs are generated for an example subset of flight trips data. The proposed method is as follows:  
1. For each iteration of the sequential feature selection, the algorithm estimates the accuracy of the wrapper model on the basis of a separate test set (blue lines on Figures 6 and 7). 2. Smooth the series obtained in the previous step using the moving average of width 5 (orange lines). 3. In the case of the sequential forward selection (Figure 6), identify the initial segment of the series, where the accuracy increases by at least 1 pp in each subsequent iteration. In the case of the sequential backward selection (Figure 7), identify the ending fragment of the series, where the accuracy decreases by at least 1 pp in each iteration. 4. Omit the fragment of the series identified in the previous step and calculate the average value on the basis of the remaining part. These values are marked with green dashed lines on Figures 6 and 7. 5. In the case of sequential forward selection (Figure 6), find the fifth feature, which makes the accuracy exceed the average value determined in the previous step. In the case of the sequential backward selection (Figure 7), find the feature, after removing which five more can be removed without dropping the accuracy below the average value determined in the previous step. The feature (iteration) identified in this way is marked with red dashed lines. 6. In the case of sequential forward selection, select the features from the first to the one identified in the previous step. In the case of the sequential backward selection, select the features starting from the one identified in the previous step to the last one. As it has been mentioned in Section 3.4, five feature selection methods have been applied in order to evaluate the features. In the results, each method assigned a weight value \(Wi\) to every predictor, indicating its ability to predict whether the trip price would go up, down or remain unchanged. The weights are:  
* \(W1\)--weight assigned according to mutual information value;
* \(W2\)--weight assigned on the basis of a mean decrease in the impurity of a random forest;
* \(W3\)--weight assigned according to the decrease in a random forest's accuracy after feature values permutation;
* \(W4\)--weight assigned on the basis of the results of the sequential forward selection method;
* \(W5\)--weight assigned on the basis of the results of the sequential backward elimination method. Weight \(W1\) was calculated only once for the whole set of data. The other four weights required model training and testing to evaluate accuracy. In these cases, the evaluation was performed for all five splits and the resulting weight values were averaged over the  
Figure 6: The accuracy of a model trained during the sequential forward selection (blue), smoothed accuracy (orange), accuracy averaged over the series excluding the segment of significant increase (green), identified iteration (red).