swyft.weightedmarginals¶
- class swyft.weightedmarginals.WeightedMarginalSamples(weights: Dict[Tuple[int, ...], Union[numpy.ndarray, torch.Tensor]], v: numpy.ndarray)[source]¶
- Parameters:
weights (Dict[Tuple[int, ...], Union[ndarray, Tensor]]) –
v (ndarray) –
- get_df(marginal_index)[source]¶
convert a weighted marginal into a dataframe with the marginal_indices, ‘weight’, and ‘logweight’ as columns
- Parameters:
marginal_index (Union[int, Sequence[int], Sequence[Sequence[int]]]) – which marginal to select. one at a time.
- Returns:
DataFrame with marginal_indices, ‘weight’, and ‘logweight’ for columns
- Return type:
DataFrame
- get_df_dict()[source]¶
produce a map from marginal_index to df for all dfs and marginal_indices
- Return type:
Dict[Tuple[int, …], DataFrame]
- get_logweight(marginal_index)[source]¶
access the logweight for a certain marginal by marginal_index
- Parameters:
marginal_index (Union[int, Sequence[int], Sequence[Sequence[int]]]) – which marginal to select. one at at time.
- Returns:
logweight
- Return type:
ndarray
- get_logweight_marginal(marginal_index)[source]¶
access the logweight and parameter values for a marginal by index
- Parameters:
marginal_index (Union[int, Sequence[int], Sequence[Sequence[int]]]) – which marginal to select. one at a time.
- Returns:
the logweight and the parameter values
- Return type:
logweight, marginal