Climate change and global warming are urgent environmental issues demanding immediate action to safeguard future generations. The major contributor to the greenhouse effect, carbon dioxide (CO2), primarily originates from industrial and transportation fossil fuel combustion. International agreements, like the Paris Agreement, call for a 30-35% reduction in CO2 emissions compared to 2005 levels. This research aims to predict CO2 emissions and raise awareness among SAARC nations and governments about the increasing trend. We introduce a novel predictive framework using Attention-based Long Short-Term Memory (A-LSTM) for CO2 emissions analysis. The Attention mechanism assigns variable weights to input data, facilitating indirect connections between LSTM outputs and pertinent inputs. This enhances resource allocation in the A-LSTM model, overcoming computational constraints. We integrate input parameters encompassing CO2 emissions from land-use changes, oil, natural gas, and coal combustion to forecast CO2 emissions and correlate them with population and per capita GDP.
Our comparative analysis conclusively demonstrates the superior performance of A-LSTM models over baseline LSTM models when applied to the CO2 emission dataset sourced from the Our World in Data (OWID) and World Bank Indicator database. Specifically, the LSTM model registers a MAPE of 24.968 and an RMSE of 0.34, whereas the Attention-based LSTM model showcases a marked improvement of 57% with a considerably lower MAPE of 10.5902 and an RMSE of 0.107.
The proposed A-LSTM pipeline is:
CO2-PREDICTION-SAARC-COUNTRIES/
│
├── Analysis Data/
│ ├── cumulative-co2-emissions-all-countries.csv
│ ├── cumulative-co2-emissions-SAARC.csv
│ ├── GDP_data_yearwise_all_countries.csv
│ ├── input_data_analysis.xlsx
│ └── owid-co2-data-raw-saarc.csv
│
├── Input Data/
│ ├── final_cleaned_data_yearly.csv
│ └── final_input_data_clean_monthly.csv
│
├── model1/
│
├── Results/
│ ├── Comparative study/
│ ├── LSTM/
│ └── LSTM_attention/
│
├── .gitattributes
├── Analysis_and_Forecasting_of_Carbon_Emission_in_SAARC.ipynb
├── Co2_project_cleaning.ipynb
├── Co2_project_training-wotemp.ipynb
├── Co2_project_training.ipynb
├── presentation.pptx
└── selected_parameters_description.csv
The project requires Python 3.7 or later and the following Python packages:
- NumPy
- Pandas
- Matplotlib
- Seaborn
- Keras
- TensorFlow
- scikit-learn
To install the necessary dependencies, run:
pip install -r requirements.txt
The requirements.txt
should include:
numpy
pandas
matplotlib
seaborn
keras
tensorflow
scikit-learn
-
Data Preprocessing:
Co2_project_cleaning.ipynb
was used to clean and preprocess the dataset. This step includes parsing dates, resampling from yearwise values to monthwise, converting dates todatetime
format, etc. Final preprocessed data has been stored infinal_input_data_clean_monthly.csv
for direct use. -
Model Training:
To reproduce the results, open and execute
Co2_project_training-wotemp.ipynb
. This notebook contains the code for training both the baseline LSTM model and the Attention-based LSTM model. You can modify hyperparameters such as the learning rate, batch size, and number of epochs to experiment with different training configurations. -
Results and Evaluation:
The results folder contains detailed output for both the LSTM and A-LSTM models, including comparative studies, training loss, validation loss, and accuracy plots.
- Mean Absolute Error (MAE)
- Mean Squared Error (MSE)
- Mean Absolute Percentage Error (MAPE)
- Root Mean Square Error (RMSE)
These metrics are evaluated in both the training and validation datasets, and they provide insights into the model performance.
The steps for the exhaustive training and evaluation process is presented in the following diagram:
-
Mean Absolute Error (MAE):
-
Mean Squared Error (MSE):
-
Mean Absolute Percentage Error (MAPE):
-
Root Mean Squared Error (RMSE):
The Attention-based LSTM (A-LSTM) significantly outperforms the baseline LSTM model:
- LSTM Model: MAPE = 24.968, RMSE = 0.34
- A-LSTM Model: MAPE = 10.5902, RMSE = 0.107
This highlights a 57% improvement in MAPE for the A-LSTM model, showcasing its superior forecasting capability.
In conclusion, our study explored the critical task of forecasting carbon dioxide (CO2) emissions to address the pressing issues of climate change and global warming. The proposed Attention-based Long Short-Term Memory (A-LSTM) model significantly outperformed the traditional LSTM model, achieving remarkable improvements in predictive accuracy. These results bear noteworthy implications, particularly for predictive modeling in the context of CO2 emissions and sustainable development. The incorporation of attention mechanisms within LSTM architectures opens up exciting avenues for future research in forecasting other climate-related variables and enhancing resource allocation in machine learning models.
This study provides a solid foundation for expanding research in several key areas:
- Incorporation of more diverse climate variables such as methane (CH4) emissions, and industrial pollution data.
- Expanding the predictive model to other regions beyond SAARC countries.
- Exploring different neural architectures such as transformers, which may further enhance predictive accuracy.
For any queries, please reach out at: harshit_2101mc20@iitp.ac.in