Question Types#
Question Implementation
Each question type is implemented as a class the class also specifies the HTML/js templates to use for that question type. The constructor documents the logging variables that can be passed.
Normal Curve Questions#
This question has two normal curves, one moves and one does not.
- class ssbuilder.NormalCurveSlider(logging_vars={'location_var_name': 'loc', 'overlap_var_name': 'ov'})#
- generate_figure(static_name='other group', static_color='#CE00D1', static_mean=80, static_curve_width=10, dynamic_name='your group', dynamic_color='#00CED1', dynamic_starting_mean=10, dynamic_curve_width=10, num_slider_locs=101, min_slider_value=None, max_slider_value=None, overlap_decimals=2, mean_decimals=None, xaxis_title='')#
Generate a normal curve question object on a default scale of
- Parameters:
static_name (string) – legend text for static curve
static_color (hex including #) – hex code for the color to use for static curve, including a # sign as the first character
static_mean (number) – location of the static curve
static_curve_width (number) – width of curve, as the scipy.norm scale
dynamic_name (string) – legend text for dynamic curve
dynamic_color (hex including #) – hex code for the color to use for dynamic curve, including a # sign as the first character
dynamic_starting_mean (number) – the location where the slider starts
curve_width (number) – width of curves
num_slider_locs (integer) – number of slilder locations
min_slider_value (number) – the minimum value for the slider
max_slider_value (number) – the maximum value for the slider
overlap_decimals (integer) – number of place values to round the % overlap value to for both display and reporting, positive to the right of the decimal, negative for left of decimal (eg -2 rounds to nearest 100)
mean_decimals (integer) – number of place values to round the mean (position) value to for both display and reporting positive to the right of the decimal, negative for left of decimal (eg -2 rounds to nearest 100)
xaxis_title (string) – text label for the x axis
- Returns:
fig – figure object based on parameters
- Return type:
plotly figure object
Notes:#
curve is drawn with scipy.norm
Trade Off Questions#
this quesiton typ trades off between two two extremes over a number of models in the middle
- class ssbuilder.TradeoffLine(logging_vars={'location_var_name': 'model_number'})#
- generate_figure(pretty_data_file, slider_label='Model', trace_col='metric', x_col='model_number', trace_value1='accuracy', trace1_hover='accurate', trace_value2='false_positive_rate', trace2_hover='false positives', y_col='percent', y_min=None, y_max=None, num_digits=2, color_col='group', color_hover='people', anchor_name='selected model', disable_zoom=True, default_selection=10)#
make the lineplot
- Parameters:
pretty_data_file (string) – file name of a tidy (tall) dataset with pretty content. that is any data transformations should occur on the data (eg scaling .7523943 to 75.23943 and expanding column names) column names can still rely on python conventions, before display the _ will be converted to space
slider_column (string) – name of column to use for the slider
slider_label (string) – name to display when labeling the slider postion values (and in hovertext)
x_col (string) – name of column to use for the xor y axis
y_col (string) – name of column to use for the xor y axis
trace_value1 (same as the values of x_col in the data file) – first,second value to filter (left, right metric)
trace_value2 (same as the values of x_col in the data file) – first,second value to filter (left, right metric)
trace1_hover (string) – noun versions to use in the hovertext
trace2_hover (string) – noun versions to use in the hovertext
y_min (numerical) – minimum and maximum values to fix the plot axies, if none, allow plotly to decide
y_max (numerical) – minimum and maximum values to fix the plot axies, if none, allow plotly to decide
num_digits (num digits to display)
color_col (string) – name of colum to use for the colring of the lines
color_hover (string) – noun to use for groups
disable_zoom (bool) – disable the zoom on the generated plot
anchor_name (string) – name for vertical bar
default_selection (int) – model that is selected when laoding
- Returns:
fig (plotly figure object)
figure object based on parameters
- class ssbuilder.TradeoffBar(logging_vars={'location_var_name': 'model_number'})#
- generate_figure(pretty_data_file, slider_column='model_number', slider_label='Model', x_col='metric', x_value1='accuracy', x_value1_hover='accurate', x_value2='false_positive_rate', x_value2_hover='false positives', y_col='percent', y_min=None, y_max=None, num_digits=1, color_col='group', color_hover='people', disable_zoom=True, default_selection=10)#
make the barplot
- Parameters:
pretty_data_file (string) – file name of a tidy (tall) dataset with pretty content. that is any data transformations should occur on the data (eg scaling .7523943 to 75.23943 and expanding column names) column names can still rely on python conventions, before display the _ will be converted to space
slider_column (string) – name of column to use for the slider
slider_label (string) – name to display when labeling the slider postion values (and in hovertext)
x_col (string) – name of column to use for the xor y axis
y_col (string) – name of column to use for the xor y axis
x_value1 (same as the values of x_col in the data file) – first,second value to filter (left, right metric)
x_value2 (same as the values of x_col in the data file) – first,second value to filter (left, right metric)
x_value1_hover (string) – noun versions to use in the hovertext
x_value2_hover (string) – noun versions to use in the hovertext
y_min (numerical) – minimum and maximum values to fix the plot axies, if none, allow plotly to decide
y_max (numerical) – minimum and maximum values to fix the plot axies, if none, allow plotly to decide
num_digits (num digits to display)
color_col (string) – name of colum to use for the colring of the bars
color_hover – hover text to use for groups created by color
disable_zoom (bool) – disable the zoom on the generated plot
default_selection (int) – model that is selected when laoding
- Returns:
fig (plotly figure object)
figure object based on parameters