For the training of random forest model in sklearn, I understand that for features of a single value, a threshold for splitting the data is determined by minimizing the Gini impurity or maximizing information gain. However, how does the split happen when the given feature is an array of values (e.g. an image with calculated edges, etc.). Is it just calculating a thresholding value for each element of that array (i.e., each pixel)? Or are there any considerations of the relationships between different elements across the array like it is with convolutional neural networks?
1 Answer
With RandomForest as it exists in scikit-learn, and practically all other implementations, there is no way to input structured data - be it 1D sequences or 2D matrices. All data must be transformed into a set of feature columns before passing to fit()/predict(). And the RandomForest method is unaware of any relation between these feature columns.
This typically means that to perform well on images or sequences, feature engineering must be performed in a previous step of the pipeline, to extract meaningful features that the classifier can work with.