# How to choose RandomDistributedScalarEncoder settings

**URL:** <https://discourse.numenta.org/t/how-to-choose-randomdistributedscalarencoder-settings/4762>\
**Category:** Engineering\
**Created:** [October 19, 2018, 11:26pm UTC](https://discourse.numenta.org/t/how-to-choose-randomdistributedscalarencoder-settings/4762 "2018-10-19T23:26:51Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![Matheus\_Araujo](https://yyz2.discourse-cdn.com/flex030/user_avatar/discourse.numenta.org/matheus_araujo/32/3137_2.png) [@Matheus\_Araujo](https://discourse.numenta.org/u/Matheus_Araujo)\
**Post date:** [October 19, 2018, 11:26pm UTC](https://discourse.numenta.org/t/how-to-choose-randomdistributedscalarencoder-settings/4762/1 "2018-10-19T23:26:51Z")

</div>

Hey guys,

If I have a time series that has a minimun value of 8 and a maximum value of 20 and a precision of 0.01, what are the best parameters to use with RandomDistributedScalarEncoder for n, w, min, max, radius, and resolution for prediction with a target of 1% of average error?

I’m trying to achive a good solution and that’s my reasonig:

Since my precision is 0.01, my resolution must be 0.01.

If my target average error is 1% then my absolute error should be in the rounds of 0.12. Then I’ve chosen this value to be my radius parameter.

For the n and w values, my reasonig is that my range is 20-8=12 and my precision is 0.01, then i’m going to have 1.200 possible values to encode. So I have to have enough bits in my SDR to encode all those values and keep it sparse. So I choose n=3000 and w=21.

Is that a reasonable aproach?

---

<div class="post-metadata">

**Author:** ![Jonathan\_Mackenzie](https://yyz2.discourse-cdn.com/flex030/user_avatar/discourse.numenta.org/jonathan_mackenzie/32/118_2.png) [@Jonathan\_Mackenzie](https://discourse.numenta.org/u/Jonathan_Mackenzie)\
**Post date:** [October 20, 2018, 2:42am UTC](https://discourse.numenta.org/t/how-to-choose-randomdistributedscalarencoder-settings/4762/5 "2018-10-20T02:42:12Z")

</div>

The rule I used is this:

1. Calculate the number of buckets you want your input to be separated into
2. Set RDSE width to: `max(0.001, (maxInput - minInput) / buckets)`  
Where maxInput and minInput are the maximum and minimum possible values for your input.

---

<div class="post-metadata">

**Author:** ![Matheus\_Araujo](https://yyz2.discourse-cdn.com/flex030/user_avatar/discourse.numenta.org/matheus_araujo/32/3137_2.png) [@Matheus\_Araujo](https://discourse.numenta.org/u/Matheus_Araujo)\
**Post date:** [October 22, 2018, 11:34am UTC](https://discourse.numenta.org/t/how-to-choose-randomdistributedscalarencoder-settings/4762/6 "2018-10-22T11:34:55Z")

</div>

Thank you @Jonathan_Mackenzie. But how do you calculate the number of buckets? What are the criterias that you use?

---

<div class="post-metadata">

**Author:** ![Jonathan\_Mackenzie](https://yyz2.discourse-cdn.com/flex030/user_avatar/discourse.numenta.org/jonathan_mackenzie/32/118_2.png) [@Jonathan\_Mackenzie](https://discourse.numenta.org/u/Jonathan_Mackenzie)\
**Post date:** [October 24, 2018, 4:18am UTC](https://discourse.numenta.org/t/how-to-choose-randomdistributedscalarencoder-settings/4762/7 "2018-10-24T04:18:22Z")

</div>

It’s a bit of guess work or whatever makes sense for the problem domain.

---

<div class="post-metadata">

**Author:** ![Matheus\_Araujo](https://yyz2.discourse-cdn.com/flex030/user_avatar/discourse.numenta.org/matheus_araujo/32/3137_2.png) [@Matheus\_Araujo](https://discourse.numenta.org/u/Matheus_Araujo)\
**Post date:** [October 24, 2018, 7:24pm UTC](https://discourse.numenta.org/t/how-to-choose-randomdistributedscalarencoder-settings/4762/8 "2018-10-24T19:24:26Z")

</div>

Thank you
