Search icon CANCEL
Subscription
0
Cart icon
Your Cart (0 item)
Close icon
You have no products in your basket yet
Save more on your purchases! discount-offer-chevron-icon
Savings automatically calculated. No voucher code required.
Arrow left icon
Explore Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Newsletter Hub
Free Learning
Arrow right icon
timer SALE ENDS IN
0 Days
:
00 Hours
:
00 Minutes
:
00 Seconds
Causal Inference and Discovery in Python
Causal Inference and Discovery in Python

Causal Inference and Discovery in Python: Unlock the secrets of modern causal machine learning with DoWhy, EconML, PyTorch and more

eBook
R$80 R$178.99
Paperback
R$222.99
Subscription
Free Trial
Renews at R$50p/m

What do you get with eBook?

Product feature icon Instant access to your Digital eBook purchase
Product feature icon Download this book in EPUB and PDF formats
Product feature icon Access this title in our online reader with advanced features
Product feature icon DRM FREE - Read whenever, wherever and however you want
Product feature icon AI Assistant (beta) to help accelerate your learning
OR
Modal Close icon
Payment Processing...
tick Completed

Billing Address

Table of content icon View table of contents Preview book icon Preview Book

Causal Inference and Discovery in Python

Causality – Hey, We Have Machine Learning, So Why Even Bother?

Our journey starts here.

In this chapter, we’ll ask a couple of questions about causality.

What is it? Is causal inference different from statistical inference? If so – how?

Do we need causality at all if machine learning seems good enough?

If you have been following the fast-changing machine learning landscape over the last 5 to 10 years, you have likely noticed many examples of – as we like to call it in the machine learning community – the unreasonable effectiveness of modern machine learning algorithms in computer vision, natural language processing, and other areas.

Algorithms such as DALL-E 2 or GPT-3/4 made it not only to the consciousness of the research community but also the general public.

You might ask yourself – if all this stuff works so well, why would we bother and look into something else?

We’ll start this chapter with a brief discussion of the history of causality. Next, we’ll consider a couple of motivations for using a causal rather than purely statistical approach to modeling and we’ll introduce the concept of confounding.

Finally, we’ll see examples of how a causal approach can help us solve challenges in marketing and medicine. By the end of this chapter, you will have a good idea of why and when causal inference can be useful. You’ll be able to explain what confounding is and why it’s important.

In this chapter, we will cover the following:

  • A brief history of causality
  • Motivations to use a causal approach to modeling
  • How not to lose money… and human lives

A brief history of causality

Causality has a long history and has been addressed by most, if not all, advanced cultures that we know about. Aristotle – one of the most prolific philosophers of ancient Greece – claimed that understanding the causal structure of a process is a necessary ingredient of knowledge about this process. Moreover, he argued that being able to answer why-type questions is the essence of scientific explanation (Falcon, 2006; 2022). Aristotle distinguishes four types of causes (material, formal, efficient, and final), an idea that might capture some interesting aspects of reality as much as it might sound counterintuitive to a contemporary reader.

David Hume, a famous 18th-century Scottish philosopher, proposed a more unified framework for cause-effect relationships. Hume starts with an observation that we never observe cause-effect relationships in the world. The only thing we experience is that some events are conjoined:

We only find, that the one does actually, in fact, follow the other. The impulse of one billiard-ball is attended with motion in the second. This is the whole that appears to the outward senses. The mind feels no sentiment or inward impression from this succession of objects: consequently, there is not, in any single, particular instance of cause and effect, any thing which can suggest the idea of power or necessary connexion” (original spelling; Hume & Millican, 2007; originally published in 1739).

One interpretation of Hume’s theory of causality (here simplified for clarity) is the following:

  • We only observe how the movement or appearance of object A precedes the movement or appearance of object B
  • If we experience such a succession a sufficient number of times, we’ll develop a feeling of expectation
  • This feeling of expectation is the essence of our concept of causality (it’s not about the world; it’s about a feeling we develop)

Hume’s theory of causality

The interpretation of Hume’s theory of causality that we give here is not the only one. First, Hume presented another definition of causality in his later work An Enquiry Concerning the Human Understanding (1758). Second, not all scholars would necessarily agree with our interpretation (for example, Archie (2005)).

This theory is very interesting from at least two points of view.

First, elements of this theory have a high resemblance to a very powerful idea in psychology called conditioning. Conditioning is a form of learning. There are multiple types of conditioning, but they all rely on a common foundation – namely, association (hence the name for this type of learning – associative learning). In any type of conditioning, we take some event or object (usually called stimulus) and associate it with some behavior or reaction. Associative learning works across species. You can find it in humans, apes, dogs, and cats, but also in much simpler organisms such as snails (Alexander, Audesirk & Audesirk, 1985).

