This project contains the notebooks used to train the models for the Big Data hackathon held from 09/09 to 22/09. The best model overall (speed, wmape, etc.) was a LightGBM model which was trained on a T4 GPU with high RAM on Colab (train_lgbm_capped.ipynb).
Before running the scripts, set up the required environment.
-
Clone the repository (or download the files).
git clone https://github.com/itsalissonsilva/ds_bigdata_hackathon
-
Install the dependencies by running the following command in your terminal from the project's root directory:
pip install -r requirements.txt
We have included a folder named jan23_simul created from the train data in order to check if the scripts to preprocess the data and evaluate the model work correctly. You can run preprocessing.py and evaluate.py directly or modify the path source to your actual January data in the script itself by following the instructions below.
- Extract your data to a folder in the project's directory.
- Unzip your new raw data and place the three Parquet files (e.g.,
part27.snappy.parquet,part51.snappy.parquet,part71.snappy.parquet) inside a folder you'll determine in the path, it can be the data folder. - Update the info in the preprocessing script to use the same path you unzipped it to, change the file names too to the ones in your zipped file:
IN_DIR = BASE_DIR / "data" / "jan23_simul"
df27 = pd.read_parquet(IN_DIR / "part27_jan.parquet")
df71 = pd.read_parquet(IN_DIR / "part71_jan.parquet")
df51 = pd.read_parquet(IN_DIR / "part51_jan.parquet")The data must have the same format as the train data provided in order to work correctly.
This script will find the raw Parquet files in your folder, process them, and save the result.
In your terminal, run:
python preprocess.pyThis will create a single, model-ready test.csv file inside the data/ folder.
This script uses the test.csv file you just created to score the model. Unzip the trained model from the models folder and modify the paths accordingly:
BASE_DIR = Path(__file__).resolve().parent
TEST_CSV = BASE_DIR / "test.csv"
MODEL_PATH = BASE_DIR / "lgbm_model_cap.pkl" # unzip the model first
OUT_PREDS = BASE_DIR / "data" / "predictions.csv"then in your terminal, run:
python evaluate.pyThis will return the wmape for the model on that period.
Exploratory Data Analysis - Hevenicio
Linear Regression Baseline - Gabriel
Extreme Gradient Boosting (XGB) - João
Light Gradient Boosting (LGBM) - Alisson
LSTM (w/ Keras) - Clara
LSTM (w/ Pytorch) - Alisson
- Database support
- API endpoint
- train script to update model in case of drift
- forecast.py
- AWS Deployment (or any other Cloud provider)
- Clarification regarding negative values etc
- Grid search more robust
- Test more SOTA models: TimesFM, Neural Prophet, TFT etc.