Example #1
0
def draw_group_all(group_repos, methods, xticks=None, legends=None):
    eval_funs = []
    if legends is None:
        legends = []
    for wm in methods:
        title = ' + '.join([method_name.get(m, "User-based Jaccard with Time Range") for m, w in wm])
        legends.append(title)
        print "Processing: " + title
        find_similar_repo_func = functools.partial(eval.find_mix, weighted_methods=wm)
        eval_f = functools.partial(eval.eval_group_repos, group_repos, find_similar_repo_func)
        eval_funs.append(eval_f)
        pl, rl, f1 = eval_f()
        eval.plot_f1score(f1, pl, rl, "Depth-Score Curve Using " + title)
        eval.plot_precision_recall(pl, rl, "Recall-Precision Curve Using " + title)

    print "Processing Comparison..."
    length = len(methods)

    if xticks is None:
        xticks = ["Method " + str(i) for i in range(1, length+1)]

    # if legends is None:
    #     legends = ["Jaccard", "Time-aware Jaccard", "User-based LDA",
    #             "User-based TFIDF", "Text-based LDA", "Text-based TFIDF"]

    eval.plot_comparison(eval_funs, xticks, legends,
                         "Methods Comparison")
Example #2
0
def draw_precision_recall():
    weighted_methods = [(jaccard_time, 1)]
    find_similar_repo_func = functools.partial(eval.find_mix, weighted_methods=weighted_methods)
    pl, rl, f1 = eval.eval_single_repo("matplotlib/matplotlib", showcase.sc_data_visualization, find_similar_repo_func)
    eval.plot_precision_recall(pl, rl, "Depth-Score Curve Using User-based Jaccard with Time Range")