3
$\begingroup$

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)

$\endgroup$
5
  • $\begingroup$ Can you explain a bit more what are you trying to predict ? $\endgroup$
    – mirimo
    Jul 22, 2020 at 18:31
  • $\begingroup$ @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. $\endgroup$
    – Beinje
    Jul 22, 2020 at 18:45
  • $\begingroup$ Okay because in the joint file your output is binary. And is the point_index a continuous or categorical variable ? $\endgroup$
    – mirimo
    Jul 22, 2020 at 19:00
  • $\begingroup$ 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) $\endgroup$
    – Beinje
    Jul 22, 2020 at 19:25
  • $\begingroup$ I have edited my post to illustrate my input data in a different way $\endgroup$
    – Beinje
    Jul 22, 2020 at 20:16

1 Answer 1

0
$\begingroup$

If the number of points is constant in your array you can flatten your array and use each element as a feature in your RF. I worked on a similar problem (If I understood your problem correctly) where I predict the return of a stock based on his return on a given window of a fixed number of days and I have used the RF this way and it performs pretty well.
If your number of points isn't fixed then I suggest that that you use LSTM Neural Network where you can introduce a sequence of data (could be arrays) and it can predict the output that you are looking for.

$\endgroup$
3
  • $\begingroup$ My number of points is constant indeed, but I may have ~400 points, so that means I would have 400*2 = 800 features if I flatten my array, isn't it a problem ? Though I guess I can reduce the total profile to a narrower window. As for the LSTM, I have little experience with training NN (mostly CNN) but I guess it would require much more data compared to RF, right ? $\endgroup$
    – Beinje
    Jul 23, 2020 at 7:52
  • $\begingroup$ Yes, sure It does require a lot of data. And yes if you use 800 feature for prediction, it is definitely going to overfit. Again I am not sure I understood your problem very well but I think you can take a bigger timestep between two measurement or you can use some dimension reduction technique. $\endgroup$
    – mirimo
    Jul 23, 2020 at 8:25
  • 1
    $\begingroup$ OK, thx for your help ! I managed to reduce features to only 10 (using features I analysed in my previous approach). I'll start from that to apply RF classifier. But I may open a new post to better describe the problem and see if someone has better idea. $\endgroup$
    – Beinje
    Jul 23, 2020 at 13:12

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.