def probability(df, features):
    """
    Calculates the occurence probability of all the categories for every feature.
    
    Parameters
    ----------
    df : panda dataframe
        the dataset of the population
        
    features : dictionary
        a dictionary of features with keys as feature name and values as objects of
        feature class.
        
    Returns
    -------
    features : dictionary
        a dictionary of features with keys as feature name and values as objects of
        feature class with updated probability values.
    """
    for feat in features.keys():
        series = df[feat].value_counts(normalize=True, sort=False)
        for cat in series.index:
            features[feat].categories[cat].prob = series[cat]
    return features
