Loading

AI Blitz 5 ⚡

Getting started with TIMSER (baseline notebook)

Baseline containing code for submitting submissions for Time Series Prediction (AI Blitz 5)

shivam

Checkout the baseline notebook for getting started and making your first submission! 👇

AIcrowd-Logo

Getting Started Code for TIMSER Challenge on AIcrowd

Author : Shubhamai

Downloading Data 📚

In [ ]:
!pip install git+https://gitlab.aicrowd.com/yoogottamk/aicrowd-cli.git
API_KEY = "b42ff570ebfc36a1973801a5b2a3daf7"
!aicrowd login --api-key $API_KEY
In [ ]:
!aicrowd dataset download -c timser >/dev/null

Importing Libraries

In [ ]:
import pandas as pd
from fbprophet import Prophet

Load Data

  • We use pandas 🐼 library to load our data.
  • Pandas loads the data into dataframes and facilitates us to analyse the data.
  • Learn more about it here 🤓
In [ ]:
train_df = pd.read_csv('train.csv')
# val_df=  pd.read_csv("val.csv")
# sample_submission = pd.read_csv("submission.csv")
train_df.head()
In [ ]:
df = pd.concat([train_df, val_df])
df.columns = ['ds', 'y']
print(df.tail())
In [ ]:
m = Prophet()
m.fit(df)

Making Predictions

Now we are going to make future predictions

In [ ]:
future = m.make_future_dataframe(periods=2763)
forecast = m.predict(future)
print(forecast[['ds', 'yhat', 'yhat_lower', 'yhat_upper']].tail())
In [ ]:
fig = m.plot(forecast)
fig.savefig('prophetplot.svg')
In [ ]:
sample_submission['value'] = forecast['yhat']
sample_submission.to_csv("submission.csv", index=False)

To download the generated csv in colab run the below command

In [ ]:
try:
    from google.colab import files
    files.download('submission.csv') 
except:
    print("Option Only avilable in Google Colab")

Well Done! 👍 We are all set to make a submission and see your name on leaderborad. Let navigate to challenge page and make one.


Comments

You must login before you can post a comment.

Execute