# Yet another "Yet Another HTM Implementation"

**URL:** <https://discourse.numenta.org/t/yet-another-yet-another-htm-implementation/4831>\
**Category:** Implementations\
**Tags:** htm-implementations\
**Created:** [October 28, 2018, 1:39am UTC](https://discourse.numenta.org/t/yet-another-yet-another-htm-implementation/4831 "2018-10-28T01:39:24Z")\
**Posts on this page:** 1\
**Showing post:** 10

<div class="post-metadata">

**Author:** ![Balladeer](https://yyz2.discourse-cdn.com/flex030/user_avatar/discourse.numenta.org/balladeer/32/3094_2.png) [@Balladeer](https://discourse.numenta.org/u/Balladeer)\
**Post date:** [January 16, 2019, 12:21pm UTC](https://discourse.numenta.org/t/yet-another-yet-another-htm-implementation/4831/10 "2019-01-16T12:21:52Z")

</div>

A `bucket` basically represents a range of numbers all at once. Short example:

Say we are encoding the values 1-100, and decide the use 10 buckets. If we use `num_active_bits = 1`, then our scalar encoder outputs an SDR with ten bits: `0000000000`

Each bit represents 1/10 of the input space, so bucket 1 would be on for all values 1-10, bucket 2 would be on for all values 11-20, bucket 3 for 21-30, etc:

- input `01` --\> output `1000000000`
- input `05` --\> output `1000000000`
- input `10` --\> output `1000000000`
- input `11` --\> output `0100000000`
- input `55` --\> output `0000010000`
- input `99` --\> output `0000000001`

This is very similar to how a histogram works, or any other “range banding” generalization: convert a large number of inputs into a smaller number of outputs.

You might look at [this test](https://bitbucket.org/zhtm/zhtm/src/0ac572b5759406ab57f8b32fe7b52056b6e67d34/tests/encoders/test_scalar_encoder.py#lines-8) for some more on how the scalar encoder is expected to behave.

You can also check out the section called “A Simple Encoder for Numbers” from the [encoder chapter (pdf!)](https://numenta.com/assets/pdf/biological-and-machine-intelligence/BaMI-Encoders.pdf) of BAMI, as my encoder basically just implements the one described in that section.

---

_[View the full topic](https://discourse.numenta.org/t/yet-another-yet-another-htm-implementation/4831)._
