# Random Forest with 2D features

I try to predict the position of a specific point (crest) in a 1D signal (elevation profile). Until now, I computed gradient at every point of my signal and combined that with additional features or heuristics to find approximate position of the expected output (position of the crest).

But there are some limits of this approach and I've found that ML techniques, and especially Random Forest classifiers could perform well in this kind of situation.

I would like to train my RF to find the most probable point (point_index) being the "output" based on a profile input.

Yet, I only found examples of training RF models with 1D inputs (like a time series). In my case, I have 2D input data (one signal is composed of N points with 2 features associated to each point) like the following dataframe :

   profile_index  point_index         z             z'        crest
0              0            1 -0.885429             0          false
1              0            2 -0.820151          0.02          false
2              0            3 -0.729671          -0.1           true
3              0            4 -0.649332           0.1          false
4              1            1 -0.692186             0          false
5              1            2 -0.885429           0.1           true
6              1            3 -0.820151         -0.05          false
3              1            4 -0.649332           0.2          false


I can map my data to split the dataframe for every profile, and get the output point_index as a feature, but how do I manage the fact that 2 of my features are arrays ?

Edit: here is another representation for my data

   profile_index               points_z         points_z_prime    crest_index
0     [-0.05, ..., 2.36]        [0, ..., -0.01]            150
1     [-0.02, ..., 4.41]        [0, ..., -0.02]            162


(this is probably irrelevant regarding the method, but I work with Python and scikit-learn)

• Can you explain a bit more what are you trying to predict ? Commented Jul 22, 2020 at 18:31
• @mirimo I'm working on elevation profiles representing beach dunes and I try to automatically predict where is situated the foot and the crest of the dune based on the profile features. Commented Jul 22, 2020 at 18:45
• Okay because in the joint file your output is binary. And is the point_index a continuous or categorical variable ? Commented Jul 22, 2020 at 19:00
• Yes, the output is binary but I could represent it in other ways. Actually, it is just to label one of the points as "dune foot". The point_index is continuous and just represents the number of the point within the profile (column profile_index) Commented Jul 22, 2020 at 19:25
• I have edited my post to illustrate my input data in a different way Commented Jul 22, 2020 at 20:16