Book Image

Principles of Data Science

Book Image

Principles of Data Science

Overview of this book

Need to turn your skills at programming into effective data science skills? Principles of Data Science is created to help you join the dots between mathematics, programming, and business analysis. With this book, you’ll feel confident about asking—and answering—complex and sophisticated questions of your data to move from abstract and raw statistics to actionable ideas. With a unique approach that bridges the gap between mathematics and computer science, this books takes you through the entire data science pipeline. Beginning with cleaning and preparing data, and effective data mining strategies and techniques, you’ll move on to build a comprehensive picture of how every piece of the data science puzzle fits together. Learn the fundamentals of computational mathematics and statistics, as well as some pseudocode being used today by data scientists and analysts. You’ll get to grips with machine learning, discover the statistical models that help you take control and navigate even the densest datasets, and find out how to create powerful visualizations that communicate what your data means.
Table of Contents (20 chapters)
Principles of Data Science
Credits
About the Author
About the Reviewers
www.PacktPub.com
Preface
Index

The rules of probability


In probability, we have some rules that become very useful when visualization gets too cumbersome. These rules help us calculate compound probabilities with ease.

The addition rule

The addition rule is used to calculate the probability of either or events. To calculate P(A B) = P(A or B), we use the following formula:

P(A B) = P(A) + P(B) − P(A ∩ B)

The first part of the formula (P(A) + P(B)) makes complete sense. To get the union of the two events, we have to add together the area of the circles in the universe. But why the subtraction of P(A and B)? This is because when we add the two circles, we are adding the area of intersection twice, as shown in the following diagram:

See how both the red circles include the intersection of A and B? So, when we add them, we need to subtract just one of them to account for this, leaving us with our formula.

Recall that we wanted the number of people who either had cancer or had a positive test result? If A is the event that someone...