I am looking for binary encoding of a set of integers that satisfy the following two properties:
The number of 1s in the larger numbers is larger.
The hamming distance between the encoding of two consecutive numbers is minimized.
Is there any number coding scheme to do this?
The objective is to find a better encoding for ordinal values as a binary vectors. The common idea for encoding of ordinal values in machine learning is to consider them categorical and encode them as one-hot binary vector. But a one-hot vector is quite wasteful.
Suppose you encode two ordinal values $o_1 < o_2$ as $d$-dimensional binary vectors $\mathbf{v}_1, \mathbf{v}_2 \in \{0, 1\}^{d}$. For this encoding to be efficient, there should exist an embedding vector $\mathbf{w} \in \mathbb{R}^{d}$ such that $\mathbf{w}^{\top}\mathbf{v}_1 < \mathbf{w}^{\top}\mathbf{v}_2$.