convolutional_attention/f1_evaluator.py
def compute_names_f1(self, features, real_targets, token_dictionary):
        """
        Compute the top X predictions for each paragraph vector.
        :param features:
        :param token_dictionary: contains all the non-unk words
        :rtype: PointSuggestionEvaluator
        """
        result_accumulator = PointSuggestionEvaluator()
        for i in xrange(features.shape[0]):
            result = self.model.predict_name(np.atleast_2d(features[i]))
            #print real_targets[i], result

            confidences = [suggestion[1] for suggestion in result]
            is_correct = [','.join(suggestion[0]) == real_targets[i] for suggestion in result]
            is_unkd = [is_unk(''.join(suggestion[0])) for suggestion in result]
            unk_word_accuracy = [self.unk_acc(suggestion[0], real_targets[i].split(','), token_dictionary) for suggestion in result]
            precision_recall = [token_precision_recall(suggestion[0], real_targets[i].split(',')) for suggestion in result]
            result_accumulator.add_result(confidences, is_correct, is_unkd, precision_recall, unk_word_accuracy)

        return result_accumulator

        Compute the top X predictions for each paragraph vector.
        :param features:
        :param token_dictionary: contains all the non-unk words
        :rtype: PointSuggestionEvaluator
        
Compute the top X predictions for each paragraph vector.
Compute the top X predictions for each paragraph vector .
def compute_names_f1(self, features, real_targets, token_dictionary):
        result_accumulator = PointSuggestionEvaluator()
        for i in xrange(features.shape[0]):
            result = self.model.predict_name(np.atleast_2d(features[i]))
            confidences = [suggestion[1] for suggestion in result]
            is_correct = [','.join(suggestion[0]) == real_targets[i] for suggestion in result]
            is_unkd = [is_unk(''.join(suggestion[0])) for suggestion in result]
            unk_word_accuracy = [self.unk_acc(suggestion[0], real_targets[i].split(','), token_dictionary) for suggestion in result]
            precision_recall = [token_precision_recall(suggestion[0], real_targets[i].split(',')) for suggestion in result]
            result_accumulator.add_result(confidences, is_correct, is_unkd, precision_recall, unk_word_accuracy)
        return result_accumulator
def compute_names_f1 ( self , features , real_targets , token_dictionary ) : result_accumulator = PointSuggestionEvaluator ( ) for i in xrange ( features . shape [ 0 ] ) : result = self . model . predict_name ( np . atleast_2d ( features [ i ] ) ) confidences = [ suggestion [ 1 ] for suggestion in result ] is_correct = [ ',' . join ( suggestion [ 0 ] ) == real_targets [ i ] for suggestion in result ] is_unkd = [ is_unk ( '' . join ( suggestion [ 0 ] ) ) for suggestion in result ] unk_word_accuracy = [ self . unk_acc ( suggestion [ 0 ] , real_targets [ i ] . split ( ',' ) , token_dictionary ) for suggestion in result ] precision_recall = [ token_precision_recall ( suggestion [ 0 ] , real_targets [ i ] . split ( ',' ) ) for suggestion in result ] result_accumulator . add_result ( confidences , is_correct , is_unkd , precision_recall , unk_word_accuracy ) return result_accumulator
Compute the top X predictions for each paragraph vector.
Compute the top X predictions for each paragraph vector .
"""
        Compute the top X predictions for each paragraph vector.
        :param features:
        :param token_dictionary: contains all the non-unk words
        :rtype: PointSuggestionEvaluator
        """ #print real_targets[i], result
None
PointSuggestionEvaluator
self
features
None
real_targets
token_dictionary
contains all the non-unk words
contains all the non - unk words