# WEATHER PREDICTION USING ML ALGORITHMS – AI PROJECTS

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

Firstly, the data is trained. For training the data, we will take 15-20% of the data from the data set. For this prediction, we’ll be using Linear regression algorithm and Naïve Bayesian classification algorithm. For the project, we’ll be using python, NumPy, Jupiter Notebook, Spyder, Panda. The project is split into three separate Jupiter Notebooks: one to collect the weather data, inspect it, and clean it; a second to further refine the features and fit the data to a Linear Regression model and Naïve Bayesian model and a third to train and evaluate our output.

#### Background

The application of science and technology that predicts the state of atmosphere at any given particular time period is known as Weather forecasting. There is a many different methods to weather forecast. Weather forecast notices are important because they can be used to prevent destruction of life and environment. The weather forecasting methods used in the ancient time usually implied pattern recognition i.e., they usually rely on observing patterns of events. For example, it is found that the following day has brought fair weather; if the preceding day sunset is particularly red. However, all of the predictions prove not to be reliable.

Weather forecasting is simply the prediction of future weather based on different parameters of the past like temperature, humidity, dew, wind speed and direction, precipitation, Haze and contents of air, Solar and terrestrial radiation etc. Weather forecast is an important factor affecting people’s lives. Once the data is taken, it is trained. The heart of this project is the Linear Regression 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, dew, pressure and humidity for training the data. Here these data are then trained using Linear Regression for the prediction.

#### Literature Review

There are many research papers that have been published related to predicting the weather [9]. A paper was published on ‘The Weather Forecast Using Data Mining Research Based on Cloud Computing’ This 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 Algorithms and meteorological 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 [9]. 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 [10]. They decided to take temperature, humidity, pressure, wind and various other attributes into consideration [3].

Another research paper titled ‘Issues with weather prediction’ discussed the major problems with weather prediction [11]. Even the simplest weather prediction is not perfect. The one-day forecast typically falls within two degrees of the actual temperature. Although this accuracy isn’t bad, as predictions are made for further in time. For example, in a place like New England where temperatures have a great variance the temperature prediction are more inaccurate than a place like the tropics [4]. Another research paper titled ‘Current weather prediction’ used numerical methods to stimulate what is most likely going to happen based on known state of the atmosphere [12]. For example, if a forecaster is looking at three different numerical models, and two model predict that a storm is going to hit a certain place, the forecaster would most likely predict that the storm is going to hit the area. These numerical models work well and are being tweaked all the time, but they still have errors because some of the equations used by the models aren’t precise [6].

#### Software Requirement

The software used in our projects are:

• Python 3.7: Python is an interpreted, high level, general programming language. Its formatting is visually uncluttered, and it often uses English keywords where other languages use punctuation. It provides a vast library for data mining and predictions.
• Jupiter Notebook/ Spider/ Pycharm: It is an open source cross-platform integrated development environment (IDE) for scientific programming in the Python language. Spyder integrates with a number of prominent packages as well as another open source software.
• Numpy: Numpy was used for building the front-end part of the system.
• Pandas: Pandas was used for the data preprocessing and statistical analysis of data.
• Matplotlib: Matplotlib was used for the graphical representation of our prediction.

#### 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/modify the Dataset.
• The Dataset of the weather must be available for the system.
##### Data collection

The data of weather forecast was obtained from Kaggle. We took about 4000 trained data and 800 test data. Parameters are :-

• Temperature
• Pressure
• Humidity
• Dewpoint
• Rainfall
• Precipitation

#### The steps involved in preprocessing are: –

• Features selection

The data we have collected has many unwanted attributes which will not be needed in our project. Hence, we use the attributes which we need only.

• Normalization

The data we collected from internet should be first normalized. Normalization refers to rescaling real valued numeric attributes into the rage or 0 and 1. After the data are filtered it is then normalized.

• Machine Learning

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.

#### Implementation of Algorithms

The algorithm used in our project are Linear Regression [1] and Naïve Bayes Algorithm [2].

