Skip to content

In this repository, we try to explain the concept of variational Laplace and its use for statistical modelling for people with highschool level mathematics

License

Notifications You must be signed in to change notification settings

AlexLepauvre/variation_laplace_for_dummies

Repository files navigation

Book Cover

Variational Laplace for dummies

Welcome to the Variational Laplace for dummies repository! This project aims to demystify the concepts of Variational Bayes and Laplace Approximation for individuals without a heavy mathematical background. If you're curious about Bayesian statistics but have felt overwhelmed by complex papers and mathematical jargon, this book is for you.

📖 About the Book

As a biologist with (soon) a PhD in consciousness neuroscience, I had minimal exposure to advanced mathematics during my academic journey. My background includes:

  • Using frequentist statistical tools, from simple t-tests to complex linear models.
  • Applying machine learning and multivariate methods in research.

Along the way, I became intrigued by Bayesian statistics due to its flexibility and its alignment with the types of questions I was asking, such as:

  • "How much evidence do I have for a particular hypothesis or theory?"

Bayesian methods provide a formal quantification of evidence, which is invaluable in scientific inquiry.

The Motivation

I specifically got interested in the Variational Laplace method because it offers a way to compute the model evidence part of Bayes' theorem for various models used in neuroscience: the generalized linear model (GLM), which covers both Univariate and multivariate data, mixed and hierarchical designs, as well as dynamical causal model (DCM).

However, I found existing papers on the subject daunting. Not because they were poorly written, but because they assumed a level of mathematical understanding that I—and many others—did not possess. The connections between concepts were often considered "obvious" and left unexplained, making it challenging to follow along.

The Revelation

Determined to understand whether the math was truly that complicated, I spent time breaking down the concepts. To my surprise, I found that:

  • The mathematics can be understood with basic algebra and arithmetic learned in high school.
  • The complexity often arises from unexplained jumps between steps, not from inherently difficult math.

The Solution

This realization led me to create this book:

  • Variational Laplace by a Dummy, for Dummies

I aim to bridge the gap between complex mathematical presentations and accessible understanding.

🛠 How This Book Helps You

To ensure clarity and accessibility, I've employed several strategies:

  • Wordy Explanations: Concepts are explained in detailed, plain language. I repeat important ideas in different ways to reinforce understanding.

  • Mathematical Formulas: Key formulas are provided alongside explanations to connect the verbal descriptions with mathematical expressions.

  • Python Code Translation: Every significant formula is translated into Python code. This serves multiple purposes: Visualization: Code allows for visual representations of concepts. Practical Understanding: Seeing how formulas translate into code can deepen comprehension. Accessibility: It caters to those who might be intimidated by complex formulas but are comfortable with programming.

  • Jupyter Notebooks: The entire book is built using Jupyter notebooks, allowing for interactive exploration: Modify code examples. Visualize outputs immediately. Engage with the material hands-on.

Who Can Benefit?

  • Readers with Basic Math Knowledge: No advanced math background is required.
  • Math Enthusiasts New to Programming: If you're comfortable with math but not programming, the code examples are explained thoroughly.
  • Programmers Intimidated by Complex Formulas: If you understand code better than equations, this book bridges that gap.

⚠️ Important Note

Work in Progress: This book is currently a work in progress. Content is still being developed and refined. Under Review: While I've partnered with a co-author proficient in mathematics who has reviewed the material, it hasn't been fully verified and proofread by mathematicians yet. Use with Caution: Given the above, please take the content with a grain of salt at this time. Feedback and corrections are welcome!

🌟 Goals of the Repository

  • Demystify Complex Concepts: Break down Variational Bayes and Laplace Approximation into understandable segments.
  • Provide a Learning Resource: Serve as a stepping stone for those interested in Bayesian methods but deterred by heavy math.
  • Encourage Exploration: Empower readers to delve into statistical methods applicable across neuroscience and other fields.

📂 Repository Structure

This repository is the code base of this website: I recommend you to read this book by navigating the website. Note that for each chapter containing code, you can open it in google collab by clicking on the google icon atop, so that you can execute it, change values and whatnot.

🤝 Contributions and Feedback

  • Contributions: If you find errors or have suggestions, feel free to submit issues or pull requests.
  • Feedback: Constructive feedback is highly appreciated to improve the content's accuracy and clarity. Submit an issue if there is anything you don't understand or if anything is unclear.

📫 Contact

If you have any questions or would like to discuss the material further, please feel free to reach out by submitting an issue!

About

In this repository, we try to explain the concept of variational Laplace and its use for statistical modelling for people with highschool level mathematics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published