You don’t need us to tell you how important probabilities are in the field of data science right? If you are a beginner in the field, once you brush up the central tendencies, step on to the probabilities.

Read a short history of probability here if you haven’t done so already and it would be a good idea to follow it up with interpretations of probability found here to swim a little deep.

Let us go through some basic terms in probability.

### Function

It is a rule that relates variables. The first variable determines the value of the second variable using this rule.

### The Domain of a Function

It is the set of all input values of a function.

### The Range of a Function

It is the set of all output values of a function.

### Experiment

Actions or situations when repeated produces a set of outcomes.

Let us consider a simple example. I have a major test on Big Data this week for which I haven’t prepared anything for. I must cover 8 topics for the test. To persuade myself to complete, I will reward myself with smoothies as I complete each topic.

Once I complete each topic, I will reward myself with a green smoothie. When I complete half the topics (4 topics), I will reward myself with a cherry smoothie instead of a green smoothie. And finally, when I complete all the topics, I will reward myself with a rainbow smoothie.

Therefore, completing one topic is one experiment/trial and its outcome can be 0 smoothies (if I do not complete it) or 1 green smoothie (if I complete it).

### Sample Space

Set of all possible results of an experiment.

The sample space, S = {Green Smoothie, Cherry Smoothie, Rainbow Smoothie, No Green Smoothie, No Cherry Smoothie, No Rainbow Smoothie}

In our example, we can have a green smoothie if we complete 1 topic. If we do not complete that topic we have no smoothie. Therefore, we can have a maximum of 6 green smoothies until the time we complete the entire syllabus.

When we complete 4 out of 8 topics we get to have a cherry smoothie. If we do not manage to complete until halfway, we can have no cherry smoothie at all.

When we complete 8 out of 8 topics we get to have a rainbow smoothie. If we do complete all topics, we can have no rainbow smoothie.

Hence the sample space, S = {GS, CS, RS, NGS, NCS, NRS}

GS – Green Smoothie, CS – Cherry Smoothie, NGS – No Green Smoothie, NCS – No Cherry Smoothie, RS – Rainbow Smoothie, NRS – No Rainbow Smoothie

### Random Variables

A random variable is a function. The input of this function is the sample space and the output are the events of the sample space that satisfy the function.

A continuous random variable can take any value in an interval from the sample space.

A discrete random variable is countable or finite number of values from the sample space.

Let us consider the discrete random variable X.

X = Number of Green Smoothies

The input values of the function or the domain are the sample space (all possible outcomes) of the experiment.

The number of green smoothies can take any value between and inclusive of 0 and 6. The range of X is (0, 1, 2, 3, 4, 5, 6).

X = (0, 1, 2, 3, 4, 5, 6)

Similarly, Y = Number of Cherry Smoothies, Z = Number of Rainbow Smoothies

As we did in X, we take the sample space as the input and the output values are (0, 1)

Y = (0, 1)

Z = (0,1)

To illustrate the continuous random variable, let us consider me sitting in the smoothie bar. I have completed my first topic and placed the order for my delicious green smoothie. I know it will take at least 10 minutes for it to get ready.

If X is my random variable, then X is the time it takes for my smoothie to arrive between 1 to 10 minutes.

Now we don’t think that’s all you should learn today! Take a blender and put about 4 tablespoons of oatmeal in it along with an apple. Add a few almonds, a cup of milk and give them a nice blend.

You’ve brushed up some of the very basics of probability and you are good to keep driving for the rest of the day with the apple-oat smoothie!

E-mail us at she@shedrivesdata.com to inspire our readers with your story – be it your success story or a lesson learned, share what you learned or send some love to a friend. We would love to hear from you!