image based example for Bayes error/irreducible error I have a hard time intuitively understand the Bayer error in the context of supervised learning. We have an input X and an output Y. We want to find the function f(X) = Y.

I feel like I don't understand why we model X as a random variable in the first place. I think we construct the function f not based on the distribution of X but rather on actual values of X. Why should we care if X is stochastic or not?

Example I:
Let's say X = [1,2,3], Y = [1,2,3] and f(x) = x.
When X=1 => Y=1, X=2 => Y=2, X=3 => Y=3, I will never make an error.

Example II: Why should it be different if X = [picture of dog, picture of cat, picture of house] and Y = [dog, cat, house]. I can still find a function which does the mapping. It is obviously more complex but doable.

Where did the Bayes error get lost in my examples?

I am looking for an intuitive explanation of the Bayes error preferably in the context of image classification.
As an MNIST dataset, see the mispredicted images on this figure below,  you notice for some samples, we as human don't know for sure what is the true label.



Maybe there are other factors that are not visible to us to predict the correct output. 

Assume I want to predict customer will leave our company, maybe there are tons of useful features to start with, yet he may simply have some other problems that we are not aware of, and it may affect his decision in leaving the company.