I have been trying to make a function that takes a series of numbers and outputs its cumulative maximum with a decay factor.
So for example, if I have this:
my_series = np.array([5, 3.6, 4.1, 2.3, 1.7, 4.9, 3.6, 6.4, 4.5])
decay_factor = 0.991
The desired output of my function would be the following:
[5. 4.955 4.910405 4.86621135 4.82241545 4.9
4.8559 6.4 6.3424 ]
As you can see, every new element must be the greatest between the next element from my original series and the previous element from the output series multiplied by the decay factor.
I would love to be able to make this function without using any for loops, so that I can speed it up.