Beispiel #1
0
 def average_quantile(s, p):
     negatives, positives = neg_gen(PathQuery(s, p, ''),
                                    't',
                                    return_positives=True)
     pos_query = PathQuery(s, p, positives)
     neg_query = PathQuery(s, p, negatives)
     return util.average_quantile(scores(pos_query), scores(neg_query))
    def performance(query):
        s, r, t = query.s, query.r, query.t
        negatives = neg_gen(query, 't')
        pos_query = PathQuery(s, r, t)
        neg_query = PathQuery(s, r, negatives)

        # don't score queries with no negatives
        if len(negatives) == 0:
            query.quantile = np.nan
        else:
            query.quantile = util.average_quantile(scores(pos_query), scores(neg_query))

        query.num_candidates = len(negatives) + 1

        attributes = query.s, ','.join(query.r), query.t, str(query.quantile), str(query.num_candidates)
        return '\t'.join(attributes)
Beispiel #3
0
    def performance(query):
        s, r, t = query.s, query.r, query.t
        negatives = neg_gen(query, 't')
        pos_query = PathQuery(s, r, t)
        neg_query = PathQuery(s, r, negatives)

        # don't score queries with no negatives
        if len(negatives) == 0:
            query.quantile = np.nan
        else:
            query.quantile = util.average_quantile(scores(pos_query),
                                                   scores(neg_query))

        query.num_candidates = len(negatives) + 1

        attributes = query.s, ','.join(query.r), query.t, str(
            query.quantile), str(query.num_candidates)
        return '\t'.join(attributes)
 def average_quantile(s, p):
     negatives, positives = neg_gen(PathQuery(s, p, ''), 't', return_positives=True)
     pos_query = PathQuery(s, p, positives)
     neg_query = PathQuery(s, p, negatives)
     return util.average_quantile(scores(pos_query), scores(neg_query))