diff --git a/src/nupic/encoders/__init__.py b/src/nupic/encoders/__init__.py index 3a07813fa6..48a1ca13ab 100644 --- a/src/nupic/encoders/__init__.py +++ b/src/nupic/encoders/__init__.py @@ -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 @@ -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 diff --git a/src/nupic/encoders/geospatial_coordinate.py b/src/nupic/encoders/geospatial_coordinate.py index 79dec27654..baf9e06ba9 100644 --- a/src/nupic/encoders/geospatial_coordinate.py +++ b/src/nupic/encoders/geospatial_coordinate.py @@ -23,7 +23,7 @@ import numpy from pyproj import Proj, transform -from nupic.encoders.coordinate import CoordinateEncoder +from nupic.encoders import CoordinateEncoder diff --git a/src/nupic/encoders/logarithm.py b/src/nupic/encoders/logarithm.py index 5e224a1055..c73eba22a7 100644 --- a/src/nupic/encoders/logarithm.py +++ b/src/nupic/encoders/logarithm.py @@ -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): diff --git a/src/nupic/encoders/multi.py b/src/nupic/encoders/multi.py index 84700d2bd1..2e891fbd66 100644 --- a/src/nupic/encoders/multi.py +++ b/src/nupic/encoders/multi.py @@ -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 @@ -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): diff --git a/src/nupic/encoders/scalar_space.py b/src/nupic/encoders/scalar_space.py index 5790f66ee9..5f4493a7a7 100644 --- a/src/nupic/encoders/scalar_space.py +++ b/src/nupic/encoders/scalar_space.py @@ -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): diff --git a/tests/unit/nupic/encoders/pass_through_encoder_test.py b/tests/unit/nupic/encoders/pass_through_encoder_test.py index 071296dbca..c0592f49e6 100755 --- a/tests/unit/nupic/encoders/pass_through_encoder_test.py +++ b/tests/unit/nupic/encoders/pass_through_encoder_test.py @@ -28,7 +28,7 @@ import numpy -from nupic.encoders.pass_through import PassThroughEncoder +from nupic.encoders import PassThroughEncoder try: import capnp diff --git a/tests/unit/nupic/encoders/random_distributed_scalar_test.py b/tests/unit/nupic/encoders/random_distributed_scalar_test.py index a23f7cf007..54e9eaa822 100755 --- a/tests/unit/nupic/encoders/random_distributed_scalar_test.py +++ b/tests/unit/nupic/encoders/random_distributed_scalar_test.py @@ -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 diff --git a/tests/unit/nupic/encoders/sparse_pass_through_encoder_test.py b/tests/unit/nupic/encoders/sparse_pass_through_encoder_test.py index ce1e314ce4..6076eb6b51 100755 --- a/tests/unit/nupic/encoders/sparse_pass_through_encoder_test.py +++ b/tests/unit/nupic/encoders/sparse_pass_through_encoder_test.py @@ -28,7 +28,7 @@ import numpy -from nupic.encoders.sparse_pass_through import SparsePassThroughEncoder +from nupic.encoders import SparsePassThroughEncoder try: