Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

updated __init__.py to include missing encoders #3487

Merged
merged 7 commits into from
May 22, 2017
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
4 changes: 3 additions & 1 deletion src/nupic/encoders/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
# ----------------------------------------------------------------------

from scalar import ScalarEncoder
from random_distributed_scalar import RandomDistributedScalarEncoder
from adaptive_scalar import AdaptiveScalarEncoder
from date import DateEncoder
from logarithm import LogEncoder
Expand All @@ -29,7 +30,8 @@
from scalar_space import ScalarSpaceEncoder
from coordinate import CoordinateEncoder
from geospatial_coordinate import GeospatialCoordinateEncoder
from nupic.encoders.pass_through import PassThroughEncoder
from pass_through import PassThroughEncoder
from sparse_pass_through import SparsePassThroughEncoder
# multiencoder must be imported last because it imports * from this module!
from multi import MultiEncoder
from utils import bitsToString
2 changes: 1 addition & 1 deletion src/nupic/encoders/geospatial_coordinate.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@

import numpy
from pyproj import Proj, transform
from nupic.encoders.coordinate import CoordinateEncoder
from nupic.encoders import CoordinateEncoder



Expand Down
2 changes: 1 addition & 1 deletion src/nupic/encoders/logarithm.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
from nupic.data import SENTINEL_VALUE_FOR_MISSING_DATA
from nupic.data.field_meta import FieldMetaType
from nupic.encoders.base import Encoder, EncoderResult
from nupic.encoders.scalar import ScalarEncoder
from nupic.encoders import ScalarEncoder


class LogEncoder(Encoder):
Expand Down
34 changes: 15 additions & 19 deletions src/nupic/encoders/multi.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,22 +20,18 @@
# ----------------------------------------------------------------------

from nupic.encoders.base import Encoder
from nupic.encoders.scalar import ScalarEncoder
from nupic.encoders.adaptive_scalar import AdaptiveScalarEncoder
from nupic.encoders.date import DateEncoder
from nupic.encoders.logarithm import LogEncoder
from nupic.encoders.category import CategoryEncoder
from nupic.encoders.sdr_category import SDRCategoryEncoder
from nupic.encoders.delta import DeltaEncoder
from nupic.encoders.scalar_space import ScalarSpaceEncoder
from nupic.encoders.pass_through import PassThroughEncoder
from nupic.encoders.sparse_pass_through import SparsePassThroughEncoder
from nupic.encoders.coordinate import CoordinateEncoder
from nupic.encoders.geospatial_coordinate import GeospatialCoordinateEncoder
# multiencoder must be imported last because it imports * from this module!
from nupic.encoders.utils import bitsToString
from nupic.encoders.random_distributed_scalar import RandomDistributedScalarEncoder

from nupic.encoders import (ScalarEncoder,
AdaptiveScalarEncoder,
DateEncoder,LogEncoder,
CategoryEncoder,
SDRCategoryEncoder,
DeltaEncoder,
ScalarSpaceEncoder,
PassThroughEncoder,
SparsePassThroughEncoder,
CoordinateEncoder,
GeospatialCoordinateEncoder,
RandomDistributedScalarEncoder)


# Map class to Cap'n Proto schema union attribute
Expand All @@ -50,13 +46,13 @@
DeltaEncoder: "deltaEncoder",
PassThroughEncoder: "passThroughEncoder",
SparsePassThroughEncoder: "sparsePassThroughEncoder",
GeospatialCoordinateEncoder: "geospatialCoordinateEncoder",
ScalarSpaceEncoder: "scalarSpaceEncoder",
RandomDistributedScalarEncoder: "randomDistributedScalarEncoder"
}

# Invert for fast lookup in MultiEncoder.read()
_ATTR_CLASS_MAP = {value:key for key, value in _CLASS_ATTR_MAP.items()}


_ATTR_CLASS_MAP = {value: key for key, value in _CLASS_ATTR_MAP.items()}


class MultiEncoder(Encoder):
Expand Down
4 changes: 2 additions & 2 deletions src/nupic/encoders/scalar_space.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@
# http://numenta.org/licenses/
# ----------------------------------------------------------------------
from nupic.encoders.base import Encoder
from nupic.encoders.delta import DeltaEncoder
from nupic.encoders.adaptive_scalar import AdaptiveScalarEncoder
from nupic.encoders import (DeltaEncoder,
AdaptiveScalarEncoder)


class ScalarSpaceEncoder(Encoder):
Expand Down
2 changes: 1 addition & 1 deletion tests/unit/nupic/encoders/pass_through_encoder_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@

import numpy

from nupic.encoders.pass_through import PassThroughEncoder
from nupic.encoders import PassThroughEncoder

try:
import capnp
Expand Down
4 changes: 1 addition & 3 deletions tests/unit/nupic/encoders/random_distributed_scalar_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,7 @@
from nupic.data import SENTINEL_VALUE_FOR_MISSING_DATA
from nupic.data.field_meta import FieldMetaType
from nupic.support.unittesthelpers.algorithm_test_helpers import getSeed
from nupic.encoders.random_distributed_scalar import (
RandomDistributedScalarEncoder
)
from nupic.encoders import RandomDistributedScalarEncoder

try:
import capnp
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@

import numpy

from nupic.encoders.sparse_pass_through import SparsePassThroughEncoder
from nupic.encoders import SparsePassThroughEncoder


try:
Expand Down