#### Linear Regression

Regression is a method of modelling a target value based on independent predictors. This method is mostly used for forecasting and finding out cause and effect relationship between variables. Regression techniques mostly differ based on the number of independent variables and the type of relationship between the independent and dependent variables.

#### Naïve Bayes Algorithm

Naïve Bayes Algorithm is a probabilistic machine learning algorithm which can be widely used in various classification tasks which is based on Bayes Theorem. The term naïve is given because it assumes the data that is given to the model are independent of each other, that is they have independent distribution. So, if we change the value of one feature than it doesn’t affect the value of other features used in the algorithm.

There are many applications of Naïve Bayes Algorithm like real time prediction, multi class prediction, text classification, spam filtering, recommendation system etc.

However, the algorithm is getting its popularity because of its robustness ability to noise and outliers as well as to irrelevant attributes. The missing values are easily handled. The predictions are made real-quick because of which, it is easily scalable

#### Result

The prediction system works properly. The values of all the attributes were properly preprocessed. After all the preprocessing was completed, model was implemented and it was trained using train data. The GUI for the system was made with tkinter. The coding was done in Pycharm/Spyder. After completing all the process, we connected the front-end with the back-end.

Our accuracy was found to be around 82%.

#### Conclusion

The weather prediction done using linear regression algorithm and Naïve Bayes algorithm are very essential for improving the future performance for the people. For predicting the weather, the linear regression algorithm and Naïve Bayes algorithm 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.

#### References

1. Cohen, J., Cohen P., West, S.G., & Aiken, L.S. (2003). Applied multiple regression/correlation analysis for the behavioral sciences. (2nd ed.) Hillsdale, NJ: Lawrence Erlbaum Associates
2. Janani.B,Priyanka Sebastian. (2014). Analysis on the weather forecasting and technique. (3rd ed). IJARCET.
3. Samenow & Fritz. (2015). Issues with weather prediction.
4. Gould & Bryan. (2017). Current weather prediction.
5. University of Illinois. (2010). Trends.
6. A B M Mazharul Mujib Dalian University of Technology. The Weather Forecast Using Data Mining Research Based on Cloud Computing.
7. Jabani B and Priyanka Sebastian. (2014). Analysis on The Weather Forecasting and Techniques.
8. Samenow and Frirz. (2015). Issues with weather prediction.
9. Gould & Bryan. (2017). Current weather prediction.
###### ↑↑ Help us by clicking Ads ↑↑

This page is contributed by Angad & his team . If you like AIHUB and would like to contribute, you can also write an article & mail your article to itsaihub@gmail.com . See your articles appearing on AI HUB platform and help other AI Enthusiasts.

🚀 I'm Diwas Pandey, a Computer Engineer with an unyielding passion for Artificial Intelligence, currently pursuing a Master's in Computer Science at Washington State University, USA. As a dedicated blogger at AIHUBPROJECTS.COM, I share insights into the cutting-edge developments in AI, and as a Freelancer, I leverage my technical expertise to craft innovative solutions. Join me in bridging the gap between technology and healthcare as we shape a brighter future together! 🌍🤖🔬

View all posts by Diwas →

### 78 Comments on “WEATHER PREDICTION USING ML ALGORITHMS – AI PROJECTS”

1. Helen says:

You made some really good points there.

2. Markovitz says:

Great goods from you, man. I have understand your stuff previous to and you’re just too magnificent

3. Ernestina says:

Thiis page really has all of the info I wanted concerning this subject

4. Bonaparte says:

I’m really impressed with your writing skills

5. Branin says:

hello there and thank you for your information – I’ve definitely picked up anything new from right here

6. Morrisseau says:

Fantastic web site. A lot of useful information here.

7. Kareem says:

Hello every one, here every one is sharing such knowledge, thus it’s good to read this blog, and I used
to pay a visit this weblog all the time.

8. Ahmed says:

site is magnificent, let alone the content!

9. Gia says:

Wonderful article! We are linking to this particularly great article on our
website. Keep up the great writing.