Conditioning

If you want to learn more about different types of conditioning, check this https://bit.ly/MoreOnConditioning or search for phrases such as classical conditioning versus operant conditioning and names such as Ivan Pavlov and Burrhus Skinner, respectively.

Second, most classic machine learning algorithms also work on the basis of association. When we’re training a neural network in a supervised fashion, we’re trying to find a function that maps input to the output. To do it efficiently, we need to figure out which elements of the input are useful for predicting the output. And, in most cases, association is just good enough for this purpose.

Left arrow icon Right arrow icon
Download code icon Download Code

Key benefits

  • Examine Pearlian causal concepts such as structural causal models, interventions, counterfactuals, and more
  • Discover modern causal inference techniques for average and heterogenous treatment effect estimation
  • Explore and leverage traditional and modern causal discovery methods

Description

Causal methods present unique challenges compared to traditional machine learning and statistics. Learning causality can be challenging, but it offers distinct advantages that elude a purely statistical mindset. Causal Inference and Discovery in Python helps you unlock the potential of causality. You’ll start with basic motivations behind causal thinking and a comprehensive introduction to Pearlian causal concepts, such as structural causal models, interventions, counterfactuals, and more. Each concept is accompanied by a theoretical explanation and a set of practical exercises with Python code. Next, you’ll dive into the world of causal effect estimation, consistently progressing towards modern machine learning methods. Step-by-step, you’ll discover Python causal ecosystem and harness the power of cutting-edge algorithms. You’ll further explore the mechanics of how “causes leave traces” and compare the main families of causal discovery algorithms. The final chapter gives you a broad outlook into the future of causal AI where we examine challenges and opportunities and provide you with a comprehensive list of resources to learn more. By the end of this book, you will be able to build your own models for causal inference and discovery using statistical and machine learning techniques as well as perform basic project assessment.

Who is this book for?

This book is for machine learning engineers, researchers, and data scientists looking to extend their toolkit and explore causal machine learning. It will also help people who’ve worked with causality using other programming languages and now want to switch to Python, those who worked with traditional causal inference and want to learn about causal machine learning, and tech-savvy entrepreneurs who want to go beyond the limitations of traditional ML. You are expected to have basic knowledge of Python and Python scientific libraries along with knowledge of basic probability and statistics.

What you will learn

  • Master the fundamental concepts of causal inference
  • Decipher the mysteries of structural causal models
  • Unleash the power of the 4-step causal inference process in Python
  • Explore advanced uplift modeling techniques
  • Unlock the secrets of modern causal discovery using Python
  • Use causal inference for social impact and community benefit

Product Details

Country selected
Publication date, Length, Edition, Language, ISBN-13
Publication date : May 31, 2023
Length: 456 pages
Edition : 1st
Language : English
ISBN-13 : 9781804611739
Category :
Concepts :

What do you get with eBook?

Product feature icon Instant access to your Digital eBook purchase
Product feature icon Download this book in EPUB and PDF formats
Product feature icon Access this title in our online reader with advanced features
Product feature icon DRM FREE - Read whenever, wherever and however you want
Product feature icon AI Assistant (beta) to help accelerate your learning
OR
Modal Close icon
Payment Processing...
tick Completed

Billing Address

Product Details

Publication date : May 31, 2023
Length: 456 pages
Edition : 1st
Language : English
ISBN-13 : 9781804611739
Category :
Concepts :

Packt Subscriptions

See our plans and pricing
Modal Close icon
R$50 billed monthly
Feature tick icon Unlimited access to Packt's library of 7,000+ practical books and videos
Feature tick icon Constantly refreshed with 50+ new titles a month
Feature tick icon Exclusive Early access to books as they're written
Feature tick icon Solve problems while you work with advanced search and reference features
Feature tick icon Offline reading on the mobile app
Feature tick icon Simple pricing, no contract
R$500 billed annually
Feature tick icon Unlimited access to Packt's library of 7,000+ practical books and videos
Feature tick icon Constantly refreshed with 50+ new titles a month
Feature tick icon Exclusive Early access to books as they're written
Feature tick icon Solve problems while you work with advanced search and reference features
Feature tick icon Offline reading on the mobile app
Feature tick icon Choose a DRM-free eBook or Video every month to keep
Feature tick icon PLUS own as many other DRM-free eBooks or Videos as you like for just R$25 each
Feature tick icon Exclusive print discounts
R$800 billed in 18 months
Feature tick icon Unlimited access to Packt's library of 7,000+ practical books and videos
Feature tick icon Constantly refreshed with 50+ new titles a month
Feature tick icon Exclusive Early access to books as they're written
Feature tick icon Solve problems while you work with advanced search and reference features
Feature tick icon Offline reading on the mobile app
Feature tick icon Choose a DRM-free eBook or Video every month to keep
Feature tick icon PLUS own as many other DRM-free eBooks or Videos as you like for just R$25 each
Feature tick icon Exclusive print discounts

