Stimulus discrimination occurs in psychology when there are different consequences for the same behavior depending on the situation. An example of a stimulus discrimination is a joke that could be told with the result of laughter among a group of friends, but the same joke may have repatriation if it is told in a church hall setting.
A discrimination is formed only when the response of similar behaviors is different in changing situations or environments. This discrimination could be the result of peer attitudes toward the behavior or it could be the result of a intuition that says the behavior is not appropriate in certain situations.
The stimulus discrimination is what will eventually lead to stimulus generalization. The generalization is that a person will respond in the same way to two different stimuli that may have small differences within them. A child will not know the difference between breeds of dogs, but will often know that different breeds are all considered to be dogs. They will not have the discrimination between a German shepherd and a Chihuahua, but will know that both of them are dogs. They will often point out the fact that dogs are dogs, but they may also use discrimination to label them small or large dogs.