# Train and predict on different data structures

Is it possible to train a Machine Learning model with a set of the same data structure, but use another data structure as input in prediction/classification ? If so, how ?

Let me elaborate and explain my motivation :

I am a summer intern in a research lab (and will be starting my last year in Mathematical Engineering, so I am not too deep into ML yet, I will be specializing this year). I have followed the work of a previous intern on Chronicle Mining.

A Sequence is a list of timestamped events, e.g.

<({A}, 1), ({A, C}, 2), ({A, B}, 4), ({B, C}, 7)>

is a sequence in which the event A happens at time 1, the events A and C happen at time 2, the events A and B happen at time 4 and the events B and C happen at time 7.

A Chronicle is a data structure based on graphs. It translates time constraints between events, or in my case, sequences of events.

This tells us that a first A event must come between 1 and 3 units of time before the sequence B, C, but B, C must come between 1 and 3 units of time before a second A event and between -2 and 2 units of time before A, C (so A, C can actually come before B, C). A first A event must come between 1 and 4 units of time before A, C, and you get the rest.

So as you can see, it is a directed graph, there can be mutliple nodes with the same label (which are sequences of events), multiple vertices with the same label (which are time intervals) and there can be negative values within the intervals. In my case, events are partially ordered (in this example it is lexicographical order) to make some things simpler.

I have accomplished efficient extraction of these weird things from sequential databases, so let's say I have a lot of them. In my case, there is always a final state (like the middle A in the example), and it is always the same (all sequences end with the same event/sequence).

Now, my tutor would like me to "perform Machine Learning" on these graphs. But there is a catch : the prediction/classification input has not the same shape as the training input. He would like for me to feed the algorithm a simple sequence (not a chronicle) and output some results. Thus, I have come up with two problems :

• Given a large set of chronicles and a partial sequence (without the common final state), predict the sequence (and intervals between each event) between the last event on the sequence and the common final state.
• Given a large set of chronicles and a partial sequence (without the common final state), tell whether the next k-th step will be the common final state.

Both are similar, but one is a prediction problem and the second one is a classification problem. However, in both cases, I don't know where to start !

I have read papers on k-th steps sequence prediction with LSTM NN and other techniques, but what gets me is the fact that I apparently have to train my model with chronicles, but predict using sequences. Is that even possible ? Do I have to transform my chronicles in some kind of way ?

From what I understood from your problem, the chronicles are a way to model relationship between events and if so they are extracted from the sequential data (as a higher interpretation of data). I had a similar project involving Episode Mining in sequential database involving alarms.

The problem is whether you are trying to extract chronicles or use existent ones to predict something in a sequence (which is like using a pre-trained model).

Training a model mostly involves adjusting weights to inputs and applying (non-) linear functions on them in order to output the result in a certain format. (This is a very broad and abstract way of describing most ML algorithms)

So to answer your question, No you cannot do it in this broad way but you could try to make it so that the inputs are homogenous.

Building a model that extract from the sequence a chronicle would help or doing the exact opposite, generating a sequence with the chronicles and then perform machine learning.

1. Use simple Apriori/FPGrowth to extract rules (old way of doing things)
2. Build a (Hidden) Markov Model to estimate each state probability, in order to predict outcome.
3. Use RNN to learn how a sequence behaves (LSTM or GRU) with the fact that it's time-dependent, the RNN will remember important states and forget unimportant ones (which is similar to chronicles but in a black box kind of way).
4. Create something hybrid or completely new.