Frequently bought together


Stars icon
Total R$ 808.97
50 Algorithms Every Programmer Should Know
R$278.99
Causal Inference and Discovery in Python
R$222.99
Machine Learning with PyTorch and Scikit-Learn
R$306.99
Total R$ 808.97 Stars icon

Table of Contents

20 Chapters
Part 1: Causality – an Introduction Chevron down icon Chevron up icon
Chapter 1: Causality – Hey, We Have Machine Learning, So Why Even Bother? Chevron down icon Chevron up icon
Chapter 2: Judea Pearl and the Ladder of Causation Chevron down icon Chevron up icon
Chapter 3: Regression, Observations, and Interventions Chevron down icon Chevron up icon
Chapter 4: Graphical Models Chevron down icon Chevron up icon
Chapter 5: Forks, Chains, and Immoralities Chevron down icon Chevron up icon
Part 2: Causal Inference Chevron down icon Chevron up icon
Chapter 6: Nodes, Edges, and Statistical (In)dependence Chevron down icon Chevron up icon
Chapter 7: The Four-Step Process of Causal Inference Chevron down icon Chevron up icon
Chapter 8: Causal Models – Assumptions and Challenges Chevron down icon Chevron up icon
Chapter 9: Causal Inference and Machine Learning – from Matching to Meta-Learners Chevron down icon Chevron up icon
Chapter 10: Causal Inference and Machine Learning – Advanced Estimators, Experiments, Evaluations, and More Chevron down icon Chevron up icon
Chapter 11: Causal Inference and Machine Learning – Deep Learning, NLP, and Beyond Chevron down icon Chevron up icon
Part 3: Causal Discovery Chevron down icon Chevron up icon
Chapter 12: Can I Have a Causal Graph, Please? Chevron down icon Chevron up icon
Chapter 13: Causal Discovery and Machine Learning – from Assumptions to Applications Chevron down icon Chevron up icon
Chapter 14: Causal Discovery and Machine Learning – Advanced Deep Learning and Beyond Chevron down icon Chevron up icon
Chapter 15: Epilogue Chevron down icon Chevron up icon
Index Chevron down icon Chevron up icon
Other Books You May Enjoy Chevron down icon Chevron up icon

Customer reviews

Top Reviews
Rating distribution
Full star icon Full star icon Full star icon Full star icon Half star icon 4.5
(49 Ratings)
5 star 79.6%
4 star 8.2%
3 star 4.1%
2 star 0%
1 star 8.2%
Filter icon Filter
Top Reviews

Filter reviews by




valdez ladd Nov 27, 2023
Full star icon Full star icon Full star icon Full star icon Full star icon 5
Excellent book that show theory with practical examples and generous online references in the book.that avoids overloading the size and mission of the teachings
Feefo Verified review Feefo
N/A Feb 01, 2024
Full star icon Full star icon Full star icon Full star icon Full star icon 5
Excellent book! With many practical examples that can be used as an initial guide to apply causal inference to real problems. The best causal inference book I've ever read (even better than "Causal Inference: for the Brave and True"!)
Feefo Verified review Feefo
Sangita Mahala Jul 31, 2023
Full star icon Full star icon Full star icon Full star icon Full star icon 5
I highly recommend Causal Inference and Discovery in Python to anyone who wants to learn about causal inference and machine learning in Python. The book is well-written, informative, and easy to follow.
Amazon Verified review Amazon
Rohan Singh Rajput Dec 25, 2023
Full star icon Full star icon Full star icon Full star icon Full star icon 5
As someone deeply passionate about the intersection of data science and causal inference, I recently finished reading "Causal Inference and Discovery in Python" by Aleksander Molak. It's a rare gem that brilliantly bridges theoretical concepts and practical application, and I can't help but share my thoughts with you all!🌟 Structure & Content:The book is ingeniously divided into three parts. The first section lays a solid foundation in causality, making a compelling case for its importance beyond conventional statistical methods. The chapters on Judea Pearl's Ladder of Causation are particularly enlightening.The heart of the book lies in Part 2, where Molak delves into the nuts and bolts of causal inference, integrating Python tools like DoWhy and EconML. It's a goldmine for practitioners, offering clarity and depth on complex topics.Part 3 is a forward-looking exploration into causal discovery, blending advanced topics like deep learning with practical applications. It's a testament to the book's commitment to staying at the forefront of causal machine learning.👨‍💻 Practicality & Application:What sets this book apart is its seamless blend of theory and practice. The Python code snippets and real-world examples are not just add-ons but core components that make complex ideas tangible and applicable.📖 Writing Style:Molak's writing is clear, engaging, and accessible. He tackles sophisticated concepts with an ease that speaks of his deep understanding and passion for the subject.🌍 Implications for Data Science:As data science continues to evolve, the importance of causal inference only grows. This book is more than just a resource; it's a guide that empowers you to implement causal inference in real-world scenarios, enhancing your analytical toolkit.In conclusion, "Causal Inference and Discovery in Python" is a must-read for anyone in data science, from students to seasoned professionals. Whether you're looking to deepen your understanding of causal inference or apply it in Python, this book is an invaluable asset.#DataScience #CausalInference #Python #MachineLearning #BookReview #AnalyticsCommunity👉 Highly recommend grabbing a copy if you're looking to stay ahead in the ever-evolving field of data science! 🌐📊🐍
Amazon Verified review Amazon
Judith Hurwitz Sep 11, 2023
Full star icon Full star icon Full star icon Full star icon Full star icon 5
I was eagerly anticipating this book because the author is so knowledgable about the technology behind causal AI and causal Inference. I was not disappointed. The book is very well written and provides the right level of business and technical understanding of an important but complex area. I strongly recommend this important book.
Amazon Verified review Amazon
Get free access to Packt library with over 7500+ books and video courses for 7 days!
Start Free Trial

