# Application of Machine Learning Ensemble Methods to ASTRI Mini-Array Cherenkov Event Reconstruction
## 5 Tests on New Methods for Gamma/Hadron Separation  
### Tests on Gamma/Hadron Separation  
Our primary objective is to achieve accurate discrimination between gamma-ray and hadron events. To accomplish this, we employ a discriminant parameter known as \"gammaness\", which serves as a measure of the likelihood that an event originates from a gamma-ray source. The gamma/hadron separation code is based on Machine Learning methods. In input, it reads FITS files in the official ASTRI format (level DL2a). In output, it writes FITS files in the official ASTRI format (level DL2b). In our test, input data are ASTRI MA Prod2-Teide level DL2a and output data are ASTRI MA Prod2-Teide level DL2b. Our benchmark is the method based on Random Forest implemented in A-SciSoft and the following set of twelve discriminating parameters (from now on, these will be referred to as \"GH SET 0\")  
1. \(log_{10}(SIZE)\)
2. \(WIDTH\)
3. \(LENGTH\)
4. \(DENS\)
5. \(CONC\)
6. \(NUSEDTL\)
7. \(M3 LONG\)
8. \(TELIP\)
9. \(STMAXH\)
10. \(LEAKAGE\)
11. \(NUIMCORE\)
12. \(NUIMBOUNDARY\)  
Random Forest gamma/hadron filtering is performed as follows:  
* \(NUSEDTL>1\)--specifies that the event must involve at least two telescopes in order to be considered for reconstruction;
* \(STMAXH>0\)--the maximum height of the reconstructed shower must be greater than zero, indicating that the stereoscopic reconstruction is meaningful;
* \(SIZE>50\) phe--the size of the event must exceed a threshold of 50 to exclude events with low signal-to-noise ratios;
* \(NUMISLAND<2\)--the number of isolated clusters of pixels belonging to a single image must be less than two;
* \(NUMORE>2\)--this is a lower limit on the number of pixels composing the image;
* \(LEAKAGE<0.1\)--the fraction of light detected in the outermost region of the cameras must be less than 10%;
* \(LENGTH>0\), \(WIDTH>0\)--null values in these two parameters indicate a degeneration of the image that makes it useless for reconstruction purposes. By satisfying these conditions, reconstructed Cherenkov events are more likely to be of high quality and free from noise and background signals. Several tests were performed on different sets, using different Machine Learning methods and different training hyperparameters tunings. We employ the method of a mean decrease in impurity to calculate the importance of features. This method measures the reduction in the impurity criterion achieved through the splits made on a specific feature across all the trees in the ensemble. Gini impurity (see [19]) is a measure that indicates the likelihood of misclassification of new, randomly generated data if they were assigned a random class label based on the class distribution present in the dataset. By evaluating the mean decrease in impurity, we gain insights into the relative relevance of different features as they contribute to improving the overall purity of the decision trees. This analysis provides valuable information about the significance and contribution of each feature in the learning process, shedding light on their importance for accurate predictions and classification. The Random Forest algorithm has a built-in feature importance evaluation algorithm. However, tree-based models have a strong tendency to overestimate the importance of continuous numerical features (the continuous feature provides more opportunity for the tree-based models to split the data in half). So, we also used the method of permutation feature importance. The method of permutation feature importance is used in Machine Learning to evaluate the importance of different features in a dataset for predicting a particular outcome. It consists of training a model on a dataset and then randomly permuting the values of one feature at a time and re-evaluating the model performance on a validation set. The decrease in model performance when a particular feature is permuted is used as a measure of that feature's importance.