Solved by omarfoq in post #2 
              
              
                Hi, 
As you guessed, you can only approximate the integral as a sum, not that the integral you are dealing with is also an expectation, so all your formula can be seen as the expectation over X,Y and \delta. In my opinion, you can create a loader over your original dataset, and that yields in additi…