Trying to encode a bunch of scalars: SMART stats for hard-disk health metrics, eventually hoping to predict failure in advance with temporal memory / anomaly. Used the hotgym.py example as a base structure.
I’ve tried defining several unique ScalarEncoders or RDSEs (concatenating together into one encoding for SP feed), but they crash if I put the bit_size allocation too low for any of them - somewhere under 30ish for each SE or RDSE.
This is a little odd for me, since some of the features from this dataset are strings (~45 unique categories, i used pandas’ categorical coding to clean this for scalar encoder) and one is just True/False, so allocating minimum 30 bits is a huge computational waste.
However it runs fine (just slow) when I give “enough” bitspace to each feature encoder. My code is up on my Github here:
# failure 1-bit encoder to minimize SDR size. we only need one bit to encode 1 or 0, after all
fail_params = ScalarEncoderParameters()
fail_params.minimum = 0
fail_params.maximum = 1
fail_params.size = 30 # if i go under 30, it crashes: CHECK FAILED: "args_.activeBits > 0u"
# this is a pretty awful problem, considering i'm wasting 29 bits of calculation
# i'm probably missing some configuration in a setting somewhere
fail_params.sparsity = 0.02
# fail_params.resolution = 0.88
fail_encoder = ScalarEncoder(fail_params) # it probably could just be a ScalarEncoder, not RDSE ...
Wonder if it’s something to do with min/max range declarations or something similar. Has anyone had any success with few-bit scalarEncoders or RDSEs / successful code I could compare with?
This worked terrifically, thanks. I wonder if it’s because I specified sparsity=0.02, which probably doesn’t calculate well with 5 bits (compared to 30). params.activeBits=X seems a lot cleaner when I think back to the HTM school example of encoders having maxBits & activeBits on for any given data input.
Is there a computational reason we need 2 bits (size did indeed check to 2 when i ran this) to encode a boolean feature? I would guess a size=1 “bit_inactive” = False and “bit_active” = True, but I’m surely missing something important.
Possibly not for your example.
But in general, yes, you need lots of bits for HTM stuff to work correctly. Reducing the number of bits to the absolute minimum might not yield good results.
For HTM, and possibly other network architectures, it’s best to give input vectors roughly the same activation energy (i.e. the same number of on bits) for all valid states. That way the network isn’t biased towards some inputs simply because they have more active bits than others. That’s why we don’t use the dense binary representations of chars, ints, and floats as inputs. The semantics are in the bit positions, which provides the opportunity for more robust representations of semantic overlap.