This project built on the previous Energy Consumption project to continuing on with data analysis of the different types of energy sources in the United States. We took our analysis further and applied predictive analysis using Machine Learning.
In addition we used Tablaeu for more in depth visualization and trend analysis.
We created 3 Machine Learning models using Deep Learning to provide predictive analysis of Gas and Coal consumption using the key parameters of Temperature effect.
The Tablaeu visualization focused on showing the correlation between the Price of the different energy consumption sources in the residential, industrial and commercial sectors. Visualizations of the price variation for energy consumption across the various US States was created.
Drilling down further to focus on the state of Texas we created visualizations of the effect of average temperature and population growth on Gas and Coal Consumption. Our Machine Learning was also focused on consumption prediction for the state of Texas.
Questions:
Gas Consumption prediction as a function of Temperature and Coal
Energy Consumption and Average Price by Sector and State in US
Temperature correlation with Average Price by Sector
Population growth and its afffect on energy consumption
Historical sources of Energy consumption
The Effect of Temperature on Gas Consumption
Data Visualization
Average electricity price by sector across US
We compared energy price in each sector in every state utilizing July 2018 and July 2019 data:
Hawaii has the highest energy cost in all sectors compare to any other states. For example, in residential sector, it costs 32.44 cents per kw vs. only 11.51 cents per kw in Texas
Energy costs are distributed evenly acorss sectors in Hawaii. In other words, there's not a significant variance in energy cost among residential, commerical or industrial sector. This is because Hawaii has very limited choice of energy sources. Every energey consumer needs to pay a hefty price to use energy.
Texas is a very business friendly state when it comes to energy price. For example, it costs only 5.81 cents per kw in Texas vs. 15.23 cents per kw in California for industrial sector customers
Historical average electricity price in US by sector
Electricity price had remained steady until 1970s when we experienced the first and second oil crisis. The electricity price increased more than 200% during the time period across all sectors.
After the oil crisis in 1970s, prices had been flat until late 2000s when we experienced another price spike. This time during financial crisis.
Residential electricity price costs almost two times more than industrial consumption.
Average temperature from January thru December and the corresponding price per sector
We utilized yearly average temperature from 1976 to 2018 and compare the average electricty price in each sector:
The energy price remains steady despite average temperature change month to month. This is because electricity prices are mainly contract based and does not correlate to temperature changes.
Source of US electricity generation
We analyzed sources of electricity generation from 1950 thru 2018:
Coal: Was increasing year over year unitl late 2000s. Since then, electricity generated by coal has been descreaing consistently.
Natural Gas: Has been increasing year over year since 1980s and has surpassed coal as the major energy source in generating electricity.
Petroleum: Was one of the major energy sources, representing 17% in total electricity generation until late 1970s due to oil crisis. Since then, petroleum represents less than 1% in electricty generation.
Renewable: Has been increasing very slowing since late 2000s. In 2018, it represents 17% of total electricity generation and is expected to increase steadily.
Nuclear: Was increasing steadily from 1970s to 1980. Since then, electricity generated by nuclear has been very flat and we do not expect to see any drastic change from this energy source.
Population Growth and Coal Consumption
Although Coal Consumption was on the increase untill the late 2000s. Since then, electricity generated by coal has been descreaing consistently. The visualization of coal consumption with population shows the current trend of decline in coal consumption despite a continuos increase in population growth. This alligns with the current emphasis on clean energy sources.
Machine Learning
We built a machine learning model to predict gas and coal consumption for Texas.
We studied the correlation of our parameters to determine which variables have
impact on the gas and coal monthly consumption.
Petroleum, year and population are not correlated to gas and coal consumption.
These parameters are dropped when building our models.
We first focused on the average monthly temperature to build our models.
Model 1: Model to predict gas consumption in function of monthly temperature
Model 2: Model to predict coal consumption in function of monthly temperature
Good correlation between gas and coal consumptions suggests that coal consumption can be used to
refine our model.
We built additional model for gas consumption using temperature and coal consumption.
Model 3: Model to predict gas consumption in function of monthly temperature and coal
consumption
Model performance
User interface to run the model
Requirements
Python
To run the app, you need to install flask, sqlAlchemy, sklearn and pickle.
How to run
In terminal, conda activate PythonData
then start the server by typing python app.py
Open the web browser and redirect to your server http://127.0.0.1:5000/