I'm not sure I understand your question, but you have to think of the buckets the ScalarEncoder is using. If n
is 12 (number of bits) and w
is 3 (size of bucket) as in this example, it makes sense that numbers close to each other like 1 and 7 will be put into the same bucket. In this case, there only seems to be 10 buckets available:
111000000000
011100000000
001110000000
000111000000
000011100000
000001110000
000000111000
000000011100
000000001110
000000000111
So any value between 1-10 will all be represented in the same bucket (111000000000
).
If you increased the size of the n
to 100 and moved w
to 1, every number from 1-100 would have its own bucket.
1:
1000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
2:
0100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
3:
0010000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
4:
0001000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
etc.