Giter Club home page Giter Club logo

air-pollution-forecasting's Introduction

Air-Pollution-Forecasting

An LSTM model to predict the pollution levels in the next hour using the weather conditions and pollution levels in the current hour. I have trained the model using both uni-variate(if we consider only one feature) and multi-variate(when we consider multiple features for prediction).

Dataset

In this, I have used the Air Quality dataset. This is a dataset that reports on the weather and the level of pollution each hour for five years at the US embassy in Beijing, China. The data includes the date-time, the pollution called PM2.5 concentration, and the weather information including dew point, temperature, pressure, wind direction, wind speed and the cumulative number of hours of snow and rain.

Steps followed

  • Data preparation
  • Data visualization
  • LSTM data preparation
  • Fit model along with regularization term
  • Evaluate model

Data preparation

  • Replace NA values
  • Parse date-time into pandas dataframe index
  • Specified clear names for each columns

Data visualization

  • Used boxplot
  • Correlation matrix

LSTM data preparation

  • Normalized data
  • Transformed dataset into supervised learning problem

Model Fitting

  • Split data into train and test
  • Split into i/p and o/p
  • Reshape into 3D
  • Define 3 layer LSTM architecture with 50 neuron followed by 1 nueron LSTM
  • Add dropout at 20% after every layer

Evaluate model

  • Make prediction
  • Invert scaling
  • Plot the line graph between actual vs predicted values
  • Calculate RMSE(root mean squared errot) and MAPE(mean absolute percentage error)

Results


air-pollution-forecasting's People

Contributors

jyoti0225 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar

air-pollution-forecasting's Issues

Pollution field i.e., target variable in the training set ?

In AirPollutionMultivariate.ipynb
X, Y = to_supervised(scaled_dataset)
X = np.array(X)
Y = np.array(Y)
print('Y' ,Y.shape)
print('X' ,X.shape)
Y (43796, 1)
X (43796, 4, 8)

X which is the input to the model has 8 "features" (# of samples, window_size, # of features). Correct me if I'm wrong but isn't pollution the predictor variable thus it shouldn't be included in the training set.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.