# Analysis and Prediction of Electricity Consumption (ÄLLITÄ Project) - Savonia AMK

> This article is a continuation of first article ÄLLITÄ project. The focus of this article will be on WP2 (data and artificial intelligence in smart energy solutions), and further data analysis will be discussed for electricity consumption data alongside weather data and prediction of electricity consumption with base model (linear regression model).

## Project Overview
This article continues the work of the ÄLLITÄ project, focusing on WP2: data and artificial intelligence in smart energy solutions. The study analyzes electricity consumption data in conjunction with weather data to develop a base prediction model using linear regression.

## Data Collection and Processing
Weather data for Varkaus was obtained from the Ilmatieteen laitos weather station, located 1 kilometer from the pilot site (Savonia’s campus at Varkaus). The dataset covers the period from January 01, 2023, to April 30, 2024, with 1-hour intervals, matching the electricity consumption data.

The weather dataset includes the following features:
* Air temperature mean [°C]
* Dew-point temperature mean [°C]
* Cloud cover [1/8] (0 = clear skies, 8 = overcast, 9 = undetermined)
* Air pressure mean [hPa]
* Relative humidity mean [%]
* Precipitation amount mean [mm]
* Snow depth mean [cm]
* Horizontal visibility mean [m]
* Wind direction mean [°]
* Gust speed mean [m/s]
* Wind speed mean [s]

Missing and null values were processed before merging the weather and electricity datasets. The final combined dataset contains 11,662 records.

## Data Analysis
Descriptive statistics were performed on the combined dataset. Analysis of the electricity consumption distribution (using a histogram with 50 bins) indicates that consumption typically ranges between 20 to 45 kWh. The data does not follow a perfectly normal distribution, showing a skewness of 0.11 (slightly right-skewed) and a kurtosis of -0.27 (light-tailed).

Pearson correlation analysis revealed:
* **Positive correlation:** Snow depth.
* **Negative correlation:** Air temperature and dew-point temperature.
* **Other features:** No significant correlation with electricity consumption.

## Prediction Model
A Linear Regression (LR) algorithm was implemented as a base model. The following features were selected based on their correlation coefficients:
* Air temperature mean [°C]
* Dew-point temperature mean [°C]
* Cloud cover [1/8]
* Snow depth mean [cm]
* Relative humidity mean [%]

The data was split into training (80%) and testing (20%) sets. The model evaluation metrics for the test data are:
* **Mean Absolute Error (MAE):** 4.85
* **Mean Squared Error (MSE):** 40.09
* **Root Mean Squared Error (RMSE):** 6.33
* **R²:** 0.10

Future articles will explore time features, lag features, feature engineering, and more robust AI models.

## Authors
* **Shahbaz Baig**, RDI Specialist, DigiCenter, Savonia-ammattikorkeakoulu, shahbaz.baig@savonia.fi
* **Premton Canamusa**, RDI Specialist, DigiCenter, Savonia-ammattikorkeakoulu, premton.canamusa@savonia.fi
* **Mika Leskinen**, RDI Specialist, DigiCenter, Savonia-ammattikorkeakoulu, mika.leskinen@savonia.fi
* **Aki Happonen**, Digikehityspäällikkö, DigiCenter, Savonia-ammattikorkeakoulu, aki.happonen@savonia.fi
* **Laura Leppänen**, RDI Specialist, Savonia-ammattikorkeakoulu Oy, laura.leppanen@savonia.fi

***

*18.10.2024 | Articles | Pro | DigiCenter North Savo | Energy Technology | RDI | TKI*
*This work is licensed under CC BY-SA 4.0*