# Community CategoryEncoder in python exist?

**URL:** <https://discourse.numenta.org/t/community-categoryencoder-in-python-exist/5775>\
**Category:** NuPIC\
**Created:** [April 8, 2019, 8:05am UTC](https://discourse.numenta.org/t/community-categoryencoder-in-python-exist/5775 "2019-04-08T08:05:33Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![MAK](https://avatars.discourse-cdn.com/v4/letter/m/dc4da7/32.png) [@MAK](https://discourse.numenta.org/u/MAK)\
**Post date:** [April 8, 2019, 8:05am UTC](https://discourse.numenta.org/t/community-categoryencoder-in-python-exist/5775/1 "2019-04-08T08:05:33Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![brev](https://yyz2.discourse-cdn.com/flex030/user_avatar/discourse.numenta.org/brev/32/5548_2.png) [@brev](https://discourse.numenta.org/u/brev)\
**Post date:** [April 9, 2019, 12:23am UTC](https://discourse.numenta.org/t/community-categoryencoder-in-python-exist/5775/2 "2019-04-09T00:23:40Z")

</div>

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

> [@Repo for merging various Encoders](https://discourse.numenta.org/t/repo-for-merging-various-encoders/5397/8):
>
> I’m happy to announce a number of (most of the numenta’s py) encoders in c++ added in The encoders are working and with tests, we’re looking for volunteers to help them integrate within the repository (may need some fixes regarding multiplatform support, modern c++11/17 etc)

---

<div class="post-metadata">

**Author:** ![dmac](https://yyz2.discourse-cdn.com/flex030/user_avatar/discourse.numenta.org/dmac/32/5842_2.png) [@dmac](https://discourse.numenta.org/u/dmac)\
**Post date:** [April 9, 2019, 1:03am UTC](https://discourse.numenta.org/t/community-categoryencoder-in-python-exist/5775/3 "2019-04-09T01:03:04Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![breznak](https://yyz2.discourse-cdn.com/flex030/user_avatar/discourse.numenta.org/breznak/32/1935_2.png) [@breznak](https://discourse.numenta.org/u/breznak)\
**Post date:** [April 10, 2019, 6:05am UTC](https://discourse.numenta.org/t/community-categoryencoder-in-python-exist/5775/4 "2019-04-10T06:05:45Z")

</div>

> [@brev](#):
>
> nnounce that he was merging in a bunch of newly converted C++ encoders:

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](#):
>
> the category encoder is a scalar encoder with a radius of less than 1.

---

<div class="post-metadata">

**Author:** ![MAK](https://avatars.discourse-cdn.com/v4/letter/m/dc4da7/32.png) [@MAK](https://discourse.numenta.org/u/MAK)\
**Post date:** [April 10, 2019, 9:08am UTC](https://discourse.numenta.org/t/community-categoryencoder-in-python-exist/5775/5 "2019-04-10T09:08:49Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![dmac](https://yyz2.discourse-cdn.com/flex030/user_avatar/discourse.numenta.org/dmac/32/5842_2.png) [@dmac](https://discourse.numenta.org/u/dmac)\
**Post date:** [April 10, 2019, 2:34pm UTC](https://discourse.numenta.org/t/community-categoryencoder-in-python-exist/5775/6 "2019-04-10T14:34:39Z")

</div>

Example usage of RDSE:

```auto
>>> 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.

---

<div class="post-metadata">

**Author:** ![MAK](https://avatars.discourse-cdn.com/v4/letter/m/dc4da7/32.png) [@MAK](https://discourse.numenta.org/u/MAK)\
**Post date:** [April 11, 2019, 8:21am UTC](https://discourse.numenta.org/t/community-categoryencoder-in-python-exist/5775/7 "2019-04-11T08:21:52Z")

</div>

> [@dmac](#):
>
> from nupic.bindings.encoders import RDSE, RDSE\_Parameters

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

---

<div class="post-metadata">

**Author:** ![dmac](https://yyz2.discourse-cdn.com/flex030/user_avatar/discourse.numenta.org/dmac/32/5842_2.png) [@dmac](https://discourse.numenta.org/u/dmac)\
**Post date:** [April 12, 2019, 2:48pm UTC](https://discourse.numenta.org/t/community-categoryencoder-in-python-exist/5775/8 "2019-04-12T14:48:17Z")

</div>

> 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/`

---

<div class="post-metadata">

**Author:** ![rhyolight](https://yyz2.discourse-cdn.com/flex030/user_avatar/discourse.numenta.org/rhyolight/32/3922_2.png) [@rhyolight](https://discourse.numenta.org/u/rhyolight)\
**Post date:** [April 12, 2019, 8:29pm UTC](https://discourse.numenta.org/t/community-categoryencoder-in-python-exist/5775/9 "2019-04-12T20:29:14Z")

</div>

> [@MAK](#):
>
> from nupic.bindings.encoders import RDSE, RDSE\_Parameters

I can run

```python
from nupic.bindings.encoders import RDSE, RDSE_Parameters

```

I just built from tip of `nupic.cpp` this morning in Python 3! 😁
