How to deal with zero inflated data in a neural network

Viewed 47

I created a neural network (CNN using regression) for disaggregating the mains power data into specific devices. In other words: the x data is the mains energy data and the y is the energy data of a deive. The data is stored in a dataframe with just these two columns (mains data and device data). This works well for a device like a fridge which is powered on all the time and just goes up or down in watts.

However, when doing this with a device like a toaster which is powered off most of the time, this works really bad because the model predicts just zeros. Im using MSE as a lost function.

I tried removing all zeros from the data (so just training the network with data when the toaster is powered on) which worked in the sense that the model predicts the toasters energy consumption but only if it is turned ON. When testing the model on a dataset with zero values in the y data, the model of course, doesnt know that the toaster is turned off.

Do you have ideas how i can deal with that to make better predictions? Maybe randomly remove SOME rows of data where y==0? Another idea i have is to manipulate the data and change zeros in the y data to really small numbers (e.g. 0.5 when the toaster is drawing ~1100 Watts when on) just to distract the model in training.

Really hoping for some ideas.

Here is a sample of the data: i wanted it to look nice, however stackoverflow code detection wouldnt let me do this in markdown...

|Timestamp                |mains input data|device target data|
|-------------------------|----------------|------------------|
|2022-06-04 04:12:00+02:00|48.811111       |0.0               |
|2022-06-04 04:13:00+02:00|84.972221       |0.0               |
|2022-06-04 04:14:00+02:00|92.447220       |0.0               |
|2022-06-04 04:15:00+02:00|105.097221      |0.0               |
|2022-06-04 04:16:00+02:00|104.202782      |0.0               |
|...                      |...             |...               |
|2022-06-12 18:02:00+02:00|1352.591675     |1144.166626       |
|2022-06-12 18:03:00+02:00|1346.905640     |1134.166626       |
|2022-06-12 18:04:00+02:00|1339.047241     |1132.333374       |
|2022-06-12 18:05:00+02:00|1100.613892     |946.166687        |
|2022-06-12 18:06:00+02:00|1333.872192     |1129.166626       |
0 Answers
Related