Grocery Store Analogy to Better Understand Hyperparameters and Parameters

Aditya Kakde
2 min readApr 9, 2023

--

Essential machine learning concept, simplified !

A machine learning model’s parameters and hyperparameters are essential components. However, given the complexity of machine learning, it can be difficult to comprehend them. Let’s use an accessible, everyday analogy that everyone can understand to debunk these ideas: navigating through a grocery store.

Hyperparameters

Consider yourself in an unfamiliar grocery store and attempting to locate the dairy section. The question arises, what approach would you use to find it? Would you check each aisle one by one or skip every other aisle? Checking each aisle ensures that you’ll eventually reach the dairy section, but skipping aisles decreases the likelihood of success since you might overlook the aisle you missed. This situation exemplifies a hyperparameter, which is a variable that you choose that can impact your chances of achieving your goal.

Parameters

Suppose you chose to search through each aisle and finally located the dairy section. Now that you know where it is, the next time you visit the store, you can head directly to the dairy aisle without having to search for it. Your mental representation of the store might be something like this: upon entering, turn left and then right, and the dairy section will be on your left. This is an illustration of a parameter, which is what you gained knowledge of after finding the aisle for the first time. You cannot influence or decide how it appears because the dairy aisle always exists in the same location.

Now let’s put ’em all together !

The grocery store analogy is a simplified representation of how hyperparameters and parameters function in machine learning. In actuality, you wouldn’t give much thought to the speed at which you search for the dairy section (unless you’re in a rush). Thus, looking through every aisle would be an obvious choice.

However, in machine learning, we frequently deal with extensive datasets. This implies that, in the context of the grocery store, we may have to search through, for example, 10,000 aisles to locate the dairy section. This is where hyperparameters become critical. Should you spend days scouring every single aisle to find the dairy section? Or would you rather save a few minutes by skipping every 2,000 aisles and accepting a reasonable substitute for milk since you don’t want to spend too much time? It’s your decision to make.

So next time you go grocery shopping, think of yourself as a machine trying to learn ! 🤖

--

--

Aditya Kakde

Food Lover | Tech Enthusiast | Data Science and Machine Learning Developer | Kaggler