171 Import Numpy Np Import Matplotlibpyplot Plt X Np Array 820 775 680 655 750 802 798 68 Q37196670

In [171: import numpy as np import matplotlib.pyplot as plt x = np . array( [820,775,680,655,750,802,798,689,775] ) def mov_a

find the best k for moving average forecasting algorithm

In [171: import numpy as np import matplotlib.pyplot as plt x = np . array( [820,775,680,655,750,802,798,689,775] ) def mov_avg(x,k): np . full(x.size , np.nan) cast for t in range(k,x.size): forecastit] np.mean (x(t-k:t]) return forecast def weightedhttp://1ocalhost:8888/notebooks/Untitled. ipynb2kernel_name-pyt hon 3 #-mov-avg ( x , w ) : rnel name kw.size forecast np.full (x.size, np.nan) for t in range(k,x.size): forecast[t] np . sum ( x [ t-k:t)”w) = return forecast def exp

OR
OR

Leave a Comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.