Skip to content
This repository has been archived by the owner on Sep 1, 2023. It is now read-only.

Fix serialization of MultiEncoder #2831

Merged
merged 1 commit into from
Dec 16, 2015
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/nupic/encoders/multi.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@
# Map class to Cap'n Proto schema union attribute
_CLASS_ATTR_MAP = {
ScalarEncoder: "scalarEncoder",
AdaptiveScalarEncoder: "adaptivescalar",
AdaptiveScalarEncoder: "adaptiveScalarEncoder",
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can RDSE be added to the list? It has its capnp files.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please open a separate issue for this.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

DateEncoder: "dateEncoder",
LogEncoder: "logEncoder",
CategoryEncoder: "categoryEncoder",
Expand Down
6 changes: 3 additions & 3 deletions tests/unit/nupic/encoders/multi_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
import unittest2 as unittest

from nupic.encoders.multi import MultiEncoder
from nupic.encoders import ScalarEncoder, SDRCategoryEncoder
from nupic.encoders import ScalarEncoder, AdaptiveScalarEncoder, SDRCategoryEncoder
from nupic.data.dictutils import DictObj

try:
Expand Down Expand Up @@ -101,8 +101,8 @@ def testReadWrite(self):
periodic=True, name="day of week",
forced=True))
original.addEncoder("myval",
ScalarEncoder(w=5, resolution=1, minval=1, maxval=10,
periodic=False, name="aux", forced=True))
AdaptiveScalarEncoder(n=50, w=5, resolution=1, minval=1, maxval=10,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why use AdaptiveS when its use is discouraged [1], rather stick with Scalar/new RDSE?

[1] https://github.com/numenta/nupic/wiki/Encoders#adaptive-scalar-encoder

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Because it is currently used in the OPF, so it needs to be serialized.

periodic=False, name="aux", forced=True))
originalValue = DictObj(dow=3, myval=10)
output = original.encode(originalValue)

Expand Down