# What type of classification algorithm for recognizing events in a set of data?

I would like to know what type of machine learning to use for recognizing events in a set of data. (or at least be pointed in the right direction so I can do my own research on the topic.)

I'm trying to identify M&M color using an RGB sensor. Here is an example of some data I collected. I want to train a neural network by saying "this is what it looks like when a blue M&M passes by the sensor... And a yellow..." So it then can tell me when and what color M&M has passed by.

My type of problem is similar to this. In this case, they record accelerometer data and use it to identify the exercise someone was doing.

How can you teach an ANN to do this? And how do you teach it what an "event" looks like?

** P.S. I'm new to this forum so any modifications to my question to make it more relevant and understandable are welcome.

You will need your data to look something like this:

Blue Red Green Label
20   12  13    _
18   11  13    _
18   12  13    _
19   13  14    _
24  12   13    _
28  14   19    B
30  19   21    B
29  18   20    B
25  14   16    B
21  12   13    _
19  11   12    _
18  11   12    _


That is, every point in the data will need to be annotated with a label: _ for nothing, B for blue, Y for yellow.

A sequence labeling model can be trained to predict the label for each point in the input sequence. Note that it's common to use a "Begin Inside Outside" (BIO) scheme to help the model understand when an "event" starts and ends:

Blue Red Green Label
20   12  13    Outside
18   11  13    Outside
18   12  13    Outside
19   13  14    Outside
24  12   13    Outside
28  14   19    B_Begin
30  19   21    B_Inside
29  18   20    B_Inside
25  14   16    B_Inside
21  12   13    Outside
19  11   12    Outside
18  11   12    Outside


(there are also variants of this scheme)

As far as I know Conditional Random Fields would be the traditional approach for this kind of task, but there might more recent NN approaches that I'm not aware of.