Skip to content

Instantly share code, notes, and snippets.

@wsuzume
Created August 12, 2017 22:20
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save wsuzume/b6c7e76931070eaa4210a3635306e6e5 to your computer and use it in GitHub Desktop.
Save wsuzume/b6c7e76931070eaa4210a3635306e6e5 to your computer and use it in GitHub Desktop.
o_transform transforms "time series signal of values" to "current values taking past values into account in each terms"
import numpy as np
def o_transform(signal):
ret = []
for n in range(1, len(signal)+1):
a = 2 / (n + 1)
d = -2 / (n * (n + 1))
s = 0
for t in range(n):
s += signal[t] * (a + t * d)
ret.append(s)
return np.array(ret)
@wsuzume
Copy link
Author

wsuzume commented Aug 12, 2017

o_transform's definition is

where

or you can choose any monotonically decreasing function which suffices

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment