Studied Mathematics, graduated in Cryptanalysis, working as a Data Scientist. Interested in algorithms, probability theory, and machine learning. Python user.

Giving an intuition on why Bagging algorithms actually work and displaying the effects of them in an easy and approachable way

Image for post
Image for post

There exist a vast amount of great articles describing how Bagging methods like Random Forests work on an algorithmic level and why Bagging is a good thing to do. Usually, the essence is the following:

“You train a lot of Decision Trees on different parts of the training set and average their predictions into a final prediction. The prediction gets better, because the variance of the Random Forest is smaller compared to the variance of a single Decision Tree. (dartboard.png)”

— some article

Of course, I am paraphrasing here. The articles include great pictures, code, and many more thoughts. But…

Learn about recursion and merge sort with code in Python

Image for post
Image for post

Recursion is an important concept in mathematics and computer science that comes in many flavors. The essence of them is the following:

There is an object that consists of smaller versions of itself. Usually there is a smallest, atomic object — this is where the recursion ends.

We are especially interested in solving problems using recursions. For example, sorting numbers or other elements, i.e. turning an input array like
[1, 4, 5, 2, 6, 3, 6] into [1, 2, 3, 4, 5, 6, 6] .

This is a fundamental problem in computer science and has been extensively studied by many…

Maybe the most interesting proof method

Image for post
Image for post


In mathematics, there are thousands of theorems to be proven. Often, we tailor unique proofs for one of these theorems — this can be beautiful, but extremely difficult at the same time. Think about proofs to theorems that involve constructing a desired object.

As a small example, consider the following “theorem”:

Learn how the k-Nearest Neighbors Classifier works and implement it in Python

Image for post
Image for post

Another day, another classic algorithm: k-nearest neighbors. Like the naive Bayes classifier, it’s a rather simple method to solve classification problems. The algorithm is intuitive and has an unbeatable training time, which makes it a great candidate to learn when you just start off your machine learning career. Having said this, making predictions is painfully slow, especially for large datasets. The performance for datasets with many features might also not be overwhelming, due to the curse of dimensionality.

In this article, you will learn

  • how the k-nearest neighbors classifier works
  • why it was designed like this
  • why it has these…

Learn how Gaussian Naive Bayes works and implement it in Python

Image for post
Image for post

I think this is a classic at the beginning of each data science career: the Naive Bayes Classifier. Or I should rather say the family of naive Bayes classifiers, as they come in many flavors. For example, there is a multinomial naive Bayes, a Bernoulli naive Bayes, and also a Gaussian naive Bayes classifier, each different in only one small detail, as we will find out. The naive Bayes algorithms are quite simple in design but proved useful in many complex real-world situations.

In this article, you can learn

  • how the naive Bayes classifiers work,
  • why it makes sense to…

A simple, yet flexible process to model numerous problems

Image for post
Image for post


In this article, I want to introduce you to a neat and simple stochastic process that goes as follows:

m balls are thrown randomly into n bins. The target bin for each of the m balls is determined uniformly and independently of the other throws.

Hands-on Tutorials

Learn how to infer model parameters and make predictions for new data, including uncertainty estimations

Image for post
Image for post

In this article, we will see how to conduct Bayesian linear regression with PyMC3. If you got here without knowing what Bayes or PyMC3 is, don’t worry! You can use my articles as a primer

You can view Bayesian linear regression as a more verbose version of standard linear regression. Linear regression gives you single values, for the model parameters as well as the predictions. Bayesian linear regression, in turn, gives you distributions.

Revisiting the coin example and using PyMC3 to solve it computationally

Image for post
Image for post


We have covered the intuition and basics of Bayesian inference in my article A gentle Introduction to Bayesian Inference. We then moved on to actually conducting Bayesian inference by hand using a coin example in my article Beginner-friendly Bayesian Inference.

If you still feel unsure about this topic, take a look at them, and have fun! 😊

The famous Coin Example revisited


Let us recall the problem definition: Imagine that you flip a coin with 0 on one and 1 on the other side a hundred times and write down the results. You end up with

1, 1, 0, 0, 0, 1, 1, 1, 1…

Let’s do Bayesian inference hands-on with a classical coin example!

Image for post
Image for post


If you have read my article “A gentle Introduction to Bayesian Inference” (I hope you did!), you already know a bit about the Bayesian approach. In short:

If you are going Bayesian, you start with a prior belief, update this belief using observed data and end up with a posterior belief.

This approach feels very natural because this is what we humans do: We start off with a certain worldview, for example, because of what our parents told us. During the course of our life, we then gather different experiences that change these beliefs.

However, expressing these things mathematically might…

Learn about the difference between the frequentist and the Bayesian approach of reasoning

Image for post
Image for post

A short Story

The three friends Frequentist Frank, Stubborn Stu, and Bayesian Betty go to a funfair where a mysterious-looking tent catches their eyes. Inside, they meet Claire Voyant who claims to be a… fortune teller. The friends don’t believe her, of course — they need proof. So they conduct a little experiment:

The friends take a normal deck of cards. Frank shuffles it and draws a card randomly, not showing it to Claire. He asks her to name the color of the card he has just drawn; red or black.

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store