A fatal accident inquiry is to be held into the death of a sex predator.