implement function to calculate conditional probability of category given some features