Search icon CANCEL
Arrow left icon
Explore Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Conferences
Free Learning
Arrow right icon
Arrow up icon
GO TO TOP
Data Science Algorithms in a Week

You're reading from   Data Science Algorithms in a Week Top 7 algorithms for scientific computing, data analysis, and machine learning

Arrow left icon
Product type Paperback
Published in Oct 2018
Publisher Packt
ISBN-13 9781789806076
Length 214 pages
Edition 2nd Edition
Languages
Tools
Arrow right icon
Authors (2):
Arrow left icon
David Toth David Toth
Author Profile Icon David Toth
David Toth
David Natingga David Natingga
Author Profile Icon David Natingga
David Natingga
Arrow right icon
View More author details
Toc

Table of Contents (12) Chapters Close

Preface 1. Classification Using K-Nearest Neighbors 2. Naive Bayes FREE CHAPTER 3. Decision Trees 4. Random Forests 5. Clustering into K Clusters 6. Regression 7. Time Series Analysis 8. Python Reference 9. Statistics 10. Glossary of Algorithms and Methods in Data Science
11. Other Books You May Enjoy

Fahrenheit and Celsius conversion – linear regression on perfect data


Fahrenheit and Celsius degrees are related in a linear way. Given a table with pairs of both Fahrenheit and Celsius degrees, we can estimate the constants to devise a conversion formula from degrees Fahrenheit to degrees Celsius, or vice versa:

⁰F

⁰C

5

-15

14

-10

23

-5

32

0

41

5

50

10

Analysis from first principles

We would like to derive a formula for converting F (degrees Fahrenheit) to C (degrees Celsius), as follows:

Here, a and b are the constants to be found. A graph of the 

 function is a straight line and, thus, is uniquely determined by two points. Therefore, we actually only need two points from the table, say, pairs (F1,C1) and (F2,C2). Then, we will have the following:

Now, we have the following:

 

.

Therefore, we have the following:

Here, let's take the first two pairs (F1,C1)=(5,-15) and (F2,C2)=(14,-10). This will give us the following:

Therefore, the formula to calculate degrees Celsius from degrees Fahrenheit is as follows:

Let...

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 £16.99/month. Cancel anytime