Community CategoryEncoder in python exist?

Hello,
I want to use the Community fork in python, but I didn’t found many important encoders like CategoryEncoder etc’ (I founded only the ScalarEncoder )
May I miss something ??
Thanks,
MAK

Hi @MAK, I recently saw @breznak announce that he was merging in a bunch of newly converted C++ encoders:

Hi MAC,

This is something Ive been meaning to add to the documentation: the category encoder is a scalar encoder with a radius of less than 1. You will need to enumerate your categories before encoding them. If you dont know how many categories you need then use the random distributed scalar encoder.

Hope this helps,
Dmac

1 Like

yes, CategoryEncoder is available in said branch, but we’ve decided to obsolete it (don’t merge to master) and instead people should use ScalarEncoder even for encoding categories, as dmac is describing.

@dmac, random distributed scalar existing in the python version ?
I don’t find any evidence to that :grinning:
Can you please give me a reference to that?
Thanks
MAK

Example usage of RDSE:

>>> from nupic.bindings.encoders import RDSE, RDSE_Parameters
>>> P = RDSE_Parameters()
>>> P.size = 300
>>> P.sparsity = .10
>>> P.radius = .99
>>> enc = RDSE(P)

There are other ways to specify the RDSE, using resolution instead of radius, and number of activeBits instead of sparsity. See help(RDSE_Parameters)

Also, for the scalar enocder there is a program to view it:
python3 -m nupic.examples.rf_view_ScalarEncoder --help
I hope to make a similar program for the RDSE, but haven’t yet.

1 Like

hii @dmac,
My environment not recognize the import RDSE, RDSE_Parameters .
I am using the master package .
Thanks,
MAK

My environment not recognize the import RDSE, RDSE_Parameters .

That’s strange. After you build and install nupic community-fork from the git repository, do the python unit tests pass? You can run them with the command:
$ python3 -m pytest nupic.cpp/bindings/py/tests/

1 Like

I can run

from nupic.bindings.encoders import RDSE, RDSE_Parameters

I just built from tip of nupic.cpp this morning in Python 3! :grin:

1 Like