This shows you the differences between two versions of the page.
Next revision | Previous revision | ||
en:iot-reloaded:random_forests [2024/11/17 16:32] – created agrisnik | en:iot-reloaded:random_forests [2024/12/10 21:39] (current) – pczekalski | ||
---|---|---|---|
Line 1: | Line 1: | ||
- | ====== Random | + | ====== Random |
- | {{:en:iot-open:czapka_p.png?50|General audience classification icon}}{{: | + | |
+ | Random forests ((https:// | ||
+ | |||
+ | <figure Weatherforecastexample> | ||
+ | {{ :en:iot-reloaded:classification_6.png?800 | Weather Forecast Example}} | ||
+ | < | ||
+ | </ | ||
+ | |||
+ | Now, one might consider several forecast agents – friends of neighbours - where each provides their forecast depending on the factor values. Some will be higher than the actual value, and some will be lower. However, since they all use some **experience-based knowledge**, | ||
+ | The Random forest (RF) method uses hundreds of forecast agents and decision trees and then applies majority voting (figure {{ref> | ||
+ | |||
+ | <figure Weatherforecastvotingexample> | ||
+ | {{ :en:iot-reloaded:classification_7.png?800 | Weather Forecast Voting Example}} | ||
+ | < | ||
+ | </ | ||
+ | |||
+ | Some advantages: | ||
+ | * RF uses more knowledge than a single decision tree. | ||
+ | * Furthermore, | ||
+ | * This is true because a single data source might suffer from data anomalies reflected in model anomalies. | ||
+ | |||
+ | RF features: | ||
+ | * Each tree in the forest uses a randomly selected subset of factors. | ||
+ | * Each tree has a randomly sampled subset of training data. | ||
+ | * However, each tree is trained like usual. | ||
+ | * This increases the independence of data anomalies. | ||
+ | * When a decision is made, it is a simple average of the whole forest. | ||
+ | |||
+ | Each tree in the forest is grown as follows: | ||
+ | * If the number of cases in the training set is N, a sample of N cases at random is taken - but with replacement, | ||
+ | * This sample will be the training set for growing the tree. | ||
+ | * If there are M input factors, a number m<<M (m is significantly smaller than M) is specified such that at each node, m factors are selected randomly out of the M, and the best split on this m is used to split the node. | ||
+ | * The value of m is held constant while the forest grows. | ||
+ | * Each tree is grown to the largest extent possible. **There is no pruning**. | ||
+ | |||
+ | |||
+ | ===== Additional considerations ===== | ||
+ | |||
+ | **Correlation Between Trees in the Forest:** The correlation between any two trees in a Random Forest refers to the similarity in their predictions across the same dataset. When trees are highly correlated, they will likely make similar mistakes on the same inputs. In other words, if many trees make similar errors, the model' | ||
+ | * **Bootstrap Sampling:** Each tree is trained on a different bootstrapped sample (random sampling with replacement) of the training data, which helps to reduce the correlation between the trees. | ||
+ | * **Feature Randomness: | ||
+ | |||
+ | |||
+ | **Strength of Each Individual Tree:** The strength of an individual tree refers to its classification | ||
+ | |||
+ | Each tree's strength depends on various factors, including its depth and the features it uses for splitting. However, there is a trade-off between correlation and strength. For example, reducing m (the number of features considered at each split) increases the diversity among the trees, lowering correlation. Still, it may also reduce the strength of each tree, as it may limit its access to highly predictive features. | ||
+ | |||
+ | Despite this trade-off, Random Forests balance these dynamics by optimising m to minimise the ensemble error. Generally, a moderate reduction in m lowers correlation without significantly compromising the strength of each tree, thus leading to an overall decrease in the forest' | ||
+ | |||
+ | |||
+ | **Implications for the Forest Error Rate:** The forest error rate in a Random Forest model is influenced by the correlation among the trees and the strength of each tree. Specifically: | ||
+ | * Increasing correlation among trees typically increases the error rate, as it reduces the ensemble' | ||
+ | * Increasing the strength of each tree (i.e., reducing its error rate) generally decreases the forest error rate, as each tree becomes a more reliable classifier. | ||
+ | Consequently, | ||
+ | |||
+ | For further reading on practical implementations, |