I would like to examine information-theoretical properties of random variables that take as values objects which are akin to dictionaries in the Python programing language. That is, each sample of the random variable has a various number of numerical attributes which are not exchangeable and uniquely identifiable across samples. In other words, the random variables are neither random sets, as the attributes can be uniquely identified, nor random vectors, as the number of attribtutes may differ across samples.
Formally, and using a bit of Python nomenclature and syntax, I define these objects in my work as follows: Given a random vector $X\in\mathbb{R}^n$ (providing the possible values) and a map $K:\mathbb{R}^n\rightarrow\mathcal{P}(\{1,\dots,n\})$ (determining the set of keys contianed in the dictionary) a random dictionary $D(X,K)$ is defined as $$D(X,K)=\{k:X_{k}\text{ for k in }K(X)\}$$ where $X_k$ is the $k^{th}$ component of $X$.
To study the information-theoretical properties of my "random dictionaries" I need to define a probability density on them, and it is fairly straightforward to verify that for a sample $x\in\mathbb{R}^n$ the density of $D(x,K)$ is given by $$p(D(x,K))=p((x_k)_{k\in K(x)})\cdot p(K(x)|(x_k)_{k\in K(x)})=p((x_k)_{k\in K(x)},K(x))$$ where $p((x_k)_{k\in K(x)})$ is the marginal density of the components of $x$ included in the dictionary, $p(K(x)|(x_k)_{k\in K(x)})$ is the conditional probability of $K(x)$ being the key set under the observed components $(x_k)_{k\in K(x)}$ of x, and the rightmost term is just the joint density obtained by the definition of the conditional density. So far, so good.
Now, as for my question: Say, one has to work not with the joint density but only the density of the included values $p((x_k)_{k\in K(x)})$. Then, one faces the problem that the set of included keys $K(x)$ may be different for different values $x$ of $X$, each of which inducing a different marginal density, and, hence, integrating this density over all of $\mathbb{R}^n$ would yield a value of $|K(X)|$, i.e. the number of different key sets selected by $K$ over the values of $X$ $$\int_{\mathbb{R^n}}p((x_k)_{k\in K(x)})dx=|K(X)|.$$ This is a problem, however, as a probabillity density should integrate to 1 insted of $|K(X)|$. The obvious way to fix this is to just normalize the density by dividing it by $|K(X)|$, but I am not certain whether this is the right thing to do and I could not find any relevant literature to such a problem. Thus I would like to ask if somebody knows any existing theory or literature that could be relevant to such objects, or maybe has a more reasonable approach to fixing this issue?
Many thanks!