As nouns,
self-flagellation is a hyponym of
self-punishment; that is, self-flagellation is a
word with a more specific, narrower meaning than
self-punishment:
self-punishment: punishment inflicted on yourself
self-flagellation: self-punishment inflicted by whipping