Weather Prediction using Machine Learning (Python)

4 min readOct 6, 2020

Weather is a important aspect of a person life as it can help us to know when it will rain and when it will be sunny. Weather forecasting is the attempt to predict the weather condition at some future time and the weather conditions that may be expected. The climatic conditions parameters are based on the temperature, pressure, humidity, dewpoint, rainfall, precipitation, wind speed and size of data set. The parameters temperature, pressure, humidity, dew point, precipitation, rainfall is only considered for experimental analysis.

Firstly, the data is trained. For this prediction, we will be using Auto Regression model. For the project we will using Python, Matplotlib, Pandas, Scikit-learn and Jupyter Notebook.

Let’s earn some knowledge about programming language, libraries and editor used to build this project.

  • Python is an interpreted, high-level and general-purpose programming language. Created by Guido van Rossum and first released in 1991, Python’s design philosophy emphasizes code readability with its notable use of significant whitespace.
  • Matplotlib is a plotting library for the Python programming language and its numerical mathematics extension NumPy. It provides an object-oriented API for embedding plots into applications using general-purpose GUI toolkits like Tkinter, wxPython, Qt, or GTK+. SciPy makes use of Matplotlib.
  • Pandas is a high-level data manipulation tool developed by Wes McKinney. It is built on the Numpy package and its key data structure is called the DataFrame. DataFrames allow you to store and manipulate tabular data in rows of observations and columns of variables.
  • Scikit-learn is a free software machine learning library for the Python programming language. It features various classification, regression and clustering algorithms including support vector machines.
  • Jupyter Notebook is an open-source web application that allows you to create and share documents that contain live code, equations, visualizations and narrative text. Uses include: data cleaning and transformation, numerical simulation, statistical modeling, data visualization, machine learning, and much more.

Weather forecasting is simply the prediction of future weather based on different parameters of the past like temperature, humidity, dew, wind speed and direction. Weather Prediction is an important factor affecting people lives. Once data is taken, it is trained. The heart of this project is the algorithm which is used to predict the weather using these data. The more parameters considered, the higher the accuracy. This project can help many people finding the weather of tomorrow.

The project simply uses temperature for training the data. Here these data are then trained using Auto-Regressive model for the prediction.

There are many research papers that have been published related to predicting the weather. A paper was published. That paper proposes a modern method to develop a service oriented architecture for the weather information systems which forecast weather using these data mining techniques. This can be carried out by using artificial neural network and decision tree algorithm data collected in specific time. Algorithm has presented the best results to generate classification rules for the mean weather variables. The results showed that these data mining techniques can be enough for weather forecasting . Another paper was published on ‘Analysis on The Weather Forecasting and Techniques’ where they decided that artificial neural network and concept of fuzzy logic provides a best solution and prediction comparatively . They decided to take temperature, humidity, pressure, wind and various other attributes into consideration.

Training a model is the process of iteratively improving your prediction equation by looping through the dataset multiple times, each time updating the weight and bias values in the direction indicated by the slope of the cost function (gradient). Training is complete when we reach an acceptable error threshold, or when subsequent training iterations fail to reduce our cost.

Functional Requirements

  • The system must provide the predicted weather
  • The system must have an easy to use interface for using the system for all the users
  • The admin must be able to update the dataset
  • The dataset of the weather must be available for the system

Flow Chart

Flow Chart of our project


Graph of Trained and Predicted Data

Data Collection

Dataset of our project


The prediction system works properly. The values of all the attributes were properly pre-processed. After all the pre-processing was completed, model was implemented and it was trained using train data. Our accuracy was found to be around .


The weather prediction done using auto-regressive model and are very essential for improving the future performance for the people. For predicting the weather, the auto-regressive model was applied to the datasets of the weather. We made a model to predict the weather using some selected input variables collected from Kaggle. The problem with current weather scenario is that we are not able to prepare our self and not able to do some important works. So, for knowing the weather scenario at high accuracy considering every factor that affects in the weather scenario, this model is created.