A function that maps $n-2$ out of $n$ elements of $X$ to a unique element in $Y$, can be thought of as "almost injective" for very large $n$. I'm curious whether there are good measures of non-injectivity.
One measure I can think of is the following: for a function $f:X\to Y$, define the degree of of injectivity to be $\frac {I(x,f(x))} {H(x)}$ where $H(x)$ is the entropy of $x$ taken from a uniform distribution over $X$, and where $I$ is the mutual information: $$H(x)=\mathbb E[\log|X|]=\log |X|$$ $$I(X,f(X))=\log|X|-\mathbb E[\log |\{\tilde x | \tilde x\in f^{-1}(f(x))\}|]$$ Where the $\mathbb E$ are taken over uniform distributions of $x$.
Is this a "good" (i.e. with helpful properties) definition of "degree of injectivity"? Are there others?