### Probability Distributions and Random Variables

Suppose I had two coins and I flipped both of them. The possible combinations can be two heads, two tails, or one of each. These combinations are all part of a *sample space*.

Now let's take this a step further. Taking the above demonstration, we want to determine the probability that each combination would occur.

Assuming independence, we derive the following probabilities:

All of these probabilities belong in a *probability distribution*.

### Deriving the Naive Bayes formula

In my previous post, I introduced a class of algorithms for solving classification problems. I also mentioned that Naive Bayes is based off of Bayes' theorem. In this post, I will derive Naive Bayes using Bayes' theorem.

### Deriving the Cost Function for Logistic Regression

In my previous post, you saw the derivative of the cost function for logistic regression as:

I bet several of you were thinking, "How on Earth could you derive a cost function like this:

Into a nice function like this:

?"

Well, this post is going to go through the math. Even if you already know it, it's a good algebra and calculus problem. Read more