|
238 | 238 | "df.isna().sum()"
|
239 | 239 | ]
|
240 | 240 | },
|
241 |
| - { |
242 |
| - "cell_type": "code", |
243 |
| - "execution_count": 10, |
244 |
| - "metadata": {}, |
245 |
| - "outputs": [], |
246 |
| - "source": [ |
247 |
| - "# # Convert to datetime\n", |
248 |
| - "# df.Date = pd.to_datetime(df.Date,unit='s')\n", |
249 |
| - "# # Set Index\n", |
250 |
| - "# df = df.set_index('Date')\n", |
251 |
| - "# # Convert to freq\n", |
252 |
| - "# df = df.asfreq(pd.infer_freq(df.index))" |
253 |
| - ] |
254 |
| - }, |
255 | 241 | {
|
256 | 242 | "cell_type": "code",
|
257 | 243 | "execution_count": 11,
|
|
403 | 389 | ],
|
404 | 390 | "source": [
|
405 | 391 | "plt.figure(figsize=(30,10))\n",
|
406 |
| - "plt.plot(df)\n", |
407 |
| - "# for year in range(2004,2006):\n", |
408 |
| - "# plt.axvline(datetime(year,1,1), color='k', linestyle='--', alpha=0.5)\n", |
409 |
| - "# plt.figure(figsize=(10,4))\n", |
410 |
| - "# plt.plot(df)\n", |
411 |
| - "# for day in range(1,7):\n", |
412 |
| - "# plt.axvline(datetime(2016,1,day), color='k', linestyle='--', alpha=0.5)" |
| 392 | + "plt.plot(df)" |
413 | 393 | ]
|
414 | 394 | },
|
415 | 395 | {
|
|
514 | 494 | " "
|
515 | 495 | ]
|
516 | 496 | },
|
517 |
| - { |
518 |
| - "cell_type": "code", |
519 |
| - "execution_count": 20, |
520 |
| - "metadata": {}, |
521 |
| - "outputs": [], |
522 |
| - "source": [ |
523 |
| - "# def visualization4(test,anomalies,TIME_STEPS,scaler,axs,col):\n", |
524 |
| - "# test[col] =scaler.inverse_transform(test[col].values.reshape(1,-1)).reshape(-1)\n", |
525 |
| - "# test['270day_rolling_avg'] = test[col].rolling(270).mean()\n", |
526 |
| - "# test['90day_rolling_avg'] = test[col].rolling(90).mean()\n", |
527 |
| - "# test['30day_rolling_avg'] = test[col].rolling(30).mean()\n", |
528 |
| - "# test = test[~test.index.duplicated()]\n", |
529 |
| - "# # print(test)\n", |
530 |
| - " \n", |
531 |
| - "# sns.lineplot(\n", |
532 |
| - "# x= test.index, \n", |
533 |
| - "# y= test[col], \n", |
534 |
| - "# label=str(col +' price'),ax = axs\n", |
535 |
| - "# )\n", |
536 |
| - "\n", |
537 |
| - "# sns.scatterplot(\n", |
538 |
| - "# x= anomalies.index,\n", |
539 |
| - "# # y= anomalies[col],#scaler.inverse_transform(anomalies[col].values.reshape(1,-1)).reshape(-1),\n", |
540 |
| - "# y=scaler.inverse_transform(anomalies[col].values.reshape(1,-1)).reshape(-1),\n", |
541 |
| - "# color=sns.color_palette()[3],\n", |
542 |
| - "# s=52,\n", |
543 |
| - "# label='anomaly',ax = axs\n", |
544 |
| - "# )\n", |
545 |
| - "# # plot using rolling average\n", |
546 |
| - "# # sns.lineplot( x = test[col].index,\n", |
547 |
| - "# # y = '30day_rolling_avg',\n", |
548 |
| - "# # data = test,\n", |
549 |
| - "# # label = '30 Rolling avg',ax = axs)\n", |
550 |
| - "# # sns.lineplot( x = test[col].index,\n", |
551 |
| - "# # y = '90day_rolling_avg',\n", |
552 |
| - "# # data = test,\n", |
553 |
| - "# # label = '90 Rolling avg',ax = axs)\n", |
554 |
| - "# # sns.lineplot( x = test[col].index,\n", |
555 |
| - "# # y = '270day_rolling_avg',\n", |
556 |
| - "# # data = test,\n", |
557 |
| - "# # label = '270 Rolling avg',ax = axs) \n", |
558 |
| - " " |
559 |
| - ] |
560 |
| - }, |
561 | 497 | {
|
562 | 498 | "cell_type": "code",
|
563 | 499 | "execution_count": 21,
|
|
0 commit comments