Adv_Fin_ML_Exercises icon indicating copy to clipboard operation
Adv_Fin_ML_Exercises copied to clipboard

getWeights_FFD is incomplete!

Open mdalvi opened this issue 5 years ago • 1 comments

As defined in the book the FFD approach of getWeights which is Xt =Σl∗k=0 𝜔̃ kXt−k,

uses k which is k = 0,…, T − 1.

Thus a limit/size parameter is requried for getWeights_FFD in notebook 05. Fractionally Differentiated Features!

A complete implementation can be found at

https://github.com/philipperemy/fractional-differentiation-time-series/blob/master/fracdiff/fracdiff.py

viz.

def get_weight_ffd(d, thres, lim):
    w, k = [1.], 1
    ctr = 0
    while True:
        w_ = -w[-1] / k * (d - k + 1)
        if abs(w_) < thres:
            break
        w.append(w_)
        k += 1
        ctr += 1
        if ctr == lim - 1:
            break
    w = np.array(w[::-1]).reshape(-1, 1)
    return w

mdalvi avatar Mar 29 '19 22:03 mdalvi

It’s like a fir filter Implement the kernel and run, nothing more nothing less

rspadim avatar Mar 29 '19 23:03 rspadim