This project aims to predict renewable energy values over time using a linear regression model. The dataset contains information on renewable energy contributions in various countries.
- Overview
- Dataset
- Understanding KTOE
- Primary Energy Supply
- Model Description
- Installation
- Usage
- Results
- Contributing
- License
This project uses a dataset that includes information about renewable energy contributions in different countries over time. The aim is to build a predictive model using linear regression to forecast future renewable energy values.
The dataset contains the following columns:
- LOCATION: Country code
- INDICATOR: Energy type
- SUBJECT: Subject category
- MEASURE: Measurement unit
- FREQUENCY: Data frequency
- TIME: Year
- Value: Energy value in KTOE
- Flag Codes: Additional flags (not used in the model)
Here is a small part of the CSV:
"LOCATION","INDICATOR","SUBJECT","MEASURE","FREQUENCY","TIME","Value","Flag Codes"
"AUS","RENEWABLE","TOT","KTOE","A","1960",4436.932,
"AUS","RENEWABLE","TOT","KTOE","A","1961",4490.51,
"AUS","RENEWABLE","TOT","KTOE","A","1962",4407.097,
- KTOE: Kilotonnes of oil equivalent. It is a unit of energy that helps compare different forms of energy based on their energy content.
- 1 TOE: 1 tonne of oil equivalent is the amount of energy released by burning one tonne of crude oil, approximately 42 gigajoules.
- 1 KTOE: Kilotonnes of oil equivalent (1 KTOE = 1,000 tonnes of oil equivalent).
- Primary Energy: The total energy available from natural resources before any transformation to other forms of energy like electricity or refined fuels.
- Primary Energy Supply: The total amount of primary energy a country or region has available for use, including energy production plus imports, minus exports, and changes in stock.
The model uses a linear regression algorithm to predict the renewable energy values. It preprocesses the data using SimpleImputer
for missing values and OneHotEncoder
for categorical features. PCA is used for dimensionality reduction and visualization.
- Clone the repository:
git clone https://github.com/Prince07746/renewable-energy-prediction.git cd renewable-energy-prediction
- Create and activate a virtual environment:
python -m venv venv source venv/bin/activate # On Windows use `venv\Scripts\activate`
- Install the required packages:
pip install -r requirements.txt
- clone the repository
- Navigate into the repository
cd Renewable_Energy_Predictions
- Ensure the dataset
renewable_energy.csv
is in the project directory. - Run the script:
python renewabePrediction.py
- The script will load the data, preprocess it, train a linear regression model, and make predictions.
The script will output the following:
- Prediction: Predicted values for the test set.
- Train score: R² score of the model on the training set.
- Test score: R² score of the model on the test set.
- Plots: Scatter plot of the actual vs. predicted values over time, and PCA plot of the training data.
Contributions are welcome! Please fork the repository and create a pull request with your changes.
This project is licensed under the MIT License - see the LICENSE file for details.