arviz.to_cds

arviz.to_cds(data, var_names=None, groups=None, dimensions=None, group_info=True, var_name_format=None, index_origin=None)[source]

Transform data to ColumnDataSource (CDS) compatible with Bokeh.

Uses _ARVIZ_GROUP_ and _ARVIZ_CDS_SELECTION_ to separate var_name from group and dimensions in CDS columns.

Parameters
dataobj

Any object that can be converted to an az.InferenceData object Refer to documentation of az.convert_to_inference_data for details

var_namesstr or list of str, optional

Variables to be processed, if None all variables are processed.

groupsstr or list of str, optional

Select groups for CDS. Default groups are {“posterior_groups”, “prior_groups”, “posterior_groups_warmup”}

  • posterior_groups: posterior, posterior_predictive, sample_stats

  • prior_groups: prior, prior_predictive, sample_stats_prior

  • posterior_groups_warmup: warmup_posterior, warmup_posterior_predictive, warmup_sample_stats

ignore_groupsstr or list of str, optional

Ignore specific groups from CDS.

dimensionstr, or list of str, optional

Select dimensions along to slice the data. By default uses (“chain”, “draw”).

group_infobool

Add group info for var_name_format

var_name_formatstr or tuple of tuple of string, optional

Select column name format for non-scalar input. Predefined options are {“brackets”, “underscore”, “cds”}

“brackets”:
  • add_group_info == False: theta[0,0]

  • add_group_info == True: theta_posterior[0,0]

“underscore”:
  • add_group_info == False: theta_0_0

  • add_group_info == True: theta_posterior_0_0_

“cds”:
  • add_group_info == False: theta_ARVIZ_CDS_SELECTION_0_0

  • add_group_info == True: theta_ARVIZ_GROUP_posterior__ARVIZ_CDS_SELECTION_0_0

tuple:

Structure:

  • tuple: (dim_info, group_info)

    • dim_info: (str: .join separator, str: dim_separator_start, str: dim_separator_end)

    • group_info: (str: group separator start, str: group separator end)

Example: ((“,”, “[”, “]”), (“_”, “”))

  • add_group_info == False: theta[0,0]

  • add_group_info == True: theta_posterior[0,0]

index_originint, optional

Start parameter indices from index_origin. Either 0 or 1.

Returns
bokeh.models.ColumnDataSource object