10. Bernie says:

Good answer back in return of this matter with solid arguments and telling the whole thing on the topic of that.

11. Cilfone says:

Good article , thanks and we want more!

12. Freda says:

This piece of writing is truly a nice one it assists new web users, who are wishing in favor of blogging.

13. Syreeta says:

It’s remarkable to pay a visit

14. Chana says:

Wow, that’s what I was exploring for, what a information! present here at
this website, thanks admin of this website.

15. Allie says:

Aw, this was an exceptionally nice post.

16. Clifton says:

I like what you guys tend to be up too.

17. Jon says:

I know I am getting familiarity every day by reading thes good content.

18. Nick says:

whoah this blog is fantastic i love reading your articles.
Stay up the good work! You recognize, many people are looking
round for this information, you could aid them greatly.

19. Bill says:

Hello there, just became conscious of your blog through Google,
and located that it is truly informative. I’m gonna be aware
of brussels. I’ll be grateful when you continue this later
on. Numerous people will be benefited from your writing.
Cheers!

20. Biastock says:

Wow! This can be one particular of the most beneficial blogs We’ve ever arrive across on this subject. Actually Wonderful. I am also an expert in this topic therefore I can understand your hard work.

21. Kellye Tepp says:

of course like your web-site but you have to check the spelling on quite a few of your posts. Several of them are rife with spelling issues and I find it very troublesome to tell the truth nevertheless I’ll surely come back again.

22. Raylene Weinfurter says:

I think this is among the most important info for me. And i’m glad reading your article. But wanna remark on few general things, The website style is wonderful, the articles is really nice : D. Good job, cheers

23. AWL settlement says:

It’s wonderful that yoս are getting thoughts from this articke as welⅼ as from our dіscᥙssion made at this tіme.

Ηi to everʏ bodу, it’s my fist viѕit of this weblog; thiis webpage includes awesome and in fact excellent stuff in support of visitors.

25. suzettecamden says:

Ƭhank you for some other informative blog. Where else could I aam gstting that type օf info written in such
a perfect method? I’ѵe a mission that I’m simply now working
on, and I’ve been at the lоok out for such info.

26. cerita dewasa abg says:

Peculiar article, exactly what I was looking for.

27. sa game says:

the little changes that make the biggest changes.

28. เครดิตฟรี says:

What’s up it’s me, I am also visiting this site on a regular basis, this
web site is really fastidious and the users are really sharing good thoughts.

29. James says:

I just could not depart your website prior to suggesting that I actually
loved the usual info a person provide to your visitors? Is gonna
be again ceaselessly to check out new posts

30. If you would like to take a good deal from this piece of writing then you have to apply such strategies to
your won web site.

31. Pretty element of content. I just stumbled upon your website and in accession capital to say that
I acquire actually loved account your blog posts. Any way I will be subscribing to your
feeds and even I success you get right of entry to persistently rapidly.

32. Hi to every one, the contents existing at this website are actually
remarkable for people experience, well, keep up the good work fellows.

33. Thank you for the auspicious writeup. It in fact was a amusement
account it. Look advanced to more added agreeable from you!
However, how can we communicate?

34. Thanks for every other informative web site. The place else may I get
that kind of information written in such a perfect manner?
I’ve a challenge that I am simply now operating on, and I’ve been on the glance
out for such information.

35. Awesome site you have here but I was curious about if you knew of
any forums that cover the same topics talked about here?
I’d really like to be a part of community where I can get comments from other
knowledgeable individuals that share the same
interest. If you have any recommendations, please let me know.
Bless you!

36. Hello Dear, are you actually visiting this site regularly, if
so afterward you will definitely get fastidious know-how.

37. I used to be recommended this website by way of my cousin.
I’m no longer certain whether this put up is written via him as no one
else realize such targeted about my problem.
You are amazing! Thanks!

38. Useful info. Fortunate me I discovered your website by accident, and I am surprised why this
twist of fate didn’t took place in advance!
I bookmarked it.