FAQs

How do I buy and download an eBook? Chevron down icon Chevron up icon

Where there is an eBook version of a title available, you can buy it from the book details for that title. Add either the standalone eBook or the eBook and print book bundle to your shopping cart. Your eBook will show in your cart as a product on its own. After completing checkout and payment in the normal way, you will receive your receipt on the screen containing a link to a personalised PDF download file. This link will remain active for 30 days. You can download backup copies of the file by logging in to your account at any time.

If you already have Adobe reader installed, then clicking on the link will download and open the PDF file directly. If you don't, then save the PDF file on your machine and download the Reader to view it.

Please Note: Packt eBooks are non-returnable and non-refundable.

Packt eBook and Licensing When you buy an eBook from Packt Publishing, completing your purchase means you accept the terms of our licence agreement. Please read the full text of the agreement. In it we have tried to balance the need for the ebook to be usable for you the reader with our needs to protect the rights of us as Publishers and of our authors. In summary, the agreement says:

  • You may make copies of your eBook for your own use onto any machine
  • You may not pass copies of the eBook on to anyone else
How can I make a purchase on your website? Chevron down icon Chevron up icon

If you want to purchase a video course, eBook or Bundle (Print+eBook) please follow below steps:

  1. Register on our website using your email address and the password.
  2. Search for the title by name or ISBN using the search option.
  3. Select the title you want to purchase.
  4. Choose the format you wish to purchase the title in; if you order the Print Book, you get a free eBook copy of the same title. 
  5. Proceed with the checkout process (payment to be made using Credit Card, Debit Cart, or PayPal)
Where can I access support around an eBook? Chevron down icon Chevron up icon
  • If you experience a problem with using or installing Adobe Reader, the contact Adobe directly.
  • To view the errata for the book, see www.packtpub.com/support and view the pages for the title you have.
  • To view your account details or to download a new copy of the book go to www.packtpub.com/account
  • To contact us directly if a problem is not resolved, use www.packtpub.com/contact-us
What eBook formats do Packt support? Chevron down icon Chevron up icon

Our eBooks are currently available in a variety of formats such as PDF and ePubs. In the future, this may well change with trends and development in technology, but please note that our PDFs are not Adobe eBook Reader format, which has greater restrictions on security.

You will need to use Adobe Reader v9 or later in order to read Packt's PDF eBooks.

What are the benefits of eBooks? Chevron down icon Chevron up icon
  • You can get the information you need immediately
  • You can easily take them with you on a laptop
  • You can download them an unlimited number of times
  • You can print them out
  • They are copy-paste enabled
  • They are searchable
  • There is no password protection
  • They are lower price than print
  • They save resources and space
What is an eBook? Chevron down icon Chevron up icon

Packt eBooks are a complete electronic version of the print edition, available in PDF and ePub formats. Every piece of content down to the page numbering is the same. Because we save the costs of printing and shipping the book to you, we are able to offer eBooks at a lower cost than print editions.

When you have purchased an eBook, simply login to your account and click on the link in Your Download Area. We recommend you saving the file to your hard drive before opening it.

For optimal viewing of our eBooks, we recommend you download and install the free Adobe Reader version 9.