# Given a Noisy Curve, Write a Function to Output Likely Slopes

I am training a Variational Autoencoder (type of convolutional neural network), and have been plotting cost over time. The result is a noisy curve, shown here: I would like to write a function that gives the probability that the cost function has bottomed out, i.e. that its slope going into the future is zero. Due to the noise, I can't just take the derivative of the cost function, as it oscillates stochastically. I could take the derivative of the moving average of the cost function, but it would be unclear what window size to use, and regardless a single window size would be useful for only part of the line (the noise tends to increase over time).

Is there some mathematical function/theorem I can use to take the local noise of the curve into account, and output a range/distribution of probable slopes? I would imagine the output being something like a histogram with the most likely slope at the middle and increasingly less-likely slopes off on the sides.

• Probably I do not understand your question (or misread what is the objective), but why do you want to use noise and output potential slopes? If you do lowpass filter and extrapolate the result, you will get as accurate output as fitting curve was able to (being the proper model). The marching average may also work, but here the longer window gives smoother result.
– Evil
Jun 4 '17 at 19:58
• Also, are you sure that the slope being closer to 0 is enough information? Looking at your graph above, it appears to level out to nearly 0 slope, then the slope becomes more negative again. Jun 5 '17 at 3:31
• Unfortunately, the slope being close to zero isn't REALLY enough information to be sure - but it's an OK indicator in any event. I wouldn't be making any final decisions on whether or not to terminate training with the output of the above desired function, but rather, using the output as part of a larger deciding process. Jun 6 '17 at 11:54