Search icon
Arrow left icon
All Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Newsletters
Free Learning
Arrow right icon
50 Algorithms Every Programmer Should Know - Second Edition

You're reading from  50 Algorithms Every Programmer Should Know - Second Edition

Product type Book
Published in Sep 2023
Publisher Packt
ISBN-13 9781803247762
Pages 538 pages
Edition 2nd Edition
Languages
Author (1):
Imran Ahmad Imran Ahmad
Profile icon Imran Ahmad

Table of Contents (22) Chapters

Preface 1. Section 1: Fundamentals and Core Algorithms
2. Overview of Algorithms 3. Data Structures Used in Algorithms 4. Sorting and Searching Algorithms 5. Designing Algorithms 6. Graph Algorithms 7. Section 2: Machine Learning Algorithms
8. Unsupervised Machine Learning Algorithms 9. Traditional Supervised Learning Algorithms 10. Neural Network Algorithms 11. Algorithms for Natural Language Processing 12. Understanding Sequential Models 13. Advanced Sequential Modeling Algorithms 14. Section 3: Advanced Topics
15. Recommendation Engines 16. Algorithmic Strategies for Data Handling 17. Cryptography 18. Large-Scale Algorithms 19. Practical Considerations 20. Other Books You May Enjoy
21. Index

Practical example – how to predict the weather

Let's see how we can use the concepts developed in this chapter to predict the weather. Let's assume that we want to predict whether it will rain tomorrow based on the data collected over a year for a particular city.The data available to train this model is in the CSV file called weather.csv:

  1. Let's import the data as a pandas data frame:
import numpy as np 
import pandas as pd
df = pd.read_csv("weather.csv")
  1. Let's look at the columns of the data frame:
Text Description automatically generated
  1. Next, let's look at the header of the first 13 columns of the weather.csv data:
A screenshot of a computer Description automatically generated
  1. Now, let's look at the last 10 columns of the weather.csv data:
A picture containing application Description automatically generated
  1. Let's use x to represent the input features. We will drop the Date field for the feature list as it is not useful in the context of predictions. We will also drop the RainTomorrow label:
x = df.drop(['Date','RainTomorrow...
lock icon The rest of the chapter is locked
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at $15.99/month. Cancel anytime}