I Built a Transformer from Scratch So You Don’t Have To

PyData Global 2025 Recap

Author

Oren Bochman

pydata global

pydata global
TipLecture Overview

Switch or stay, what do you say? And more importantly, why?

The Monty Hall Problem is a well-known brain teaser from which we can learn important lessons in decision making that are useful in general and in particular for data scientists.

If you are not familiar with this problem, prepare to be perplexed 🤯. If you are, I hope to shine light on aspects that you might not have considered 💡.

I introduce the problem and solve with three types of intuitions: Common, Bayesian and Causal. I summarise with a discussion on lessons learnt for better data decision making.

Imagine you’re a contestant on a game show. Three doors stand before you: behind one is a prize car, behind the other two are goats. You choose a door, and the host—who knows what’s behind each—reveals a goat behind one of the doors you didn’t pick. Now you’re asked: “Do you want to switch your choice or stay?”

This is the essence of the Monty Hall Problem, a classic puzzle that famously baffles our intuitions about probability. While it may seem like just a fun brain teaser, it offers profound lessons for decision-making under uncertainty.

In this talk, we’ll break down the Monty Hall Problem, explore its counterintuitive nature, and uncover what it teaches us about probabilistic reasoning and critical thinking. Together, we’ll navigate multiple perspectives.

Key Topics:

TipWhat You’ll Learn:
  • A clear understanding of the Monty Hall Problem and its solution
  • Insights into the pitfalls of intuitive probability judgments
  • Strategies for approaching complex decisions and probabilistic reasoning
TipPrerequisites:
  • Basic Python and PyTorch
  • Some familiarity with neural networks (e.g., feedforward, softmax)
  • No need for prior experience in building models from scratch

This session is for data scientists, analysts, and decision-makers at all experience levels. No advanced math is required—just curiosity and a willingness to rethink what you know about probability.

Join me to discover how a seemingly trivial game show puzzle can sharpen your decision-making skills and elevate your approach to statistics, data science, and beyond.

TipSpeakers:

Eyal Kazin

I’m an Ex-cosmologist turned data scientist with 20 years experience in solving challenging problems. I am motivated by intellectual challenges, highly detail oriented and love visualising data results to communicate insights for better decisions within organisations.

My main drive is applying scientific approaches that result in practical and clear solutions. To accomplish these, I use whatever works, be it statistical/causal inference, machine/deep learning or optimisation algorithms. Being result driven I have a passion for facilitating stakeholders to make data driven decisions by quantifying and communicating the impact of interventions to non-specialist audiences in an accessible manner.

In my free time I craft engaging articles on applied stats in data science and machine learning: https://medium.com/(eyal-kazin?)

My claim for fame is that between 2004-2014 I lived in four different continents within a span of a decade, including three tennis Grand Slam cities (NYC, Melbourne, London).

Outline

For this talk I skip reproducing the slides as there are 60+ slides covering the material. Instead I provide links to the relevant resources:

Reflections

The Monty Hall problem is usually introduced to students together with conditional probability and Bayes theorem.

I found it passing strange that a data scientist would do a deep dive into this topic.

But even the legendry Bayesian Physicist David J. C. MacKay in his famous book “Information Theory, Inference, and Learning Algorithms” devotes a chapter to this problem. Disguising it as a new problem.

In retrospect, I can see that this is a good exposition of the problem and may revise my own notes to include both Monty Hall and the Card Matching problem.

Citation

BibTeX citation:
@online{bochman,
  author = {Bochman, Oren},
  title = {I {Built} a {Transformer} from {Scratch} {So} {You} {Don’t}
    {Have} {To}},
  url = {https://orenbochman.github.io/posts/2025/2025-12-10-pydata-monty-hall/},
  langid = {en}
}
For attribution, please cite this work as:
Bochman, Oren. n.d. “I Built a Transformer from Scratch So You Don’t Have To.” https://orenbochman.github.io/posts/2025/2025-12-10-pydata-monty-hall/.