Lileb-Training/src/utils/plotting.py
def plot_potential_speed(models_aucs, potentials, potential_type, main_viz,
                         model_names, plot_labels, splits):
    """
    Update the AUC vs transfer potential plots.
    :param models_aucs:
    :param potentials:
    :param potential_type:
    :param main_viz:
    :param model_names:
    :param plot_labels:
    :param splits:
    :return:
    """
    aucs_at_x = defaultdict(lambda: defaultdict(list))
    for model_auc, pot, model_name in zip(models_aucs, potentials, model_names):
        # model auc is [{split1:([x1...], [y_1...]), split2:([],[])},
        #               {split1:...}, ...]
        for split, (xs, ys) in model_auc.items():
            if splits and split not in splits:
                continue
            for i, (x, y) in enumerate(zip(xs, ys)):
                aucs_at_x[x]['values'].append((pot, y))
                trace_name = '{}_{}'.format(model_name, split)
                aucs_at_x[x]['labels'].append(plot_labels[trace_name])
                aucs_at_x[x]['legend'].append(trace_name)

    for x, d in aucs_at_x.items():
        opts = {'legend': d['legend'], 'markersize': 5,
                'xlabel': 'Transfer Potential', 'ylabel': 'AuC', 'width': 600,
                'height': 400}

        main_viz.scatter(d['values'], np.array(d['labels']) + 1,
                         win='{}_transaccbis{}'.format(potential_type, x),
                         update='append', opts={
                'title': '{} speed transfer@{}'.format(potential_type, x),
                **opts})

    return aucs_at_x

    Update the AUC vs transfer potential plots.
    :param models_aucs:
    :param potentials:
    :param potential_type:
    :param main_viz:
    :param model_names:
    :param plot_labels:
    :param splits:
    :return:
    
Update the AUC vs transfer potential plots.
Update the AUC vs transfer potential plots .
def plot_potential_speed(models_aucs, potentials, potential_type, main_viz,
                         model_names, plot_labels, splits):
    aucs_at_x = defaultdict(lambda: defaultdict(list))
    for model_auc, pot, model_name in zip(models_aucs, potentials, model_names):
        for split, (xs, ys) in model_auc.items():
            if splits and split not in splits:
                continue
            for i, (x, y) in enumerate(zip(xs, ys)):
                aucs_at_x[x]['values'].append((pot, y))
                trace_name = '{}_{}'.format(model_name, split)
                aucs_at_x[x]['labels'].append(plot_labels[trace_name])
                aucs_at_x[x]['legend'].append(trace_name)
    for x, d in aucs_at_x.items():
        opts = {'legend': d['legend'], 'markersize': 5,
                'xlabel': 'Transfer Potential', 'ylabel': 'AuC', 'width': 600,
                'height': 400}
        main_viz.scatter(d['values'], np.array(d['labels']) + 1,
                         win='{}_transaccbis{}'.format(potential_type, x),
                         update='append', opts={
                'title': '{} speed transfer@{}'.format(potential_type, x),
                **opts})
    return aucs_at_x
def plot_potential_speed ( models_aucs , potentials , potential_type , main_viz , model_names , plot_labels , splits ) : aucs_at_x = defaultdict ( lambda : defaultdict ( list ) ) for model_auc , pot , model_name in zip ( models_aucs , potentials , model_names ) : for split , ( xs , ys ) in model_auc . items ( ) : if splits and split not in splits : continue for i , ( x , y ) in enumerate ( zip ( xs , ys ) ) : aucs_at_x [ x ] [ 'values' ] . append ( ( pot , y ) ) trace_name = '{}_{}' . format ( model_name , split ) aucs_at_x [ x ] [ 'labels' ] . append ( plot_labels [ trace_name ] ) aucs_at_x [ x ] [ 'legend' ] . append ( trace_name ) for x , d in aucs_at_x . items ( ) : opts = { 'legend' : d [ 'legend' ] , 'markersize' : 5 , 'xlabel' : 'Transfer Potential' , 'ylabel' : 'AuC' , 'width' : 600 , 'height' : 400 } main_viz . scatter ( d [ 'values' ] , np . array ( d [ 'labels' ] ) + 1 , win = '{}_transaccbis{}' . format ( potential_type , x ) , update = 'append' , opts = { 'title' : '{} speed transfer@{}' . format ( potential_type , x ) , ** opts } ) return aucs_at_x
Update the AUC vs transfer potential plots.
Update the AUC vs transfer potential plots .
"""
    Update the AUC vs transfer potential plots.
    :param models_aucs:
    :param potentials:
    :param potential_type:
    :param main_viz:
    :param model_names:
    :param plot_labels:
    :param splits:
    :return:
    """ # model auc is [{split1:([x1...], [y_1...]), split2:([],[])}, #               {split1:...}, ...]
None
models_aucs
None
potentials
None
potential_type
None
main_viz
None
model_names
None
plot_labels
None
splits
None