Beispiel #1
0
    def _build_predictions(self, results, features, labels):
        """Creates the dictionary of predictions that is returned by the model."""
        predictions = flatten_dict({'results': results})
        # Add features and, if available, labels to predictions
        predictions.update(flatten_dict({'features': features}))
        if labels is not None:
            predictions.update(flatten_dict({'labels': labels}))

        if self._losses is not None:
            predictions['losses'] = self._losses

        return predictions
Beispiel #2
0
    def _build_predictions(self, results, features, labels):
        """Creates the dictionary of predictions that is returned by the model."""
        predictions = flatten_dict({'results': results})
        # Add features and, if available, labels to predictions
        predictions.update(flatten_dict({'features': features}))
        if labels is not None:
            predictions.update(flatten_dict({'labels': labels}))

        if self._losses is not None:
            predictions['losses'] = self._losses

        return predictions
Beispiel #3
0
    def _build_predictions(results, features, labels, losses=None):
        """Creates the dictionary of predictions that is returned by the model."""
        predictions = {'results': results}
        # Add features and, if available, labels to predictions
        predictions.update(flatten_dict({'features': features['source_ids']
                                         }))  # TODO: source_ids ?
        if labels is not None:
            predictions.update(flatten_dict({'labels': labels}))

        if losses is not None:
            predictions[
                'losses'] = losses  # TODO: transpose_batch_time(losses)

        return predictions