So I’m working with time series data using a GRU and already explained a little bit about what I intend to do in this 2 post.
But the short explaination is:
I have data on users, which is basically a dataframe for each user, with each row representing a users activity in that minute. And i want to predict an event might occur at some point.
Now i have around 1k samples for timelines that show the event. And around 5k samples of timelines where it doesn’t.
Now i would like to adjust for the imbalance in the dataset.
Usually i would do that by for example telling the CrossEntropyLoss  weights for my classes.
But here i have a problem.
I get an output, that contains a prediction for every time step in my data.
So if my data looks like this:
Minute Feature_1 Feature_2 Feature_3 ... Target_0 Target_1
-4     0.4        0.23     0.64          1            0   
-3     0.24       0.23     0.64          1            0   
-2     0.34       0.1      0.64          1            0   
-1     0.56       0.2      0.64          1            0   
0      0.64       0.3      0.64          0            1  

With Target_0, Target_1Target_0 Target_1 being the labels.
My output will look like this (hopefully):
0.1    0.9   
0.1    0.9  
0.3    0.7
0.3    0.7
0.7    0.3

Now the time series are in differnt lengths and i have different amounts of them, in terms of: contains the event i’m looking for, or doesn’t.
What would be the best method of balancing my classes here?
Because i can’t just use CrossEntropyLoss  as it for some reason does not support my dimensions.