This folder contains the scripts and notebooks used for building and evaluating the neural network model for the bakery sales forecast project. The tasks include importing the dataset, defining the neural network architecture, training the model, making predictions, and preparing the results for Kaggle submission. The following notes describe what was done in each file:
The file INSTRUCTIONS.md provides an overview and guidelines for building the neural network model. It describes the key steps to focus on, including model selection, feature engineering, hyperparameter tuning, implementation, and evaluation metrics.
- Install Dependencies:
- Installs specific versions of
numpyandtensorflow. - Verifies the installation by printing the versions of the installed packages.
- Installs specific versions of
Overall, this folder ensures that a neural network model is correctly built, evaluated, and the predictions are prepared for submission to Kaggle.
-
Data Preparation:
- Imports necessary libraries such as
pandasandnumpy. - Reads the training, validation, and test datasets (
df_training_neural_network.csv,df_validation_neural_network.csv,df_test_neural_network.csv). - Separates features and labels for training, validation, and test datasets.
- Exports the prepared data as pickle files for later use.
- Imports necessary libraries such as
-
Model Definition:
- Defines a neural network using Keras with batch normalization and dense layers.
- Compiles the model using Mean Squared Error (MSE) as the loss function and Adam optimizer.
- Trains the model using the training data and evaluates it using the validation data.
-
Model Evaluation:
- Saves the trained model.
- Plots the training and validation loss over epochs.
- Makes predictions on the training and validation sets.
- Evaluates the model's performance using Mean Absolute Percentage Error (MAPE).
-
Visualization:
- Visualizes the predicted versus actual values for training and validation data.
-
Data Preparation:
- Similar steps as NEURONALES MODELL.ipynb for importing and preparing the data.
-
Model Definition:
- Defines a neural network with additional preprocessing steps such as scaling the features using
StandardScaler. - Adds dropout layers to the model for regularization.
- Compiles and trains the model with learning rate scheduling and early stopping callbacks.
- Defines a neural network with additional preprocessing steps such as scaling the features using
-
Model Evaluation:
- Saves the trained model.
- Plots the training and validation loss over epochs.
- Makes predictions and evaluates the model's performance using MAPE.
-
Visualization:
- Visualizes the predicted versus actual values for training and validation data.
- Prepare Data for Kaggle Upload:
- Loads the predictions file (
df_predictions_neuralNetwork.csv). - Merges the predictions with the sample submission file.
- Saves the final dataframe as
df_kaggle_upload_neuralNetwork.csvfor submission.
- Loads the predictions file (
-
Product Categories:
Brot: Sales of bread.Broetchen: Sales of rolls.Croissant: Sales of croissants.Konditorei: Sales of confectionery products.Kuchen: Sales of cakes.
-
Events and Holidays:
national_holiday: Indicator for national holidays.christmas_market: Indicator for the presence of a Christmas market.KielerWoche: Indicator for the Kiel Week event.
-
Weather Conditions:
temp_bins_kalt: Indicator for cold temperatures.temp_bins_mild: Indicator for mild temperatures.temp_bins_warm: Indicator for warm temperatures.temp_bins_heiß: Indicator for hot temperatures.
-
Time Variables:
Monat_2: February.Monat_3: March.Monat_4: April.Monat_5: May.Monat_6: June.Monat_7: July.Monat_8: August.Monat_9: September.Monat_10: October.Monat_11: November.Monat_12: December.Wochentag_Di: Indicator for Tuesday.Wochentag_Mi: Indicator for Wednesday.Wochentag_Do: Indicator for Thursday.Wochentag_Fr: Indicator for Friday.Wochentag_Sa: Indicator for Saturday.Wochentag_So: Indicator for Sunday.