Replacing CNNs with Random Forests Suppose I have a sequence like "ADTGESW". Each character in this sequence can attain a number of possible values, let's say 10. I can then one-hot encode this sequence and obtain a matrix with shape 10 by the length of the sequence:
$$
    \begin{matrix}
    position_0 & position_1 & \cdots & position_n \\
    0 & 1 & \cdots & 0 \\
    1 & 0 & \cdots & 0 \\
    \vdots & \vdots & \vdots & \vdots \\
    0 & 0 & \cdots & 1
    \end{matrix}
$$
Ideally, this could be the input of a Convolutional Neural Network (CNN).
Suppose now I do not have enough data point to use a CNN, so that I have to rely on something simpler like a Random Forests (RF). Would it still be possible to use such an input (i.e., a matrix) with RF? One might say to just flatten the matrix, but then I would lose the locality properties that are instead preserved with CNNs. Moreover, I might have many similar matrices (for different properties of the sequence and thus with different shapes).
 A: Convolutional neural networks are efficient for data such as images, because they seek for common patterns independently of their location on the picture. This cannot be achieved with random forests, they would rather mimic a dense neural network, if you want to make such comparisons. Moreover, when using dense neural network for images you would actually need more data then with convolutional network, since you would need more parameters. Random forests would work in here could work as a proxy for convolutional network only after extensive feature engineering.
Notice also that you won't be able to use random forest with this kind of data. Random forest is an algorithm implemented for two-dimensional data number of samples $\times$ number of features, while you mention three-dimensional data number of samples $\times$ sequence length $\times$ number of features, so still you would need to flatten your data.
Flattening the matrix would not lead to losing any positional information. It would only if you used something like convolutional neural network, that slide in two dimensions through the matrix, or when using feature engineering that do something similar. In other cases, it is just about how do you store your data, and it doesn't matter if your data is
$$
X = \left( \begin{array}{cc}
a & b \\
c & d
\end{array} \right)\qquad
%
Y = \left( \begin{array}{c}
a \\ b \\ c \\ d
\end{array} \right)
$$
with $X_{1,2} = Y_2 = b$, as far as the elements are consistently on the same place.
As a side comment, it is not true that your data "Ideally, [...] could be the input of a Convolutional Neural Network (CNN)". For such data, you could use one-dimensional convolutions, but using two-dimensional convolutions for one-hot encoded categorical data is rather uncommon solution.
