Scalar Encoder: specifying w and n

I’d like to create a scalar encoder with a custom value for w and n.
The doc and scalar.py seem to indicate that this should be trivial to do, but the approach I’m taking isn’t working.

I have created a swarm_description.py file along the lines of the one used in the hot gym example.
Within it, one of the blocks looks like:

{
"fieldname": "Class1",
"fieldtype": "int",
"maxValue: 100,
"minValue": 0,
"w":5,
"n":10
}

This results in the error “…additional property ‘w’ not defined by ‘properties’ are not allowed in list item…”

Swarming works if I do not include w and n.
I’m wondering if someone can tell me what I’m doing incorrectly when I do try to include them.

Thanks.

Hi Phil. The reason this isn’t working as you expect is because you’re trying to run a swarm, which does not allow you to input your own encoder configuration. The whole point of a swarm is to automatically identify the best set of encoder params for the sample input data you give it. It will return you model parameters that include a configuration for a scalar encoder. If, at that point, you want to change the w and n values, you can simply change the model parameters it returns to you before creating a model with it.

For a complete example of this (albeit a bit old), see this tutorial:

Code: https://github.com/numenta/nupic/tree/master/examples/opf/clients/hotgym/prediction/one_gym

Video:

1 Like

I am extremely late to respond to this but I just saw this topic in my suggested list.

Here’s a great discussion that Setus, I, and others had about w and n parameters.

1 Like