cassiopeia.data.sample_bootstrap_character_matrices

cassiopeia.data.sample_bootstrap_character_matrices(character_matrix, prior_probabilities=None, num_bootstraps=10, random_state=None)[source]

Generates bootstrapped character matrices from a character matrix.

Ingests a character matrix and randomly creates bootstrap samples by sampling characters with replacement. Each bootstrapped character matrix, then, retains the same number of characters but some will be repeated and some will be ignored. If a prior proability dictionary is also passed in, then a new priors dictionary will be created for each bootstrapped character matrix.

Parameters
character_matrix : DataFrameDataFrame

Character matrix

prior_probabilities : {int: {int: float}}, NoneOptional[Dict[int, Dict[int, float]]] (default: None)

Probabilities of each (character, state) pair.

num_bootstraps : intint (default: 10)

Number of bootstrap samples to create.

random_state : RandomState, NoneOptional[RandomState] (default: None)

A numpy random state to from which to draw samples

Return type

List[Tuple[DataFrame, Dict[int, Dict[int, float]]]]List[Tuple[DataFrame, Dict[int, Dict[int, float]]]]

Returns

A list of bootstrap samples in the form

(bootstrap_character_matrix, bootstrap_priors).