# In ComplexityMeasures.jl, is there a way to use elements of an OutcomeSpace as keys for Probabilities?

**URL:** https://discourse.julialang.org/t/in-complexitymeasures-jl-is-there-a-way-to-use-elements-of-an-outcomespace-as-keys-for-probabilities/132038
**Category:** Statistics
**Tags:** question, package, probability, dict
**Created:** [September 1, 2025, 9:57pm UTC](https://discourse.julialang.org/t/in-complexitymeasures-jl-is-there-a-way-to-use-elements-of-an-outcomespace-as-keys-for-probabilities/132038 "2025-09-01T21:57:09Z")
**Posts on this page:** 1
**Page:** 1

<div class="post-metadata">

### Author: ![mikhael](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/mikhael/32/218499_2.png) [@mikhael](https://discourse.julialang.org/u/mikhael)
#### Post date: [September 1, 2025, 9:57pm UTC](https://discourse.julialang.org/t/in-complexitymeasures-jl-is-there-a-way-to-use-elements-of-an-outcomespace-as-keys-for-probabilities/132038/1 "2025-09-01T21:57:09Z")

</div>

Suppose I build a `Probabilities` object `Prs` from a vector `x` like so:

```julia-auto
using ComplexityMeasures

x = rand([true, false], 10)

Prs, outs = allprobabilities_and_outcomes(UniqueElements(), x)

```

I would like to have a `Dict`-like interface whereby `Prs[out]` returns the probability of outcome `out` in `outs`. Is there a built-in (to ComplexityMeasures.jl) or best-practices way to do this?

In `ComplexityMeasures.OutcomeSpace`’s documentation under “Implementation details” I found

> The element type of Ω varies between outcome space models, but it is guaranteed to be _hashable_ and _sortable_ . This allows for conveniently tracking the counts of a specific event across experimental realizations, **by using the outcome as a dictionary key and the counts as the value for that key** (or, alternatively, the key remains the outcome and one has a vector of probabilities, one for each experimental realization).

but have not figured out how to use a `Probabilities` object this way aside from manually constructing something like

```julia-auto
PrsDict = Dict(zip(outs, Prs))

```

which feels redundant. I’d appreciate any pointers or tips if I’m missing something!
