cadcad_machine_search/visualizations/sensitivity.py
def kpi_sensitivity_plot(df: pd.DataFrame,
                         run_utility: callable,
                         control_params: set,
                         label: str = 'target'):
    """
    Plots the sensitivity of a result dataset towards a KPI.

    Arguments
    df: data frame containing all the simulation results, incl params.
    run_utility: function that aggregates a (subset_id, run) data into a number
    control_params: columns on data frame for doing sensitivity analysis
    """

    labels = df.groupby(['subset', 'run']).apply(run_utility)
    labels.name = 'target'
    labels_df = labels

    cols = ['subset', 'run', *tuple(control_params)]
    subset_map = df[cols].drop_duplicates().set_index(['subset', 'run'])
    feature_df = subset_map

    full_df = feature_df.join(labels_df)
    param_sensitivity_plot(full_df,
                           control_params,
                           'target',
                           label)

    Plots the sensitivity of a result dataset towards a KPI.

    Arguments
    df: data frame containing all the simulation results, incl params.
    run_utility: function that aggregates a (subset_id, run) data into a number
    control_params: columns on data frame for doing sensitivity analysis
    
Plots the sensitivity of a result dataset towards a KPI.
Arguments
df: data frame containing all the simulation results, incl params.
run_utility: function that aggregates a (subset_id, run) data into a number
control_params: columns on data frame for doing sensitivity analysis
Plots the sensitivity of a result dataset towards a KPI . Arguments df : data frame containing all the simulation results incl params . run_utility : function that aggregates a ( subset_id run ) data into a number control_params : columns on data frame for doing sensitivity analysis
def kpi_sensitivity_plot(df: pd.DataFrame,
                         run_utility: callable,
                         control_params: set,
                         label: str = 'target'):
    labels = df.groupby(['subset', 'run']).apply(run_utility)
    labels.name = 'target'
    labels_df = labels
    cols = ['subset', 'run', *tuple(control_params)]
    subset_map = df[cols].drop_duplicates().set_index(['subset', 'run'])
    feature_df = subset_map
    full_df = feature_df.join(labels_df)
    param_sensitivity_plot(full_df,
                           control_params,
                           'target',
                           label)
def kpi_sensitivity_plot ( df : pd . DataFrame , run_utility : callable , control_params : set , label : str = 'target' ) : labels = df . groupby ( [ 'subset' , 'run' ] ) . apply ( run_utility ) labels . name = 'target' labels_df = labels cols = [ 'subset' , 'run' , * tuple ( control_params ) ] subset_map = df [ cols ] . drop_duplicates ( ) . set_index ( [ 'subset' , 'run' ] ) feature_df = subset_map full_df = feature_df . join ( labels_df ) param_sensitivity_plot ( full_df , control_params , 'target' , label )
Plots the sensitivity of a result dataset towards a KPI.
Plots the sensitivity of a result dataset towards a KPI .
"""
    Plots the sensitivity of a result dataset towards a KPI.

    Arguments
    df: data frame containing all the simulation results, incl params.
    run_utility: function that aggregates a (subset_id, run) data into a number
    control_params: columns on data frame for doing sensitivity analysis
    """
df
pd.DataFrame
run_utility
callable
control_params
set
label
str