(self, choosers, alternatives)
Calculate total probability associated with each alternative.

        Parameters
        ----------
        choosers : pandas.DataFrame
            Table describing the agents making choices, e.g. households.
        alternatives : pandas.DataFrame
            Table describing the things from which agents are choosing.

        Returns
        -------
        probs : pandas.Series
            Total probability associated with each alternative.
Calculate total probability associated with each alternative.
Calculate total probability associated with each alternative .
def summed_probabilities(self, choosers, alternatives):
        """
        Calculate total probability associated with each alternative.

        Parameters
        ----------
        choosers : pandas.DataFrame
            Table describing the agents making choices, e.g. households.
        alternatives : pandas.DataFrame
            Table describing the things from which agents are choosing.

        Returns
        -------
        probs : pandas.Series
            Total probability associated with each alternative.

        """
        def normalize(s):
            return s / s.sum()

        choosers, alternatives = self.apply_predict_filters(
            choosers, alternatives)
        probs = self.probabilities(choosers, alternatives, filter_tables=False)

        # groupby the the alternatives ID and sum
        if self.probability_mode == 'single_chooser':
            return (
                normalize(probs) * len(choosers)
                ).reset_index(level=0, drop=True)
        elif self.probability_mode == 'full_product':
            return probs.groupby(level=0).apply(normalize)\
                .groupby(level=1).sum()
        else:
            raise ValueError(
                'Unrecognized probability_mode option: {}'.format(
                    self.probability_mode))
def summed_probabilities ( self , choosers , alternatives ) : def normalize ( s ) : return s / s . sum ( ) choosers , alternatives = self . apply_predict_filters ( choosers , alternatives ) probs = self . probabilities ( choosers , alternatives , filter_tables = False ) # groupby the the alternatives ID and sum if self . probability_mode == 'single_chooser' : return ( normalize ( probs ) * len ( choosers ) ) . reset_index ( level = 0 , drop = True ) elif self . probability_mode == 'full_product' : return probs . groupby ( level = 0 ) . apply ( normalize ) . groupby ( level = 1 ) . sum ( ) else : raise ValueError ( 'Unrecognized probability_mode option: {}' . format ( self . probability_mode ) )