Exemplo n.º 1
0
def cumulative_precision(tested, true_ints=None, return_data=False, 
        **kwargs):
    if true_ints:
        tested = cv.tested_from_trues(tested, true_ints)
    hits = [t[3] for t in tested]
    precision = [sum(hits[:i+1])/(i+1) for i in range(len(hits))]
    plot(precision, **kwargs)
    plot([t[2] for t in tested], **kwargs)
    xlabel('Index of PPI')
    ylabel('Cumulative Precision; PPI score')
    legend(['Cumulative Precision','PPI score'])
    if return_data: 
        return precision
Exemplo n.º 2
0
def rolling_scores(tested, true_ints=None, show=1000, window=50, rescale=0,
        **kwargs):
    if rescale > 0:
        tested = [(t[0],t[1],ut.rescale(t[2],rescale), t[3]) for t in tested]
    if true_ints:
        tested = cv.tested_from_trues(tested, true_ints)
    padded = list(np.zeros((50,4)))+list(tested)
    rolling = [len([t for t in padded[i:i+window] if t[3]==1])/window for i in range(show)]
    plot(rolling, **kwargs)
    plot([t[2] for t in tested[:show]], **kwargs)
    xlabel('starting index in scored examples')
    ylabel('fraction true in index:index+%s'%window)
    legend(['fraction true','score'])