Introduction

Welcome back to Building Probability Models! You are now on lesson three of five, meaning you have crossed the halfway mark of this course. So far, you have learned how to check whether a probability model is valid and how to build a uniform model for equally likely outcomes. Those skills form a solid foundation for what comes next.

In this lesson, we tackle the kind of situation you will encounter most often in the real world: outcomes that are not equally likely. We will learn how to construct a non-uniform probability model from observed data or known rates, verify it, and use it to find event probabilities. The same build–verify–use workflow you practiced last time still applies, but the way we assign probabilities changes.

When Outcomes Are Not Equally Likely

A uniform model gives every outcome the same probability. That works well for fair coins, balanced dice, and random draws. But many everyday situations do not split evenly. Think of a clothing store tracking returns by reason: "wrong size" might account for half of all returns, while "defective item" might be quite rare. Or consider a city's weather patterns, where sunny days could be far more common than snowy ones.

When some outcomes naturally occur more often than others, forcing equal probabilities would misrepresent reality. Instead, we need a model that lets each outcome carry its own weight, and that is exactly what a non-uniform probability model provides.

Two pie charts comparing a uniform model with equal slices to a non-uniform model with unequal slices
Building a Non-Uniform Model from Data

The most common way to assign unequal probabilities is to use observed data. Earlier in this learning path you saw that relative frequency is a natural estimate of probability. The same idea drives non-uniform model construction: divide each outcome's count by the total number of observations.

P(outcome)=number of times the outcome occurredtotal number of observationsP(\text{outcome}) = \frac{\text{number of times the outcome occurred}}{\text{total number of observations}}

Let us see this in action. A bakery tracked its last 200200 muffin orders and recorded the following counts:

Verifying the Model

Building a model is only useful if the result is valid. Every probability model must still satisfy the two requirements you learned in the first lesson of this course. Let us check them for the bakery model.

Requirement 1 — each probability is between 00 and 11: The values 0.400.40, 0.300.30, 0.200.20, and 0.100.10 all fall within the range . ✓

Using the Model to Find Event Probabilities

Once the model is built and verified, we find event probabilities the same way we did with uniform models: sum the probabilities of all favorable outcomes in the event.

P(event)=P(favorable outcomes)P(\text{event}) = \sum P(\text{favorable outcomes})

The key difference is that we can no longer use the kn\frac{k}{n} shortcut from uniform models, because the individual probabilities are not all equal. We must add each favorable outcome's specific probability.

Classifying Tech Support Tickets: A Complete Example

Let us practice the full build–verify–use workflow with a fresh scenario. A tech company reviewed its last 400400 support tickets and sorted them by issue type:

Issue TypeTickets
Software Bug160
Account Access100
Billing Question80
Hardware Issue60

Step 1 — Build the model. Divide each count by the total of 400400:

Issue TypeProbability
Software Bug160400=0.40\frac{160}{400} = 0.40
Conclusion and Next Steps

A non-uniform probability model assigns different probabilities to different outcomes, capturing the reality that some results are more common than others. We build these models by dividing each outcome's observed frequency by the total number of observations, though probabilities can also come from known proportions or historical rates. The model is valid as long as every probability falls between 00 and 11 and the sum equals 11. To find the probability of an event, we sum the probabilities of all favorable outcomes, just as we did with uniform models.

Up next, you will put these ideas into practice by building non-uniform models from real-world data, spotting valid models among impostors, and computing event probabilities across a variety of everyday scenarios. Jump in and see how rewarding it is to turn messy, unequal data into a clean and useful probability model!

Sign up
Join the 1M+ learners on CodeSignal
Be a part of our community of 1M+ users who develop and demonstrate their skills on CodeSignal