def main():
    args = parse_args()
    print('Loading data file...')
    filename = (args.data_dir + '/{}.json'.format(args.dataset))
    with open(filename, 'r') as infile:
        data = json.load(infile, encoding='utf8')
    labels = [d['relation'] for d in data]
    print('Loading {} prediction files...'.format(len(args.pred_files)))
    scores_list = []
    for path in args.pred_files:
        with open(path, 'rb') as infile:
            scores = pickle.load(infile)
            scores_list += [scores]
    print('Calculating ensembled predictions...')
    predictions = []
    scores_by_examples = list(zip(*scores_list))
    assert (len(scores_by_examples) == len(data))
    for scores in scores_by_examples:
        if (len(args.weights) == 0):
            pred = ensemble(scores)
        else:
            pred = weight_sum(scores, args.weights)
        predictions += [pred]
    id2label = dict([(v, k) for (k, v) in constant.LABEL_TO_ID.items()])
    predictions = [id2label[p] for p in predictions]
    scorer.score(labels, predictions, verbose=True)
def main():
    args = parse_args()
    print('Loading data file...')
    filename = (args.data_dir + '/{}.json'.format(args.dataset))
    with open(filename, 'r') as infile:
        data = json.load(infile, encoding='utf8')
    labels = [d['relation'] for d in data]
    print('Loading {} prediction files...'.format(len(args.pred_files)))
    scores_list = []
    for path in args.pred_files:
        with open(path, 'rb') as infile:
            scores = pickle.load(infile)
            scores_list += [scores]
    print('Calculating ensembled predictions...')
    predictions = []
    scores_by_examples = list(zip(*scores_list))
    assert (len(scores_by_examples) == len(data))
    for scores in scores_by_examples:
        if (len(args.weights) == 0):
            pred = ensemble(scores)
        else:
            pred = weight_sum(scores, args.weights)
        predictions += [pred]
    id2label = dict([(v, k) for (k, v) in constant.LABEL_TO_ID.items()])
    predictions = [id2label[p] for p in predictions]
    scorer.score(labels, predictions, verbose=True)