View source on GitHub |
Returns value with given key(s) in (possibly multi-level) dict.
tfma.utils.get_by_keys(
data: Mapping[str, Any],
keys: Sequence[Any],
default_value=None,
optional: bool = False
) -> Any
The keys represent multiple levels of indirection into the data. For example if 3 keys are passed then the data is expected to be a dict of dict of dict. For compatibily with data that uses prefixing to create separate the keys in a single dict, lookups will also be searched for under the keys separated by '/'. For example, the keys 'head1' and 'probabilities' could be stored in a a single dict as 'head1/probabilties'.
Raises | |
---|---|
ValueError
|
If (non-optional) key is not found. |