Skip to content
Open
85 changes: 39 additions & 46 deletions docs/examples/cryptocurrency-quickstart.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@
"outputs": [],
"source": [
"files = os.listdir(path)\n",
"files = [path + \"/\" + x for x in files]"
"files = [path+'/'+x for x in files]"
]
},
{
Expand Down Expand Up @@ -198,18 +198,18 @@
"# Read all filez and set them up to the readable structure for timecopilot\n",
"for file in files:\n",
" temp_df = pd.read_csv(file)\n",
" temp_df = temp_df[[\"Symbol\", \"Date\", \"Close\"]]\n",
" temp_df.columns = [\"unique_id\", \"ds\", \"y\"]\n",
" big_df = pd.concat([big_df, temp_df])\n",
" temp_df = temp_df[['Symbol','Date','Close']]\n",
" temp_df.columns = ['unique_id','ds','y']\n",
" big_df = pd.concat([big_df,temp_df])\n",
"\n",
"big_df = big_df.reset_index(drop=True)\n",
"big_df[\"ds\"] = pd.to_datetime(big_df[\"ds\"], dayfirst=True, errors=\"coerce\")\n",
"\n",
"# This line will be kept for execution time sanity, feel free to remove it if you want to stress timing a little further.\n",
"# This line will be kept for execution time sanity, feel free to remove it if you want to stress timing a little further. \n",
"# big_df = big_df[big_df.ds >= \"2021-01-01\"]\n",
"cryptos = [\"MIOTA\", \"XEM\", \"ETH\", \"LTC\", \"DOGE\", \"CRO\", \"USDC\", \"ADA\"]\n",
"big_df = big_df[big_df.unique_id.isin(cryptos)]\n",
"big_df = big_df.reset_index(drop=True)\n",
"cryptos=['MIOTA','XEM','ETH','LTC','DOGE','CRO','USDC','ADA']\n",
"big_df=big_df[big_df.unique_id.isin(cryptos)]\n",
"big_df=big_df.reset_index(drop=True)\n",
"big_df"
]
},
Expand Down Expand Up @@ -341,7 +341,6 @@
" df_out.loc[idx, col] = np.nan\n",
" return df_out\n",
"\n",
"\n",
"df_missing = add_missing(big_df, col=\"y\", frac=0.03, seed=42)\n",
"df_missing = df_missing.sample(frac=1, random_state=42).reset_index(drop=True)\n",
"print(df_missing)"
Expand Down Expand Up @@ -710,14 +709,12 @@
}
],
"source": [
"anomaly_summary_xlm = anomalies_df[\n",
"anomaly_summary_xlm=anomalies_df[\n",
" # (anomalies_df.unique_id=='SOL') & \\\n",
" (\n",
" (anomalies_df[\"Chronos-anomaly\"] == True)\n",
" | (anomalies_df[\"SeasonalNaive-anomaly\"] == True)\n",
" | (anomalies_df[\"Theta-anomaly\"] == True)\n",
" )\n",
"].reset_index(drop=True)\n",
" ((anomalies_df['Chronos-anomaly']==True) | \\\n",
" (anomalies_df['SeasonalNaive-anomaly']==True) |\n",
" (anomalies_df['Theta-anomaly']==True)\n",
" )].reset_index(drop=True)\n",
"anomaly_summary_xlm"
]
},
Expand Down Expand Up @@ -957,14 +954,12 @@
}
],
"source": [
"anomaly_summary_xlm = anomalies_df[\n",
" (anomalies_df.unique_id == \"ADA\")\n",
" & (\n",
" (anomalies_df[\"Chronos-anomaly\"] == True)\n",
" | (anomalies_df[\"SeasonalNaive-anomaly\"] == True)\n",
" | (anomalies_df[\"Theta-anomaly\"] == True)\n",
" )\n",
"].reset_index(drop=True)\n",
"anomaly_summary_xlm=anomalies_df[\n",
" (anomalies_df.unique_id=='ADA') & \\\n",
" ((anomalies_df['Chronos-anomaly']==True) | \\\n",
" (anomalies_df['SeasonalNaive-anomaly']==True) |\n",
" (anomalies_df['Theta-anomaly']==True)\n",
" )].reset_index(drop=True)\n",
"anomaly_summary_xlm"
]
},
Expand Down Expand Up @@ -1204,14 +1199,12 @@
}
],
"source": [
"anomaly_summary_xlm = anomalies_df[\n",
" (anomalies_df.unique_id == \"ADA\")\n",
" & (\n",
" (anomalies_df[\"Chronos-anomaly\"] == True)\n",
" & (anomalies_df[\"SeasonalNaive-anomaly\"] == True)\n",
" # (anomalies_df['Theta-anomaly']==True)\n",
" )\n",
"].reset_index(drop=True)\n",
"anomaly_summary_xlm=anomalies_df[\n",
" (anomalies_df.unique_id=='ADA') & \\\n",
" ((anomalies_df['Chronos-anomaly']==True) & \\\n",
" (anomalies_df['SeasonalNaive-anomaly']==True) \\\n",
" # (anomalies_df['Theta-anomaly']==True)\n",
" )].reset_index(drop=True)\n",
"anomaly_summary_xlm"
]
},
Expand Down Expand Up @@ -1248,12 +1241,12 @@
"source": [
"tcf1 = TimeCopilotForecaster(\n",
" models=[\n",
" AutoARIMA(),\n",
" AutoARIMA(), \n",
" Chronos(repo_id=\"amazon/chronos-bolt-mini\"),\n",
" Theta(),\n",
" AutoETS(),\n",
" Moirai(),\n",
" Prophet(),\n",
" AutoETS(), \n",
" Moirai(), \n",
" Prophet(), \n",
" SeasonalNaive(),\n",
" ]\n",
")"
Expand All @@ -1266,7 +1259,7 @@
"metadata": {},
"outputs": [],
"source": [
"fcst_df = tcf1.forecast(df=big_df, h=30, level=[80, 90])"
"fcst_df = tcf1.forecast(df=big_df, h=30, level=[80,90])"
]
},
{
Expand Down Expand Up @@ -1310,9 +1303,9 @@
"metadata": {},
"outputs": [],
"source": [
"eth_fcst_normal = fcst_df[(fcst_df.unique_id == \"ETH\")][\n",
" [\"unique_id\", \"ds\", \"Chronos\", \"Chronos-lo-80\"]\n",
"].reset_index(drop=True)"
"eth_fcst_normal=fcst_df[(fcst_df.unique_id=='ETH')]\\\n",
" [['unique_id','ds','Chronos','Chronos-lo-80']]\\\n",
" .reset_index(drop=True)"
]
},
{
Expand Down Expand Up @@ -1352,9 +1345,9 @@
"metadata": {},
"outputs": [],
"source": [
"eth_fcst_missing = fcst_df[(fcst_df.unique_id == \"ETH\")][\n",
" [\"unique_id\", \"ds\", \"Chronos\", \"Chronos-lo-80\"]\n",
"].reset_index(drop=True)"
"eth_fcst_missing=fcst_df[(fcst_df.unique_id=='ETH')]\\\n",
" [['unique_id','ds','Chronos','Chronos-lo-80']]\\\n",
" .reset_index(drop=True)"
]
},
{
Expand Down Expand Up @@ -1522,9 +1515,9 @@
}
],
"source": [
"compare = eth_fcst_normal.merge(eth_fcst_missing, on=[\"ds\", \"unique_id\"])\n",
"compare[\"dif\"] = abs(compare[\"Chronos_x\"] - compare[\"Chronos_y\"])\n",
"print(compare[\"dif\"].sum())"
"compare=eth_fcst_normal.merge(eth_fcst_missing,on=['ds','unique_id'])\n",
"compare['dif']=abs(compare['Chronos_x']-compare['Chronos_y'])\n",
"print(compare['dif'].sum())"
]
},
{
Expand Down
4 changes: 1 addition & 3 deletions mkdocs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,12 +22,12 @@ nav:
- examples/agent-quickstart.ipynb
- examples/llm-providers.ipynb
- examples/aws-bedrock.ipynb
- examples/google-llms.ipynb
- examples/forecaster-quickstart.ipynb
- examples/anomaly-detection-forecaster-quickstart.ipynb
- examples/ts-foundation-models-comparison-quickstart.ipynb
- examples/gift-eval.ipynb
- examples/chronos-family.ipynb
- examples/crytpocurrency-quickstart.ipynb
- examples/finetuning.ipynb
- examples/cryptocurrency-quickstart.ipynb
- examples/sktime.ipynb
Expand All @@ -47,7 +47,6 @@ nav:
- api/models/ml.md
- api/models/neural.md
- api/models/ensembles.md
- api/models/adapters/adapters.md
- api/models/utils/forecaster.md
- api/gift-eval/gift-eval.md
- Changelogs:
Expand Down Expand Up @@ -76,7 +75,6 @@ nav:

theme:
name: "material"
custom_dir: docs/overrides
logo: https://timecopilot.s3.amazonaws.com/public/logos/logo-white.svg
favicon: https://timecopilot.s3.amazonaws.com/public/logos/favicon-white.svg
palette:
Expand Down
Loading
Loading