39. Very good post! We are linking to this particularly great article on our
site. Keep up the great writing.

40. Appreciation to my father who stated to me regarding this website,
this webpage is genuinely amazing.

41. Hi, constantly i used to check web site posts here
in the early hours in the dawn, for the reason that i enjoy to learn more and more.

42. Fantastic goods from you, man. I have understand your stuff
previous to and you are just extremely wonderful. I actually like
what you’ve acquired here, certainly like what you’re stating and the way in which you say it.
You make it entertaining and you still care for to
keep it wise. I can’t wait to read far more from you.
This is actually a great site.

43. We’re a group of volunteers and opening a new scheme in our community.
Your site provided us with valuable information to work on. You have done
an impressive job and our entire community will be grateful
to you.

44. We stumbled over here by a different page and thought I should check
things out. I like what I see so now i’m following you.
Look forward to looking into your web page again.

45. You are so interesting! I do not think I’ve read through something like this before.
So great to discover another person with genuine thoughts on this subject matter.
Really.. thanks for starting this up. This website is one thing that is required on the web, someone with some originality!

46. Hello i am kavin, its my first time to commenting anywhere,
when i read this article i thought i could also create comment due to this brilliant post.

47. There is definately a great deal to know about this issue.
I really like all the points you made.

48. Somebody essentially assist to make severely posts I
might state. This is the first time I frequented your web page and up to now?
I surprised with the research you made to make this
actual post incredible. Magnificent activity!

49. I used to be suggested this blog by my cousin. I’m now not certain whether or
not this post is written via him as no one else recognize such precise about my problem.
You’re incredible! Thank you!

50. I think the admin of this web page is actually working hard in support
of his site, for the reason that here every material is quality based data.

51. Quality articles or reviews is the key to attract the
visitors to visit the website, that’s what this site is providing.

52. If some one needs expert view regarding blogging after that i suggest him/her to pay
a visit this webpage, Keep up the pleasant job.

53. If you wish for to take much from this piece of writing then you
have to apply these methods to your won website.

54. It’s awesome to pay a quick visit this website and reading
the views of all mates on the topic of this piece of writing, while I
am also zealous of getting experience.

55. Hey there! Quick question that’s completely off topic. Do you
know how to make your site mobile friendly? My web site looks weird when viewing from my apple
iphone. I’m trying to find a theme or plugin that might be able to correct
this issue. If you have any recommendations, please share.

Thanks!

56. Right here is the perfect web site for anyone who wants to understand this topic.
You realize so much its almost hard to argue with you (not that I
personally will need to…HaHa). You certainly put a fresh spin on a topic which has
been written about for ages. Wonderful stuff, just great!

57. Woah! I’m really digging the template/theme of this
blog. It’s simple, yet effective. A lot of
times it’s very hard to get that “perfect balance” between superb usability and appearance.
I must say that you’ve done a superb job with this. Also, the blog
loads very quick for me on Opera. Exceptional Blog!

58. Piece of writing writing is also a excitement, if you know after that you can write if not it is complex to write.

59. Hi, every time i used to check webpage posts here early in the break of day, for the reason that
i love to find out more and more.

60. Like!! I blog frequently and I really thank you for your content. The article has truly peaked my interest.

61. dikshant says:

sir i want the code and the data set aslo please share it i have dm you on your insta account

62. Mostafa says:

Hello,
I need the code of weather prediction project please

63. Tushar Balande says:

I want the code for this.
I sent you a text on Instagram

64. Ayush Bansal says:

I need code and report for this project. i dm you but you dont reply please reply soon

send us again in insta

65. Ayush Bansal says:

sir i need project

66. marwa says:

I want the code but I can’t find the insta page ?

instagram.com/aihub_

67. Nora k. C says:

I need code and report for this project.

dm us in insta AI HUB

68. Outstanding post, I conceive people should learn a lot from this weblog its really user friendly.

69. Kiran says:

#giveaway

70. Suraj says:

I need code and documets for weather prediction project