# Time series regression

I m new in the domain of machine learning. I m here to ask for some elucidation. I have a data set presented as a time series( from a strain sensor coming from a wind turbine). In this time series, we can capture stop and start as u can see in the attached figure . I would like to know. which type of layer should I use? is it possible to make a model that counts up the start and stop of the signal(output dimension = 2)? Until now I just did classification using conv1D and the classes are (there is a stop, there is a start, there is nothing) but this way proceed is not convenient since sometimes we can have a rotor stop and start. I already thanks you a lot for your help,

• It is not entirely clear what you want to accomplish. Classification into transition events (starting, stopping) - or classification of states (parked, running)? Do you need counts of these events? Apr 12, 2020 at 9:17
• Thank you for your response. the basic requirement of my model is to count up the number of rotor stops and starts. But until now I m just doing classification( different classes for a different number of stopping and starting). for me, classification isn't the appropriate way to proceed. I would like to build a model that counts using regression because it seems more appropriate to this problem. tell me if the problem stills unclear. Apr 13, 2020 at 10:35
• I think you should have a classifier as an event detector as the base model, then build a counting 'model' on top of the output of the event detector Apr 13, 2020 at 11:22
• how can I put it in practice? Apr 13, 2020 at 11:28

Counting of events is probably best done as a separate software component that takes the output of your event classifier. The event classifier model would output for each time-step two probabilities: one for started and one for stopped.

The easiest way to count the events to have a state machine that compares the probabilities against a fixed threshold to create discrete events. And once you have discrete events, counting is trivial. Pseudo-code below:

# returns a tuple with (new_state, event_name)
# event_name can be None if no event occurred
def next_event(state, start_prob, stop_prob):
start_threshold = 0.5
stop_threshold = 0.5

if state == 'running':
if stop_prob > stop_threshold:
return ("parked", "stop")

if state == 'stopped' or state == 'unknown':
if start_prob > start_threshold:
return ("running", "start")

return (state, None) # no change

...
# initialization
start_counts = 0
state = 'unknown'

...
# for every new time window X
event_prob = model.predict(X)

state, event = next_event(state, event_prob[0], event_prob[1])
if event is not None and event == 'start':
start_counts += 1
....

• I actually thought about this but the main problem is that it s not easy to define the window size. sometimes a rotor stop can take 80 sec and sometimes the rotor can stop and start in 30 sec. Is it possible to make a NN model that has two perceptrons at the out layer? each perceptron counts the number of events. I already tried to implemented by didn t get a valuable result so maybe i m missing something. Again thanks a lot Apr 13, 2020 at 19:54
• A longer transition like that should probably be allowed to cover multiple analysis windows. For example a 10 second window, and using for example 1 second overlap between each window. Then stopping in 80 sec would take 80 windows long. Each window would be classified into an event probability separately. And you can use filtering to smoothen out the probabilities (median, exponential moving average etc) - since you know they cannot change as abruptly as 1 second Apr 13, 2020 at 20:22
• If you want to have an output that continiously change in the longer start/stop transitions, I would recommend that you try to estimate the rotation frequency or angular speed. Then determining starting and stopping transitions becomes looking at when the speed changes from a steady-state. Apr 13, 2020 at 20:26
• One way to estimate rotation frequency would be to create an ML classifier for the event "blade passed top/bottom", and count these passings as shown in the code above. Apr 13, 2020 at 20:30
• I m not sure to fully understand your idea. Apr 14, 2020 at 8:32