Last active
April 27, 2018 23:59
-
-
Save freedomtowin/146700a254562c96ff745992cdb5add1 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import arperiodogram as arp | |
ts = arp.TimeSeries(store_df[['visitors']].values,'1',split=0.7) | |
ts.season_num = 2 | |
ts.lag_num = 2 | |
ts.create_seasons() | |
ts.phase_correlation() | |
# ts.set_top_lags([1,2,3]) | |
print("lag values:",ts.top_lags) | |
print("seasonal periods:",ts.periods) | |
ts.create_lags() | |
model = arp.AR_P(ts) | |
valid_y = ts.get_valid_y() | |
train_y = ts.get_train_y() | |
train_X = ts.get_train_X_season() | |
valid_X = ts.get_valid_X_season() | |
model.fit(train_X,train_y,kernel_transform=0.99,kernel_order=2) | |
y_pred = model.predict(train_X,train_y,is_train=True) | |
plt.figure(figsize=(10,10)) | |
plt.plot(y_pred) | |
plt.plot(train_y) | |
plt.xlabel('index') | |
plt.ylabel('y') | |
plt.title("actual & predicted") | |
plt.show() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment