0
$\begingroup$

So let's imagine I have a dataset of children. For each of them a have a bunch of characteristics (generation, gender, race, class, urban/rural, religion, bmi, number of siblings etc..) and plus the age (in months) when they did for the first the following events

  1. Learn how to ride a bike
  2. learn how to swim,
  3. starting middle school,
  4. learn how to divide with more than 2 digits
  5. have a sleepover
  6. having allowance
  7. hitting puberty
  8. owning an electronical device

My objective is that given a new kid whose characteristics (indepedent variables) I know (gender, race, religion etc...) being able to predict the ORDER of these events for a kid.

Here is what I tried so far (from more simple to more complex)

First Approach

For each observation, I only consider the first event. I treat it as a classification problem to predict the first event of a child. Then I see what is the most common sequence that start with that particular event and I assign that for that child.

This one obviously will be horrible, but it may have a little bit of sense if we suppose that the order of the events are strongly correlated, in this case the first event determine totally the order of the rest.

Second Approach

I have also thought this. For each kid in the dataset, you transform the age (in months) of each event in the rank of events for this specific child. For example for this particular I transform it like that: From this:

  data
    #  Gender Class Religion   ... *Bike* *Swim* *MiddleSchool* *Divides*  *Sleepover* *Allowance* *Puberty* *Device*
    #1   Male   Rich  Budhist       86      130       125           163        140       230       210        250   

Into this:

  data
    #  Gender Class Religion   ... *Bike* *Swim* *MiddleSchool* *Divides*  *Sleepover* *Allowance* *Puberty* *Device*
    #1   Male   Rich  Budhist       1        3         2            5           4           7         6        8   

And then do a regression model for each event individually that predicts the estimated rank in comparison with the rest of the events giving an specific child. The regression will give you a number between 1 and 8 (not neccesarily integer) and you will have to once again,rank them from 1 to 8 (integers)

This is also a bad approach. Basically because doing each regression individually, is supposing that the events are indepedent, but in reality it usually obeys for patterns. For example if a child can't bike by the time he reaches middle school, it means he will bike and then swim just after the starting middle school event because it will the first thing he try at gym classes (I couldn't think of a better example)

Third Approach

Basically the same but instead of doing the regression on the rank of each event, it is directly done in the age of that event. Not sure if this is better than the last one.

Four Approach

The same that the last one but instead of doing the regression directly on the age, you normalizate from 0 to 10 being 0 the age first event and 10 the age of the last one for the age of each event. It will be better than approach 2 because not only it will give you the rank of each event, but how close to each other are.

Five approach

It will basically be any of the 3 previous approach but instead of doing a regression model for each event individually, it will be collectivilly, having more information due to the depedence between the events.

For example, if we select the regression on the rank of each event (like in the approach 2), our target instead of being numerical will be a 8-dimension numerical vector like [1,3,2,5,4,7,6,8]

This apparently can be done throught Neural Networks or TramineR (but that is only avaliable in R)

The problem is I can't find any information about this kind of problems because usually the ones tagged as "sequence analysis" like the DNA one are completetly different, you can repeat events and it's more related with time series so I don't even know where to search. I would like to find a dataset on Kaggle for working with this type of things.

I will be extremely grateful if someone bright me a little bit with this.

$\endgroup$

1 Answer 1

1
$\begingroup$

If you have plenty of training data to work with, it is worthwhile experimenting with various approaches. On the other hand, if you're dealing with just a few hundreds to a couple of thousands of rows, you might need to settle for a more generic solution.

Having said that, as a sixth approach, which might actually be more straightforward and easy to implement, you can treat the whole thing as a classification problem where your label is the next event. In the most basic configuration of this approach, each child in your training set is used once, with event #1 as its label.

Once your model is trained, it provides you with a probability for each event which, strictly speaking, conveys how likely it is to be the event that comes next. You can then make the (pretty reasonable) logical hop of using the class probabilities to rank the events and use the scores to predict event order. Before ranking, filter out the events that already occurred.

As an extension of the training process, you can treat all of the events you need to rank as binary features, while still using them as classes. Then, bootstrap your training data allowing each child to be sampled more than once for training, with the additional rows for the same child using the 2nd, 3rd event and so on as the label. In these additional training data rows, the events that occurred prior to the one used as label, will have a value of 1 (we said they were used as features), and the value of events that have not yet occurred will be set to 0. This model should gradually learn to discount the probabilities of events whose corresponding feature value is 1, but of course, you will still need to manually remove them after calculating the class probability scores.

$\endgroup$
2
  • $\begingroup$ Sounds interesting but I hardly understood it. It is like the chain regressor ? towardsdatascience.com/… $\endgroup$
    – Floralys
    Aug 7, 2023 at 22:48
  • 1
    $\begingroup$ Floralys, I wasn't referring to chain regressors. see this question on the CrossValidated site, it's about something similar to what I suggested but the explanation is much shorter $\endgroup$
    – KishKash
    Aug 8, 2023 at 9:07

Your Answer

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

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