(self, class_probabilities)
return results
Given predicted class probabilites for a set of examples, annotate
        each logit with a class name.

        By default, we name each class using its index in the logits array.

        Args:
            class_probabilities (array): Class probabilities as output by
                `self.predict`, i.e., a numpy array of shape (num_examples,
                num_classes).

        Returns:
            Annotated class probabilities for each input example, as a list of
            dicts where each dict is formatted as:
                {
                    'index': class_index,
                    'name': class_name,
                    'prob': class_probability
                }
Given predicted class probabilites for a set of examples, annotate
        each logit with a class name.
Given predicted class probabilites for a set of examples annotate each logit with a class name .
def decode_prob(self, class_probabilities):
        """Given predicted class probabilites for a set of examples, annotate
        each logit with a class name.

        By default, we name each class using its index in the logits array.

        Args:
            class_probabilities (array): Class probabilities as output by
                `self.predict`, i.e., a numpy array of shape (num_examples,
                num_classes).

        Returns:
            Annotated class probabilities for each input example, as a list of
            dicts where each dict is formatted as:
                {
                    'index': class_index,
                    'name': class_name,
                    'prob': class_probability
                }

        """
        results = []
        for row in class_probabilities:
            entries = []
            for i, prob in enumerate(row):
                entries.append({'index': i,
                                'name': str(i),
                                'prob': prob})

            entries = sorted(entries,
                             key=itemgetter('prob'),
                             reverse=True)[:self.top_probs]

            for entry in entries:
                entry['prob'] = '{:.3f}'.format(entry['prob'])
            results.append(entries)
        return results
def decode_prob ( self , class_probabilities ) : results = [ ] for row in class_probabilities : entries = [ ] for i , prob in enumerate ( row ) : entries . append ( { 'index' : i , 'name' : str ( i ) , 'prob' : prob } ) entries = sorted ( entries , key = itemgetter ( 'prob' ) , reverse = True ) [ : self . top_probs ] for entry in entries : entry [ 'prob' ] = '{:.3f}' . format ( entry [ 'prob' ] ) results . append ( entries ) return results