# Make predictions from new data. y_pred = clf.predict(X_test),
### Implementation of RF in Scikit-Learn  
Unlike the original publication [42], the scikit-learn implementation combines classifiers by averaging their probabilistic prediction, instead of letting each classifier vote for a single class.  
When building an RF in scikit-learn you can control the same parameters as for a DT in addition to specific RF hyperparameters. That is, the characteristics of the individual trees that make up the forest can be controlled. However, the main objective of the calibration of these parameters is to avoid overfitting the tree, which is partly avoided by the very way of constructing the RF. In this way, we can allow fully developed trees to form, at the cost of a higher computational cost. There are therefore two parameters to adjust: n_estimators and max_features.  
n_estimators is the number of trees in the forest. In principle, the more the merrier. However, from a certain number of trees, there is no improvement in the prediction, and it must be considered that each tree increases the calculation time.  
max_features is the size of the random subsets of features to consider when splitting a node. The lower this value, the greater the reduction in variance, but also the greater the increase in bias. In practice, as stated in the scikit-learn documentation, values of max_features = None (always considering all characteristics instead of a random subset) work well for regression problems, and max_features = \"sqrt\" (using a subset random size sqrt (n_features)) for classification tasks (where n_features is the number of features in the data).  
Since we are treating the problem as classification, we will use max_features = \"sqrt\".  
\begin{table}
\begin{tabular}{c c c} \hline
**Parameter** & **Default Value** & **Description** \\ \hline criterion & ‘gini’ & Function to assess the quality of the division. The criteria supported \\  & & are ’gini’ for Gini impurity and ‘entropy’ for information gain. \\ splitter & ‘best’ & Strategy used for choosing the division. The supported strategies are \\  & & ‘best’ and ‘random’. \\  & & Maximum depth of the tree. If the value is ‘None’, the nodes will \\ max\_depth & None & continue until all are pure or until all leaves contain less than \\  & & min\_samples\_split samples. \\ min\_samples\_split & 2 & Minimum number of samples required to divide a node. \\ min\_samples\_leaf & 1 & Minimum number of samples required in a leaf node. A node will \\ min\_weight\_fraction\_leaf & 0.0 & only be split if the result has at least min\_samples\_leaf samples. \\  & & Minimum weight of a leaf node. Samples have equal weight when \\  & & sample\_weight is not provided. \\  & & The number of characteristics to consider when looking for the \\  & & best division. \\ random\_state & None & Parameter that controls the randomness of the model. \\ max\_leaf\_nodes & None & Maximum number of leaf nodes. \\ min\_impurity\_decrease & 0.0 & A node will divide if that division induces a decrease in impurity \\  & & greater than or equal to this value. \\ min\_impurity\_split & 0 & A node will split if its impurity is above this value. \\  & & Weights associated with the classes. If no value is provided, all \\  & & classes will be assumed to have a weight of one. \\ \hline \end{tabular}
\end{table}
Table 2: Hyper-parameters for classification decision trees in scikit-learn 0.21.  
To define the optimal number of trees, an iterative calculation can be carried out to check the increase in the quality of the prediction. In this way, it can be verified at which point the increase in the number of trees no longer compensates.