コード例 #1
0
def log_performance(request, perf):
    ec = get_experiment_context(request)

    msg = ec["username"] + " " + str(
        ec["condition"]) + " 0 " + perf["num"] + " VIEW_PERFORMANCE "
    msg = msg + " " + str(perf["total"]) + " " + str(
        perf["score"]) + " " + str(perf["rels"]) + " " + str(perf["nons"])
    event_logger.info(msg)
コード例 #2
0
def log_event(event, request, query="", whooshid=-2, judgement=-2, trecid="", rank=-2, page=-2, doc_length=0, metrics=None):
    ec = get_experiment_context(request)

    msg = ec["username"] + " " + str(ec["condition"]) + " " + str(ec["taskid"]) + " " + str(ec["topicnum"]) + " " + event

    if whooshid > -1:
        event_logger.info(msg + " " + str(whooshid) + " " + trecid + " " + str(doc_length) + " " + str(judgement) + " " + str(rank))
    else:
        if page > 0:
            event_logger.info(msg + " " + str(page))
        elif metrics:
            metrics_string = ""

            # The order in which metrics appear is determined by how they are returned in
            # experiment_functions.get_query_performance_metrics().
            for metric in metrics:
                if type(metric) == int:
                    metrics_string = metrics_string + " " + str(metric)
                else:
                    metrics_string = metrics_string + " " + ("%.4f" % metric)

            event_logger.info(msg + " '" + query + "'" + str(metrics_string))
        else:
            if query and rank > 0:
                event_logger.info(msg + " '" + query + "' " + str(rank))
            elif query:
                event_logger.info(msg + " '" + query + "'")
            else:
                event_logger.info(msg)
コード例 #3
0
def log_performance(request, perf):
    ec = get_experiment_context(request)

    msg = ec["username"] + " " + str(ec["condition"]) + " 0 " + perf["num"] + " VIEW_PERFORMANCE "
    msg = msg + " " + str(perf["total"]) + " " + str(perf["score"]) + " " + str(perf["rels"]) + " " + str(perf["nons"])
    event_logger.info(msg)
コード例 #4
0
def log_event(event,
              request,
              query="",
              whooshid=-2,
              judgement=-2,
              trecid="",
              rank=-2,
              page=-2,
              doc_length=0,
              metrics=None):
    ec = get_experiment_context(request)

    msg = ec["username"] + " " + str(ec["condition"]) + " " + str(
        ec["taskid"]) + " " + str(ec["topicnum"]) + " " + event

    if whooshid > -1:
        event_logger.info(msg + " " + str(whooshid) + " " + trecid + " " +
                          str(doc_length) + " " + str(judgement) + " " +
                          str(rank))
    else:
        if page > 0:
            event_logger.info(msg + " " + str(page))
        elif metrics:
            metrics_string = ""

            # The order in which metrics appear is determined by how they are returned in
            # experiment_functions.get_query_performance_metrics().
            for metric in metrics:
                if type(metric) == int:
                    metrics_string = metrics_string + " " + str(metric)
                else:
                    metrics_string = metrics_string + " " + ("%.4f" % metric)

            event_logger.info(msg + " '" + query + "'" + str(metrics_string))
        else:
            if query and rank > 0:
                event_logger.info(msg + " '" + query + "' " + str(rank))
            elif query:
                event_logger.info(msg + " '" + query + "'")
            else:
                event_logger.info(msg)