From 6a53633ebfe0f52f34c1b3cdaf5f32ae3dcd819b Mon Sep 17 00:00:00 2001 From: Vitaly Kruglikov Date: Tue, 16 May 2017 13:17:23 -0700 Subject: [PATCH 01/12] NUP-2386 Renamed RecordSensor.py to record_sensor.py, but didn't update the builtin regions registration to demonstrate failure witnessed by Matt --- src/nupic/data/stats.py | 2 +- src/nupic/regions/{RecordSensor.py => record_sensor.py} | 0 tests/integration/nupic/engine/network_checkpoint_test.py | 2 +- tests/integration/nupic/engine/network_creation_common.py | 2 +- tests/unit/nupic/data/filters_test.py | 2 +- 5 files changed, 4 insertions(+), 4 deletions(-) rename src/nupic/regions/{RecordSensor.py => record_sensor.py} (100%) diff --git a/src/nupic/data/stats.py b/src/nupic/data/stats.py index b1f42ae5ed..952c9dd598 100644 --- a/src/nupic/data/stats.py +++ b/src/nupic/data/stats.py @@ -24,7 +24,7 @@ from pkg_resources import resource_filename -from nupic.regions.RecordSensor import RecordSensor +from nupic.regions.record_sensor import RecordSensor from nupic.data.file_record_stream import FileRecordStream diff --git a/src/nupic/regions/RecordSensor.py b/src/nupic/regions/record_sensor.py similarity index 100% rename from src/nupic/regions/RecordSensor.py rename to src/nupic/regions/record_sensor.py diff --git a/tests/integration/nupic/engine/network_checkpoint_test.py b/tests/integration/nupic/engine/network_checkpoint_test.py index 86a342f84e..5d09aed2cd 100755 --- a/tests/integration/nupic/engine/network_checkpoint_test.py +++ b/tests/integration/nupic/engine/network_checkpoint_test.py @@ -23,7 +23,7 @@ import numpy from nupic.regions.SPRegion import SPRegion -from nupic.regions.RecordSensor import RecordSensor +from nupic.regions.record_sensor import RecordSensor from network_creation_common import createAndRunNetwork diff --git a/tests/integration/nupic/engine/network_creation_common.py b/tests/integration/nupic/engine/network_creation_common.py index ee8d9cb20f..8de4d21c3a 100755 --- a/tests/integration/nupic/engine/network_creation_common.py +++ b/tests/integration/nupic/engine/network_creation_common.py @@ -29,7 +29,7 @@ from nupic.data.file_record_stream import FileRecordStream from nupic.engine import Network from nupic.encoders import MultiEncoder, ScalarEncoder, DateEncoder -from nupic.regions.RecordSensor import RecordSensor +from nupic.regions.record_sensor import RecordSensor from nupic.regions.SPRegion import SPRegion from nupic.regions.TMRegion import TMRegion diff --git a/tests/unit/nupic/data/filters_test.py b/tests/unit/nupic/data/filters_test.py index d0d40dd1ad..01ca956589 100755 --- a/tests/unit/nupic/data/filters_test.py +++ b/tests/unit/nupic/data/filters_test.py @@ -30,7 +30,7 @@ import unittest2 as unittest from pkg_resources import resource_filename -from nupic.regions.RecordSensor import RecordSensor +from nupic.regions.record_sensor import RecordSensor from nupic.data.file_record_stream import FileRecordStream from nupic.encoders import MultiEncoder from nupic.data.filters import DeltaFilter From 78b181a5dc5109feac65fd856792ea7a9b5b6ee5 Mon Sep 17 00:00:00 2001 From: Vitaly Kruglikov Date: Tue, 16 May 2017 13:34:45 -0700 Subject: [PATCH 02/12] NUP-2386 Updated module name of the RecordSensor region in engine/__init__.py to match the renamed module to demonstrate that the class name of the python region may differ from its module name, as long as it's registered using the correct module name. --- src/nupic/engine/__init__.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/nupic/engine/__init__.py b/src/nupic/engine/__init__.py index ffe49e54c6..b63cf81d84 100644 --- a/src/nupic/engine/__init__.py +++ b/src/nupic/engine/__init__.py @@ -49,7 +49,7 @@ ("nupic.regions.KNNClassifierRegion", "KNNClassifierRegion"), ("nupic.regions.PluggableEncoderSensor", "PluggableEncoderSensor"), ("nupic.regions.PyRegion", "PyRegion"), - ("nupic.regions.RecordSensor", "RecordSensor"), + ("nupic.regions.record_sensor", "RecordSensor"), ("nupic.regions.SDRClassifierRegion", "SDRClassifierRegion"), ("nupic.regions.SPRegion", "SPRegion"), ("nupic.regions.SVMClassifierNode", "SVMClassifierNode"), @@ -67,6 +67,7 @@ def registerBuiltInRegions(): # Initialize nupic regions if not registeredRegions: for module, className in pyRegions: + print "ZZZ Registering builtin python region:", module, className engine_internal.Network.registerPyRegion(module, className) registeredRegions = True From 404c031e254d50b46aa67ac5108fc136285b5068 Mon Sep 17 00:00:00 2001 From: Matthew Taylor Date: Mon, 22 May 2017 14:25:23 -0700 Subject: [PATCH 03/12] Removed a comment --- src/nupic/engine/__init__.py | 1 - 1 file changed, 1 deletion(-) diff --git a/src/nupic/engine/__init__.py b/src/nupic/engine/__init__.py index b63cf81d84..e66e933fc2 100644 --- a/src/nupic/engine/__init__.py +++ b/src/nupic/engine/__init__.py @@ -67,7 +67,6 @@ def registerBuiltInRegions(): # Initialize nupic regions if not registeredRegions: for module, className in pyRegions: - print "ZZZ Registering builtin python region:", module, className engine_internal.Network.registerPyRegion(module, className) registeredRegions = True From 3e67e7a399c2a72ab59c27c8e0d3282c48656510 Mon Sep 17 00:00:00 2001 From: Matthew Taylor Date: Tue, 23 May 2017 12:40:34 -0700 Subject: [PATCH 04/12] Moved AnomalyRegion.py => anomaly_region.py --- docs/source/api/network/regions.rst | 2 +- src/nupic/engine/__init__.py | 2 +- src/nupic/regions/{AnomalyRegion.py => anomaly_region.py} | 0 tests/unit/nupic/regions/anomaly_region_test.py | 2 +- 4 files changed, 3 insertions(+), 3 deletions(-) rename src/nupic/regions/{AnomalyRegion.py => anomaly_region.py} (100%) diff --git a/docs/source/api/network/regions.rst b/docs/source/api/network/regions.rst index 64876e3928..a7454995f3 100644 --- a/docs/source/api/network/regions.rst +++ b/docs/source/api/network/regions.rst @@ -12,7 +12,7 @@ PyRegion AnomalyRegion ^^^^^^^^^^^^^ -.. autoclass:: nupic.regions.AnomalyRegion.AnomalyRegion +.. autoclass:: nupic.regions.anomaly_region.AnomalyRegion :members: :show-inheritance: diff --git a/src/nupic/engine/__init__.py b/src/nupic/engine/__init__.py index e66e933fc2..25fc6a2e67 100644 --- a/src/nupic/engine/__init__.py +++ b/src/nupic/engine/__init__.py @@ -43,7 +43,7 @@ pyRegions = ( ("nupic.bindings.regions.TestNode", "TestNode"), ("nupic.regions.AnomalyLikelihoodRegion", "AnomalyLikelihoodRegion"), - ("nupic.regions.AnomalyRegion", "AnomalyRegion"), + ("nupic.regions.anomaly_region", "AnomalyRegion"), ("nupic.regions.CLAClassifierRegion", "CLAClassifierRegion"), ("nupic.regions.KNNAnomalyClassifierRegion", "KNNAnomalyClassifierRegion"), ("nupic.regions.KNNClassifierRegion", "KNNClassifierRegion"), diff --git a/src/nupic/regions/AnomalyRegion.py b/src/nupic/regions/anomaly_region.py similarity index 100% rename from src/nupic/regions/AnomalyRegion.py rename to src/nupic/regions/anomaly_region.py diff --git a/tests/unit/nupic/regions/anomaly_region_test.py b/tests/unit/nupic/regions/anomaly_region_test.py index d6b51c10ad..eb1ff9fd43 100644 --- a/tests/unit/nupic/regions/anomaly_region_test.py +++ b/tests/unit/nupic/regions/anomaly_region_test.py @@ -24,7 +24,7 @@ import numpy -from nupic.regions.AnomalyRegion import AnomalyRegion +from nupic.regions.anomaly_region import AnomalyRegion try: import capnp From 3d27100326a5cce660ac7ee5e54e272611330cfb Mon Sep 17 00:00:00 2001 From: Matthew Taylor Date: Tue, 23 May 2017 12:41:43 -0700 Subject: [PATCH 05/12] Updated errant AnomalyLikelihoodRegion namespace in docs" --- docs/source/api/network/regions.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/source/api/network/regions.rst b/docs/source/api/network/regions.rst index a7454995f3..ff108d8106 100644 --- a/docs/source/api/network/regions.rst +++ b/docs/source/api/network/regions.rst @@ -33,7 +33,7 @@ TMRegion AnomalyLikelihoodRegion ^^^^^^^^^^^^^^^^^^^^^^^ -.. autoclass:: nupic.regions.AnomalyLikelihoodRegion.AnomalyLikelihoodRegion +.. autoclass:: nupic.regions.anomaly_likelihood_region.AnomalyLikelihoodRegion :members: :show-inheritance: From 40b92a00c0dab8ef226ffabc91aab2c2c71bf6da Mon Sep 17 00:00:00 2001 From: Matthew Taylor Date: Tue, 23 May 2017 12:48:20 -0700 Subject: [PATCH 06/12] Moved CLAClassifierRegion.py => cla_classifier_region.py --- docs/source/api/network/regions.rst | 2 +- src/nupic/engine/__init__.py | 2 +- .../{CLAClassifierRegion.py => cla_classifier_region.py} | 0 3 files changed, 2 insertions(+), 2 deletions(-) rename src/nupic/regions/{CLAClassifierRegion.py => cla_classifier_region.py} (100%) diff --git a/docs/source/api/network/regions.rst b/docs/source/api/network/regions.rst index ff108d8106..26b865db8a 100644 --- a/docs/source/api/network/regions.rst +++ b/docs/source/api/network/regions.rst @@ -40,7 +40,7 @@ AnomalyLikelihoodRegion CLAClassifierRegion ^^^^^^^^^^^^^^^^^^^ -.. autoclass:: nupic.regions.CLAClassifierRegion.CLAClassifierRegion +.. autoclass:: nupic.regions.cla_classifier_region.CLAClassifierRegion :members: :show-inheritance: diff --git a/src/nupic/engine/__init__.py b/src/nupic/engine/__init__.py index 25fc6a2e67..a5edc48372 100644 --- a/src/nupic/engine/__init__.py +++ b/src/nupic/engine/__init__.py @@ -44,7 +44,7 @@ ("nupic.bindings.regions.TestNode", "TestNode"), ("nupic.regions.AnomalyLikelihoodRegion", "AnomalyLikelihoodRegion"), ("nupic.regions.anomaly_region", "AnomalyRegion"), - ("nupic.regions.CLAClassifierRegion", "CLAClassifierRegion"), + ("nupic.regions.cla_classifier_region", "CLAClassifierRegion"), ("nupic.regions.KNNAnomalyClassifierRegion", "KNNAnomalyClassifierRegion"), ("nupic.regions.KNNClassifierRegion", "KNNClassifierRegion"), ("nupic.regions.PluggableEncoderSensor", "PluggableEncoderSensor"), diff --git a/src/nupic/regions/CLAClassifierRegion.py b/src/nupic/regions/cla_classifier_region.py similarity index 100% rename from src/nupic/regions/CLAClassifierRegion.py rename to src/nupic/regions/cla_classifier_region.py From ff2699aac3917900daa98ac45cf5398129a084a2 Mon Sep 17 00:00:00 2001 From: Matthew Taylor Date: Tue, 23 May 2017 12:55:09 -0700 Subject: [PATCH 07/12] Moved KNNAnomalyClassifierRegion.py -> knn_anomaly_classifier_region.py --- docs/source/api/network/regions.rst | 2 +- src/nupic/engine/__init__.py | 2 +- ...malyClassifierRegion.py => knn_anomaly_classifier_region.py} | 0 tests/unit/nupic/regions/knn_anomaly_classifier_region_test.py | 2 +- 4 files changed, 3 insertions(+), 3 deletions(-) rename src/nupic/regions/{KNNAnomalyClassifierRegion.py => knn_anomaly_classifier_region.py} (100%) diff --git a/docs/source/api/network/regions.rst b/docs/source/api/network/regions.rst index 26b865db8a..b6be81801e 100644 --- a/docs/source/api/network/regions.rst +++ b/docs/source/api/network/regions.rst @@ -47,7 +47,7 @@ CLAClassifierRegion KNNAnomalyClassifierRegion ^^^^^^^^^^^^^^^^^^^^^^^^^^ -.. autoclass:: nupic.regions.KNNAnomalyClassifierRegion.KNNAnomalyClassifierRegion +.. autoclass:: nupic.regions.knn_anomaly_classifier_region.KNNAnomalyClassifierRegion :members: :show-inheritance: diff --git a/src/nupic/engine/__init__.py b/src/nupic/engine/__init__.py index a5edc48372..5767ec3a22 100644 --- a/src/nupic/engine/__init__.py +++ b/src/nupic/engine/__init__.py @@ -45,7 +45,7 @@ ("nupic.regions.AnomalyLikelihoodRegion", "AnomalyLikelihoodRegion"), ("nupic.regions.anomaly_region", "AnomalyRegion"), ("nupic.regions.cla_classifier_region", "CLAClassifierRegion"), - ("nupic.regions.KNNAnomalyClassifierRegion", "KNNAnomalyClassifierRegion"), + ("nupic.regions.knn_anomaly_classifier_region", "KNNAnomalyClassifierRegion"), ("nupic.regions.KNNClassifierRegion", "KNNClassifierRegion"), ("nupic.regions.PluggableEncoderSensor", "PluggableEncoderSensor"), ("nupic.regions.PyRegion", "PyRegion"), diff --git a/src/nupic/regions/KNNAnomalyClassifierRegion.py b/src/nupic/regions/knn_anomaly_classifier_region.py similarity index 100% rename from src/nupic/regions/KNNAnomalyClassifierRegion.py rename to src/nupic/regions/knn_anomaly_classifier_region.py diff --git a/tests/unit/nupic/regions/knn_anomaly_classifier_region_test.py b/tests/unit/nupic/regions/knn_anomaly_classifier_region_test.py index 8221b9298a..0c5574e4ac 100755 --- a/tests/unit/nupic/regions/knn_anomaly_classifier_region_test.py +++ b/tests/unit/nupic/regions/knn_anomaly_classifier_region_test.py @@ -32,7 +32,7 @@ TestOptionParser) from nupic.frameworks.opf.opf_utils import InferenceType -from nupic.regions.KNNAnomalyClassifierRegion import ( +from nupic.regions.knn_anomaly_classifier_region import ( KNNAnomalyClassifierRegion, _CLAClassificationRecord) From d97e829001fa13cca5de54cb9ac75c2fff8d0bc2 Mon Sep 17 00:00:00 2001 From: Matthew Taylor Date: Tue, 23 May 2017 13:56:59 -0700 Subject: [PATCH 08/12] Move more regions (snake_case) renamed: src/nupic/regions/KNNClassifierRegion.py -> src/nupic/regions/knn_classifier_region.py renamed: src/nupic/regions/PluggableEncoderSensor.py -> src/nupic/regions/pluggable_encoder_sensor.py renamed: src/nupic/regions/SDRClassifierRegion.py -> src/nupic/regions/sdr_classifier_region.py --- docs/source/api/network/regions.rst | 4 ++-- docs/source/api/network/sensors.rst | 2 +- docs/source/quick-start/network.rst | 2 +- src/nupic/engine/__init__.py | 6 +++--- src/nupic/regions/knn_anomaly_classifier_region.py | 2 +- .../{KNNClassifierRegion.py => knn_classifier_region.py} | 0 ...luggableEncoderSensor.py => pluggable_encoder_sensor.py} | 0 .../{SDRClassifierRegion.py => sdr_classifier_region.py} | 0 8 files changed, 8 insertions(+), 8 deletions(-) rename src/nupic/regions/{KNNClassifierRegion.py => knn_classifier_region.py} (100%) rename src/nupic/regions/{PluggableEncoderSensor.py => pluggable_encoder_sensor.py} (100%) rename src/nupic/regions/{SDRClassifierRegion.py => sdr_classifier_region.py} (100%) diff --git a/docs/source/api/network/regions.rst b/docs/source/api/network/regions.rst index b6be81801e..434496d0d3 100644 --- a/docs/source/api/network/regions.rst +++ b/docs/source/api/network/regions.rst @@ -55,7 +55,7 @@ KNNAnomalyClassifierRegion KNNClassifierRegion ^^^^^^^^^^^^^^^^^^^ -.. autoclass:: nupic.regions.KNNClassifierRegion.KNNClassifierRegion +.. autoclass:: nupic.regions.knn_classifier_region.KNNClassifierRegion :members: :show-inheritance: @@ -63,6 +63,6 @@ KNNClassifierRegion SDRClassifierRegion ^^^^^^^^^^^^^^^^^^^ -.. autoclass:: nupic.regions.SDRClassifierRegion.SDRClassifierRegion +.. autoclass:: nupic.regions.sdr_classifier_region.SDRClassifierRegion :members: :show-inheritance: diff --git a/docs/source/api/network/sensors.rst b/docs/source/api/network/sensors.rst index 471dccab3c..7cd2f18217 100644 --- a/docs/source/api/network/sensors.rst +++ b/docs/source/api/network/sensors.rst @@ -4,7 +4,7 @@ Sensors PluggableEncoderSensor ^^^^^^^^^^^^^^^^^^^^^^ -.. autoclass:: nupic.regions.PluggableEncoderSensor.PluggableEncoderSensor +.. autoclass:: nupic.regions.pluggable_encoder_sensor.PluggableEncoderSensor :members: :show-inheritance: diff --git a/docs/source/quick-start/network.rst b/docs/source/quick-start/network.rst index b444cc2a12..953d22b79d 100644 --- a/docs/source/quick-start/network.rst +++ b/docs/source/quick-start/network.rst @@ -194,7 +194,7 @@ classifier region. In our case, we are interested in: probabilities = classifierRegion.getOutputData("probabilities") -Refer to the documentation of :class:`~nupic.regions.SDRClassifierRegion.SDRClassifierRegion` for +Refer to the documentation of :class:`~nupic.regions.sdr_classifier_region.SDRClassifierRegion` for more information about output values and their structure. We'll use the helper function below to extract predictions more easily from diff --git a/src/nupic/engine/__init__.py b/src/nupic/engine/__init__.py index 5767ec3a22..5022aec3df 100644 --- a/src/nupic/engine/__init__.py +++ b/src/nupic/engine/__init__.py @@ -46,11 +46,11 @@ ("nupic.regions.anomaly_region", "AnomalyRegion"), ("nupic.regions.cla_classifier_region", "CLAClassifierRegion"), ("nupic.regions.knn_anomaly_classifier_region", "KNNAnomalyClassifierRegion"), - ("nupic.regions.KNNClassifierRegion", "KNNClassifierRegion"), - ("nupic.regions.PluggableEncoderSensor", "PluggableEncoderSensor"), + ("nupic.regions.knn_classifier_region", "KNNClassifierRegion"), + ("nupic.regions.pluggable_encoder_sensor", "PluggableEncoderSensor"), ("nupic.regions.PyRegion", "PyRegion"), ("nupic.regions.record_sensor", "RecordSensor"), - ("nupic.regions.SDRClassifierRegion", "SDRClassifierRegion"), + ("nupic.regions.sdr_classifier_region", "SDRClassifierRegion"), ("nupic.regions.SPRegion", "SPRegion"), ("nupic.regions.SVMClassifierNode", "SVMClassifierNode"), ("nupic.regions.TestRegion", "TestRegion"), diff --git a/src/nupic/regions/knn_anomaly_classifier_region.py b/src/nupic/regions/knn_anomaly_classifier_region.py index 9ce73618b7..a9c3e3c709 100644 --- a/src/nupic/regions/knn_anomaly_classifier_region.py +++ b/src/nupic/regions/knn_anomaly_classifier_region.py @@ -29,7 +29,7 @@ from nupic.algorithms import anomaly from nupic.bindings.regions.PyRegion import PyRegion -from KNNClassifierRegion import KNNClassifierRegion +from knn_classifier_region import KNNClassifierRegion from nupic.bindings.math import Random from nupic.frameworks.opf.exceptions import (HTMPredictionModelInvalidRangeError, HTMPredictionModelInvalidArgument) diff --git a/src/nupic/regions/KNNClassifierRegion.py b/src/nupic/regions/knn_classifier_region.py similarity index 100% rename from src/nupic/regions/KNNClassifierRegion.py rename to src/nupic/regions/knn_classifier_region.py diff --git a/src/nupic/regions/PluggableEncoderSensor.py b/src/nupic/regions/pluggable_encoder_sensor.py similarity index 100% rename from src/nupic/regions/PluggableEncoderSensor.py rename to src/nupic/regions/pluggable_encoder_sensor.py diff --git a/src/nupic/regions/SDRClassifierRegion.py b/src/nupic/regions/sdr_classifier_region.py similarity index 100% rename from src/nupic/regions/SDRClassifierRegion.py rename to src/nupic/regions/sdr_classifier_region.py From 4731f294de250b6ec05c1600aca89f4b04cb93c1 Mon Sep 17 00:00:00 2001 From: Matthew Taylor Date: Tue, 23 May 2017 14:24:26 -0700 Subject: [PATCH 09/12] Moved nupic.regions.Spec -> nupic.regions.spec --- src/nupic/regions/{Spec.py => spec.py} | 0 tests/unit/nupic/regions/regions_spec_test.py | 2 +- 2 files changed, 1 insertion(+), 1 deletion(-) rename src/nupic/regions/{Spec.py => spec.py} (100%) diff --git a/src/nupic/regions/Spec.py b/src/nupic/regions/spec.py similarity index 100% rename from src/nupic/regions/Spec.py rename to src/nupic/regions/spec.py diff --git a/tests/unit/nupic/regions/regions_spec_test.py b/tests/unit/nupic/regions/regions_spec_test.py index a76cdc4795..a839b9c6a8 100755 --- a/tests/unit/nupic/regions/regions_spec_test.py +++ b/tests/unit/nupic/regions/regions_spec_test.py @@ -21,7 +21,7 @@ import unittest2 as unittest -from nupic.regions.Spec import (Spec, +from nupic.regions.spec import (Spec, InputSpec, OutputSpec, ParameterSpec, From 5364a55ecef7779f01602a98666d6ada9449af41 Mon Sep 17 00:00:00 2001 From: Matthew Taylor Date: Tue, 23 May 2017 14:39:51 -0700 Subject: [PATCH 10/12] Renamed sp and tm regions renamed: src/nupic/regions/SPRegion.py -> src/nupic/regions/sp_region.py renamed: src/nupic/regions/TMRegion.py -> src/nupic/regions/tm_region.py --- docs/source/api/network/regions.rst | 4 ++-- examples/network/network_api_demo.py | 4 ++-- src/nupic/engine/__init__.py | 6 +++--- src/nupic/regions/{SPRegion.py => sp_region.py} | 0 src/nupic/regions/{TMRegion.py => tm_region.py} | 0 tests/integration/nupic/engine/network_checkpoint_test.py | 2 +- tests/integration/nupic/engine/network_creation_common.py | 4 ++-- .../nupic/engine/temporal_memory_compatibility_test.py | 2 +- tests/integration/nupic/opf/opf_region_test.py | 4 ++-- tests/unit/nupic/engine/network_test.py | 2 +- 10 files changed, 14 insertions(+), 14 deletions(-) rename src/nupic/regions/{SPRegion.py => sp_region.py} (100%) rename src/nupic/regions/{TMRegion.py => tm_region.py} (100%) diff --git a/docs/source/api/network/regions.rst b/docs/source/api/network/regions.rst index 434496d0d3..5772d5c4f7 100644 --- a/docs/source/api/network/regions.rst +++ b/docs/source/api/network/regions.rst @@ -19,14 +19,14 @@ AnomalyRegion SPRegion ^^^^^^^^^^^^^ -.. autoclass:: nupic.regions.SPRegion.SPRegion +.. autoclass:: nupic.regions.sp_region.SPRegion :members: :show-inheritance: TMRegion ^^^^^^^^^^^^^ -.. autoclass:: nupic.regions.TMRegion.TMRegion +.. autoclass:: nupic.regions.tm_region.TMRegion :members: :show-inheritance: diff --git a/examples/network/network_api_demo.py b/examples/network/network_api_demo.py index 3972e9ac6e..313caf44f0 100755 --- a/examples/network/network_api_demo.py +++ b/examples/network/network_api_demo.py @@ -29,8 +29,8 @@ from nupic.data.file_record_stream import FileRecordStream from nupic.engine import Network from nupic.encoders import MultiEncoder, ScalarEncoder, DateEncoder -from nupic.regions.SPRegion import SPRegion -from nupic.regions.TMRegion import TMRegion +from nupic.regions.sp_region import SPRegion +from nupic.regions.tm_region import TMRegion _VERBOSITY = 0 # how chatty the demo should be _SEED = 1956 # the random seed used throughout diff --git a/src/nupic/engine/__init__.py b/src/nupic/engine/__init__.py index 5022aec3df..7e99cb4f75 100644 --- a/src/nupic/engine/__init__.py +++ b/src/nupic/engine/__init__.py @@ -51,10 +51,10 @@ ("nupic.regions.PyRegion", "PyRegion"), ("nupic.regions.record_sensor", "RecordSensor"), ("nupic.regions.sdr_classifier_region", "SDRClassifierRegion"), - ("nupic.regions.SPRegion", "SPRegion"), + ("nupic.regions.sp_region", "SPRegion"), ("nupic.regions.SVMClassifierNode", "SVMClassifierNode"), ("nupic.regions.TestRegion", "TestRegion"), - ("nupic.regions.TMRegion", "TMRegion"), + ("nupic.regions.tm_region", "TMRegion"), ("nupic.regions.UnimportableNode", "UnimportableNode"), ) @@ -727,7 +727,7 @@ def save(self, *args, **kwargs): def getRegionsByType(self, regionClass): """ Gets all region instances of a given class - (for example, nupic.regions.SPRegion.SPRegion). + (for example, nupic.regions.sp_region.SPRegion). """ regions = [] diff --git a/src/nupic/regions/SPRegion.py b/src/nupic/regions/sp_region.py similarity index 100% rename from src/nupic/regions/SPRegion.py rename to src/nupic/regions/sp_region.py diff --git a/src/nupic/regions/TMRegion.py b/src/nupic/regions/tm_region.py similarity index 100% rename from src/nupic/regions/TMRegion.py rename to src/nupic/regions/tm_region.py diff --git a/tests/integration/nupic/engine/network_checkpoint_test.py b/tests/integration/nupic/engine/network_checkpoint_test.py index 5d09aed2cd..16602894d2 100755 --- a/tests/integration/nupic/engine/network_checkpoint_test.py +++ b/tests/integration/nupic/engine/network_checkpoint_test.py @@ -22,7 +22,7 @@ import unittest import numpy -from nupic.regions.SPRegion import SPRegion +from nupic.regions.sp_region import SPRegion from nupic.regions.record_sensor import RecordSensor from network_creation_common import createAndRunNetwork diff --git a/tests/integration/nupic/engine/network_creation_common.py b/tests/integration/nupic/engine/network_creation_common.py index 8de4d21c3a..fa24b6d4fd 100755 --- a/tests/integration/nupic/engine/network_creation_common.py +++ b/tests/integration/nupic/engine/network_creation_common.py @@ -30,8 +30,8 @@ from nupic.engine import Network from nupic.encoders import MultiEncoder, ScalarEncoder, DateEncoder from nupic.regions.record_sensor import RecordSensor -from nupic.regions.SPRegion import SPRegion -from nupic.regions.TMRegion import TMRegion +from nupic.regions.sp_region import SPRegion +from nupic.regions.tm_region import TMRegion try: import capnp diff --git a/tests/integration/nupic/engine/temporal_memory_compatibility_test.py b/tests/integration/nupic/engine/temporal_memory_compatibility_test.py index 43f7cd3bf2..742d7ad2f4 100755 --- a/tests/integration/nupic/engine/temporal_memory_compatibility_test.py +++ b/tests/integration/nupic/engine/temporal_memory_compatibility_test.py @@ -23,7 +23,7 @@ import unittest import numpy -from nupic.regions.TMRegion import TMRegion +from nupic.regions.tm_region import TMRegion from network_creation_common import createAndRunNetwork diff --git a/tests/integration/nupic/opf/opf_region_test.py b/tests/integration/nupic/opf/opf_region_test.py index ffee694d80..653ae7d8b3 100755 --- a/tests/integration/nupic/opf/opf_region_test.py +++ b/tests/integration/nupic/opf/opf_region_test.py @@ -53,8 +53,8 @@ from nupic.data.file_record_stream import FileRecordStream from nupic.encoders import MultiEncoder from nupic.engine import Network -from nupic.regions.SPRegion import SPRegion -from nupic.regions.TMRegion import TMRegion +from nupic.regions.sp_region import SPRegion +from nupic.regions.tm_region import TMRegion from nupic.support.unittesthelpers.testcasebase import TestCaseBase _VERBOSITY = 0 # how chatty the unit tests should be diff --git a/tests/unit/nupic/engine/network_test.py b/tests/unit/nupic/engine/network_test.py index b4b5b78ef4..36faf67919 100755 --- a/tests/unit/nupic/engine/network_test.py +++ b/tests/unit/nupic/engine/network_test.py @@ -25,7 +25,7 @@ from nupic import engine from nupic.bindings.regions.TestNode import TestNode -from nupic.regions.SPRegion import SPRegion +from nupic.regions.sp_region import SPRegion From fb8cd5dba49eb8cd410de30834a1158f879e0f21 Mon Sep 17 00:00:00 2001 From: Matthew Taylor Date: Tue, 23 May 2017 14:59:05 -0700 Subject: [PATCH 11/12] More region renaming RecordSensorFilter -> record_sensor_filters SVMClassifierNode -> svm_classifier_node TestRegion -> test_region UnimportableNode -> unimportable_node --- docs/README.md | 2 +- .../prediction/experiments/dutyCycle/base/description.py | 2 +- src/nupic/engine/__init__.py | 6 +++--- .../__init__.py | 0 .../add_noise.py | 0 .../modify_fields.py | 0 .../{SVMClassifierNode.py => svm_classifier_node.py} | 0 src/nupic/regions/{TestRegion.py => test_region.py} | 0 .../regions/{UnimportableNode.py => unimportable_node.py} | 0 tests/unit/nupic/engine/network_test.py | 6 +++--- 10 files changed, 8 insertions(+), 8 deletions(-) rename src/nupic/regions/{RecordSensorFilters => record_sensor_filters}/__init__.py (100%) rename src/nupic/regions/{RecordSensorFilters => record_sensor_filters}/add_noise.py (100%) rename src/nupic/regions/{RecordSensorFilters => record_sensor_filters}/modify_fields.py (100%) rename src/nupic/regions/{SVMClassifierNode.py => svm_classifier_node.py} (100%) rename src/nupic/regions/{TestRegion.py => test_region.py} (100%) rename src/nupic/regions/{UnimportableNode.py => unimportable_node.py} (100%) diff --git a/docs/README.md b/docs/README.md index 569d0b5f7c..8d3e3cf2fb 100644 --- a/docs/README.md +++ b/docs/README.md @@ -163,7 +163,7 @@ nupic │   ├── KNNClassifierRegion.py [TODO] │   ├── PluggableEncoderSensor.py [TODO] │   ├── RecordSensor.py [TODO] -│   ├── RecordSensorFilters +│   ├── record_sensor_filters │   │   ├── add_noise.py [TODO] │   │   └── modify_fields.py [TODO] │   ├── SDRClassifierRegion.py [TODO] diff --git a/examples/prediction/experiments/dutyCycle/base/description.py b/examples/prediction/experiments/dutyCycle/base/description.py index 6b7dc2dbe8..cd86bff031 100644 --- a/examples/prediction/experiments/dutyCycle/base/description.py +++ b/examples/prediction/experiments/dutyCycle/base/description.py @@ -35,7 +35,7 @@ displaySPCoincidences, setAttribute, sensorOpen) -from nupic.regions.RecordSensorFilters.modify_fields import ModifyFields +from nupic.regions.record_sensor_filters.modify_fields import ModifyFields diff --git a/src/nupic/engine/__init__.py b/src/nupic/engine/__init__.py index 7e99cb4f75..2020a9cbb4 100644 --- a/src/nupic/engine/__init__.py +++ b/src/nupic/engine/__init__.py @@ -52,10 +52,10 @@ ("nupic.regions.record_sensor", "RecordSensor"), ("nupic.regions.sdr_classifier_region", "SDRClassifierRegion"), ("nupic.regions.sp_region", "SPRegion"), - ("nupic.regions.SVMClassifierNode", "SVMClassifierNode"), - ("nupic.regions.TestRegion", "TestRegion"), + ("nupic.regions.svm_classifier_node", "SVMClassifierNode"), + ("nupic.regions.test_region", "TestRegion"), ("nupic.regions.tm_region", "TMRegion"), - ("nupic.regions.UnimportableNode", "UnimportableNode"), + ("nupic.regions.unimportable_node", "UnimportableNode"), ) registeredRegions = False diff --git a/src/nupic/regions/RecordSensorFilters/__init__.py b/src/nupic/regions/record_sensor_filters/__init__.py similarity index 100% rename from src/nupic/regions/RecordSensorFilters/__init__.py rename to src/nupic/regions/record_sensor_filters/__init__.py diff --git a/src/nupic/regions/RecordSensorFilters/add_noise.py b/src/nupic/regions/record_sensor_filters/add_noise.py similarity index 100% rename from src/nupic/regions/RecordSensorFilters/add_noise.py rename to src/nupic/regions/record_sensor_filters/add_noise.py diff --git a/src/nupic/regions/RecordSensorFilters/modify_fields.py b/src/nupic/regions/record_sensor_filters/modify_fields.py similarity index 100% rename from src/nupic/regions/RecordSensorFilters/modify_fields.py rename to src/nupic/regions/record_sensor_filters/modify_fields.py diff --git a/src/nupic/regions/SVMClassifierNode.py b/src/nupic/regions/svm_classifier_node.py similarity index 100% rename from src/nupic/regions/SVMClassifierNode.py rename to src/nupic/regions/svm_classifier_node.py diff --git a/src/nupic/regions/TestRegion.py b/src/nupic/regions/test_region.py similarity index 100% rename from src/nupic/regions/TestRegion.py rename to src/nupic/regions/test_region.py diff --git a/src/nupic/regions/UnimportableNode.py b/src/nupic/regions/unimportable_node.py similarity index 100% rename from src/nupic/regions/UnimportableNode.py rename to src/nupic/regions/unimportable_node.py diff --git a/tests/unit/nupic/engine/network_test.py b/tests/unit/nupic/engine/network_test.py index 36faf67919..6dde6575bd 100755 --- a/tests/unit/nupic/engine/network_test.py +++ b/tests/unit/nupic/engine/network_test.py @@ -45,8 +45,8 @@ def testErrorHandling(self): orig_import = __import__ def import_mock(name, *args): - if name == "nupic.regions.UnimportableNode": - raise SyntaxError("invalid syntax (UnimportableNode.py, line 5)") + if name == "nupic.regions.unimportable_node": + raise SyntaxError("invalid syntax (unimportable_node.py, line 5)") return orig_import(name, *args) @@ -55,7 +55,7 @@ def import_mock(name, *args): with self.assertRaises(Exception) as cm: n.addRegion('r', 'py.UnimportableNode', '') - self.assertEqual(cm.exception.message, "invalid syntax (UnimportableNode.py, line 5)") + self.assertEqual(cm.exception.message, "invalid syntax (unimportable_node.py, line 5)") # Test failure in the __init__() method with self.assertRaises(Exception) as cm: From 4ec163f8d75f869876871b9c618da635491f3595 Mon Sep 17 00:00:00 2001 From: Matthew Taylor Date: Tue, 23 May 2017 15:09:38 -0700 Subject: [PATCH 12/12] Updated docs readme with new region namespaces --- docs/README.md | 28 ++++++++++++++-------------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/docs/README.md b/docs/README.md index 8d3e3cf2fb..2212dc6939 100644 --- a/docs/README.md +++ b/docs/README.md @@ -156,23 +156,23 @@ nupic │   ├── stats.py [TODO] │   └── topology.py [TODO] ├── regions -│   ├── AnomalyLikelihoodRegion.py [OK] -│   ├── AnomalyRegion.py [OK] -│   ├── CLAClassifierRegion.py [TODO] -│   ├── KNNAnomalyClassifierRegion.py [TODO] -│   ├── KNNClassifierRegion.py [TODO] -│   ├── PluggableEncoderSensor.py [TODO] -│   ├── RecordSensor.py [TODO] +│   ├── anomaly_likelihood_region.py [OK] +│   ├── anomaly_region.py [OK] +│   ├── cla_classifier_region.py [TODO] +│   ├── knn_anomaly_classifier_region.py [TODO] +│   ├── knn_classifier_region.py [TODO] +│   ├── pluggable_encoder_sensor.py [TODO] +│   ├── record_sensor.py [TODO] │   ├── record_sensor_filters │   │   ├── add_noise.py [TODO] │   │   └── modify_fields.py [TODO] -│   ├── SDRClassifierRegion.py [TODO] -│   ├── SPRegion.py [TODO] -│   ├── SVMClassifierNode.py [TODO] -│   ├── Spec.py [TODO] -│   ├── TMRegion.py [TODO] -│   ├── TestRegion.py [TODO] -│   └─── UnimportableNode.py [TODO] +│   ├── sdr_classifier_region.py [TODO] +│   ├── sp_region.py [TODO] +│   ├── svm_classifier_node.py [TODO] +│   ├── spec.py [TODO] +│   ├── tm_region.py [TODO] +│   ├── test_region.py [TODO] +│   └─── unimportable_node.py [TODO] ├── serializable.py [TODO] ├── simple_server.py [TODO] ├── support