Encoding the hierarchy data

HI,
There is a type of data consist of 2 parts: class id(integer) and subId(integer) ,
I want to encode each record of the data into a SDR with 2048 bits and 20 bits a bucket.
The bucket is devided into 2 parts:13bits represents the class id, and 7 bits represent the subId,. the class id is encoded by a categoryEncoder which means the class id is encoded with no overlap with other class id and the records in the same class with high semantic similarity .
With the 13bits representing the class id, 10 of 13 bits are used to encode the class id ,which means there will be about 286(13×2×11 =286 ) class ids can be represented.
With the 7bits representing the sub id, 5 of 7 bits will be used to encode the sub ids,which means there will be about 21( 7*6/2=21) sub ids can be represented.

Is the encoding method ok? any idea will be appreciated.

So you have two integers to encode. One represents a class of objects, the other represents a subclass of objects? I assume together these integers could be a unique ID?

Just create two number encoders, each with the settings you want so you get the bucket size and width you need, and concatenation them into one vector.

Have you seen https://building-htm-systems.herokuapp.com/encoding-numbers?

1 Like

Yes ,you guess right. Thanks alot!