def plotBias()

in analysis/analyze.py [0:0]


def plotBias(dat, x='query_idx', unit='qid', column=alt.Undefined, row=alt.Undefined, normalize_by=None, normalize_by_sqrt=False):
    unit = makeListLike(unit)
    raw_aggdat = rawAggregateExperimentResults(dat, by=[x, column, row] + unit)
    
    title, yaxis = makePlotLabels(column=column, row=row, normalize_by=normalize_by, normalize_by_sqrt=normalize_by_sqrt, base_title="Bias")
    
    chart = alt.Chart().mark_line().encode(
        x=f"{x}:Q", 
        y=alt.Y('bias:Q', title="bias"), 
    )
    
    error_bars = alt.Chart().mark_area(opacity=0.3).encode(
        x=f"{x}:Q", 
        y=alt.Y('bias_lower95:Q', title="bias"),
        y2='bias_upper95:Q', 
    )
    
    combined_chart = alt.layer(chart, error_bars, data = raw_aggdat).facet(
        column=column, row=row
    ).properties(
        title=title
    )
    return (combined_chart, raw_aggdat)