For simplicity, we can start with an example. Suppose you have a dataset of 100 apples, and you've built a…