implement code to calculate probability for a given category