diff --git a/docs/README.md b/docs/README.md index 4140d5f077..77f95e52e2 100644 --- a/docs/README.md +++ b/docs/README.md @@ -164,8 +164,8 @@ nupic │   ├── PluggableEncoderSensor.py [TODO] │   ├── RecordSensor.py [TODO] │   ├── RecordSensorFilters -│   │   ├── AddNoise.py [TODO] -│   │   └── ModifyFields.py [TODO] +│   │   ├── add_noise.py [TODO] +│   │   └── modify_fields.py [TODO] │   ├── SDRClassifierRegion.py [TODO] │   ├── SPRegion.py [TODO] │   ├── SVMClassifierNode.py [TODO] diff --git a/examples/opf/experiments/anomaly/spatial/10field_few2_skewed/description.py b/examples/opf/experiments/anomaly/spatial/10field_few2_skewed/description.py index 8ea587199e..ffe432865c 100644 --- a/examples/opf/experiments/anomaly/spatial/10field_few2_skewed/description.py +++ b/examples/opf/experiments/anomaly/spatial/10field_few2_skewed/description.py @@ -24,7 +24,7 @@ description.py file by replacing $XXXXXXXX tokens with desired values. This description.py file was generated by: -'~/nupic/eng/lib/python2.6/site-packages/nupic/frameworks/opf/expGenerator/ExpGenerator.py' +'~/nupic/eng/lib/python2.6/site-packages/nupic/frameworks/opf/expGenerator/experiment_generator.py' """ from nupic.frameworks.opf.exp_description_api import ExperimentDescriptionAPI diff --git a/examples/opf/experiments/anomaly/spatial/10field_few_skewed/description.py b/examples/opf/experiments/anomaly/spatial/10field_few_skewed/description.py index 8ea587199e..ffe432865c 100644 --- a/examples/opf/experiments/anomaly/spatial/10field_few_skewed/description.py +++ b/examples/opf/experiments/anomaly/spatial/10field_few_skewed/description.py @@ -24,7 +24,7 @@ description.py file by replacing $XXXXXXXX tokens with desired values. This description.py file was generated by: -'~/nupic/eng/lib/python2.6/site-packages/nupic/frameworks/opf/expGenerator/ExpGenerator.py' +'~/nupic/eng/lib/python2.6/site-packages/nupic/frameworks/opf/expGenerator/experiment_generator.py' """ from nupic.frameworks.opf.exp_description_api import ExperimentDescriptionAPI diff --git a/examples/opf/experiments/anomaly/spatial/10field_many_skewed/description.py b/examples/opf/experiments/anomaly/spatial/10field_many_skewed/description.py index dd7cee730c..8e5d8df6bf 100644 --- a/examples/opf/experiments/anomaly/spatial/10field_many_skewed/description.py +++ b/examples/opf/experiments/anomaly/spatial/10field_many_skewed/description.py @@ -24,7 +24,7 @@ description.py file by replacing $XXXXXXXX tokens with desired values. This description.py file was generated by: -'~/nupic/eng/lib/python2.6/site-packages/nupic/frameworks/opf/expGenerator/ExpGenerator.py' +'~/nupic/eng/lib/python2.6/site-packages/nupic/frameworks/opf/expGenerator/experiment_generator.py' """ from nupic.frameworks.opf.exp_description_api import ExperimentDescriptionAPI diff --git a/examples/opf/experiments/anomaly/spatial/1field_few_balanced/description.py b/examples/opf/experiments/anomaly/spatial/1field_few_balanced/description.py index f1d23c647d..c146f925f5 100644 --- a/examples/opf/experiments/anomaly/spatial/1field_few_balanced/description.py +++ b/examples/opf/experiments/anomaly/spatial/1field_few_balanced/description.py @@ -24,7 +24,7 @@ description.py file by replacing $XXXXXXXX tokens with desired values. This description.py file was generated by: -'~/nupic/eng/lib/python2.6/site-packages/nupic/frameworks/opf/expGenerator/ExpGenerator.py' +'~/nupic/eng/lib/python2.6/site-packages/nupic/frameworks/opf/expGenerator/experiment_generator.py' """ from nupic.frameworks.opf.exp_description_api import ExperimentDescriptionAPI diff --git a/examples/opf/experiments/anomaly/spatial/1field_few_skewed/description.py b/examples/opf/experiments/anomaly/spatial/1field_few_skewed/description.py index dd7cee730c..8e5d8df6bf 100644 --- a/examples/opf/experiments/anomaly/spatial/1field_few_skewed/description.py +++ b/examples/opf/experiments/anomaly/spatial/1field_few_skewed/description.py @@ -24,7 +24,7 @@ description.py file by replacing $XXXXXXXX tokens with desired values. This description.py file was generated by: -'~/nupic/eng/lib/python2.6/site-packages/nupic/frameworks/opf/expGenerator/ExpGenerator.py' +'~/nupic/eng/lib/python2.6/site-packages/nupic/frameworks/opf/expGenerator/experiment_generator.py' """ from nupic.frameworks.opf.exp_description_api import ExperimentDescriptionAPI diff --git a/examples/opf/experiments/anomaly/spatial/2field_few_6040/description.py b/examples/opf/experiments/anomaly/spatial/2field_few_6040/description.py index 96888b1fa0..0b0a0ae4ca 100644 --- a/examples/opf/experiments/anomaly/spatial/2field_few_6040/description.py +++ b/examples/opf/experiments/anomaly/spatial/2field_few_6040/description.py @@ -24,7 +24,7 @@ description.py file by replacing $XXXXXXXX tokens with desired values. This description.py file was generated by: -'~/nupic/eng/lib/python2.6/site-packages/nupic/frameworks/opf/expGenerator/ExpGenerator.py' +'~/nupic/eng/lib/python2.6/site-packages/nupic/frameworks/opf/expGenerator/experiment_generator.py' """ from nupic.frameworks.opf.exp_description_api import ExperimentDescriptionAPI diff --git a/examples/opf/experiments/anomaly/spatial/2field_few_balanced/description.py b/examples/opf/experiments/anomaly/spatial/2field_few_balanced/description.py index b7a0fc45a8..ec99673b86 100644 --- a/examples/opf/experiments/anomaly/spatial/2field_few_balanced/description.py +++ b/examples/opf/experiments/anomaly/spatial/2field_few_balanced/description.py @@ -24,7 +24,7 @@ description.py file by replacing $XXXXXXXX tokens with desired values. This description.py file was generated by: -'~/nupic/eng/lib/python2.6/site-packages/nupic/frameworks/opf/expGenerator/ExpGenerator.py' +'~/nupic/eng/lib/python2.6/site-packages/nupic/frameworks/opf/expGenerator/experiment_generator.py' """ from nupic.frameworks.opf.exp_description_api import ExperimentDescriptionAPI diff --git a/examples/opf/experiments/anomaly/spatial/2field_few_skewed/description.py b/examples/opf/experiments/anomaly/spatial/2field_few_skewed/description.py index 96888b1fa0..0b0a0ae4ca 100644 --- a/examples/opf/experiments/anomaly/spatial/2field_few_skewed/description.py +++ b/examples/opf/experiments/anomaly/spatial/2field_few_skewed/description.py @@ -24,7 +24,7 @@ description.py file by replacing $XXXXXXXX tokens with desired values. This description.py file was generated by: -'~/nupic/eng/lib/python2.6/site-packages/nupic/frameworks/opf/expGenerator/ExpGenerator.py' +'~/nupic/eng/lib/python2.6/site-packages/nupic/frameworks/opf/expGenerator/experiment_generator.py' """ from nupic.frameworks.opf.exp_description_api import ExperimentDescriptionAPI diff --git a/examples/opf/experiments/anomaly/spatial/2field_many_balanced/description.py b/examples/opf/experiments/anomaly/spatial/2field_many_balanced/description.py index 96888b1fa0..0b0a0ae4ca 100644 --- a/examples/opf/experiments/anomaly/spatial/2field_many_balanced/description.py +++ b/examples/opf/experiments/anomaly/spatial/2field_many_balanced/description.py @@ -24,7 +24,7 @@ description.py file by replacing $XXXXXXXX tokens with desired values. This description.py file was generated by: -'~/nupic/eng/lib/python2.6/site-packages/nupic/frameworks/opf/expGenerator/ExpGenerator.py' +'~/nupic/eng/lib/python2.6/site-packages/nupic/frameworks/opf/expGenerator/experiment_generator.py' """ from nupic.frameworks.opf.exp_description_api import ExperimentDescriptionAPI diff --git a/examples/opf/experiments/anomaly/spatial/2field_many_novelAtEnd/description.py b/examples/opf/experiments/anomaly/spatial/2field_many_novelAtEnd/description.py index 96888b1fa0..0b0a0ae4ca 100644 --- a/examples/opf/experiments/anomaly/spatial/2field_many_novelAtEnd/description.py +++ b/examples/opf/experiments/anomaly/spatial/2field_many_novelAtEnd/description.py @@ -24,7 +24,7 @@ description.py file by replacing $XXXXXXXX tokens with desired values. This description.py file was generated by: -'~/nupic/eng/lib/python2.6/site-packages/nupic/frameworks/opf/expGenerator/ExpGenerator.py' +'~/nupic/eng/lib/python2.6/site-packages/nupic/frameworks/opf/expGenerator/experiment_generator.py' """ from nupic.frameworks.opf.exp_description_api import ExperimentDescriptionAPI diff --git a/examples/opf/experiments/anomaly/spatial/2fields_many_skewed/description.py b/examples/opf/experiments/anomaly/spatial/2fields_many_skewed/description.py index 96888b1fa0..0b0a0ae4ca 100644 --- a/examples/opf/experiments/anomaly/spatial/2fields_many_skewed/description.py +++ b/examples/opf/experiments/anomaly/spatial/2fields_many_skewed/description.py @@ -24,7 +24,7 @@ description.py file by replacing $XXXXXXXX tokens with desired values. This description.py file was generated by: -'~/nupic/eng/lib/python2.6/site-packages/nupic/frameworks/opf/expGenerator/ExpGenerator.py' +'~/nupic/eng/lib/python2.6/site-packages/nupic/frameworks/opf/expGenerator/experiment_generator.py' """ from nupic.frameworks.opf.exp_description_api import ExperimentDescriptionAPI diff --git a/examples/opf/experiments/anomaly/spatial/novel_combination/description.py b/examples/opf/experiments/anomaly/spatial/novel_combination/description.py index 2f790d22a9..1f021f5736 100644 --- a/examples/opf/experiments/anomaly/spatial/novel_combination/description.py +++ b/examples/opf/experiments/anomaly/spatial/novel_combination/description.py @@ -24,7 +24,7 @@ description.py file by replacing $XXXXXXXX tokens with desired values. This description.py file was generated by: -'~/nupic/eng/lib/python2.6/site-packages/nupic/frameworks/opf/expGenerator/ExpGenerator.py' +'~/nupic/eng/lib/python2.6/site-packages/nupic/frameworks/opf/expGenerator/experiment_generator.py' """ from nupic.frameworks.opf.exp_description_api import ExperimentDescriptionAPI diff --git a/examples/opf/experiments/anomaly/spatial/simple/description.py b/examples/opf/experiments/anomaly/spatial/simple/description.py index a147ae1b60..f441d6ad72 100644 --- a/examples/opf/experiments/anomaly/spatial/simple/description.py +++ b/examples/opf/experiments/anomaly/spatial/simple/description.py @@ -24,7 +24,7 @@ description.py file by replacing $XXXXXXXX tokens with desired values. This description.py file was generated by: -'~/nupic/eng/lib/python2.6/site-packages/nupic/frameworks/opf/expGenerator/ExpGenerator.py' +'~/nupic/eng/lib/python2.6/site-packages/nupic/frameworks/opf/expGenerator/experiment_generator.py' """ from nupic.frameworks.opf.exp_description_api import ExperimentDescriptionAPI diff --git a/examples/opf/experiments/anomaly/temporal/hotgym/description.py b/examples/opf/experiments/anomaly/temporal/hotgym/description.py index b721413f30..927ad06c1f 100644 --- a/examples/opf/experiments/anomaly/temporal/hotgym/description.py +++ b/examples/opf/experiments/anomaly/temporal/hotgym/description.py @@ -24,7 +24,7 @@ description.py file by replacing $XXXXXXXX tokens with desired values. This description.py file was generated by: -'~/nupic/eng/lib/python2.6/site-packages/nupic/frameworks/opf/expGenerator/ExpGenerator.py' +'~/nupic/eng/lib/python2.6/site-packages/nupic/frameworks/opf/expGenerator/experiment_generator.py' """ from nupic.frameworks.opf.exp_description_api import ExperimentDescriptionAPI diff --git a/examples/opf/experiments/anomaly/temporal/saw_200/description.py b/examples/opf/experiments/anomaly/temporal/saw_200/description.py index 6ec14ddc3a..05ee643e90 100644 --- a/examples/opf/experiments/anomaly/temporal/saw_200/description.py +++ b/examples/opf/experiments/anomaly/temporal/saw_200/description.py @@ -24,7 +24,7 @@ description.py file by replacing $XXXXXXXX tokens with desired values. This description.py file was generated by: -'~/nupic/eng/lib/python2.6/site-packages/nupic/frameworks/opf/expGenerator/ExpGenerator.py' +'~/nupic/eng/lib/python2.6/site-packages/nupic/frameworks/opf/expGenerator/experiment_generator.py' """ from nupic.frameworks.opf.exp_description_api import ExperimentDescriptionAPI diff --git a/examples/opf/experiments/anomaly/temporal/saw_big/description.py b/examples/opf/experiments/anomaly/temporal/saw_big/description.py index 9b1bf7474a..a6d32be52a 100644 --- a/examples/opf/experiments/anomaly/temporal/saw_big/description.py +++ b/examples/opf/experiments/anomaly/temporal/saw_big/description.py @@ -24,7 +24,7 @@ description.py file by replacing $XXXXXXXX tokens with desired values. This description.py file was generated by: -'~/nupic/eng/lib/python2.6/site-packages/nupic/frameworks/opf/expGenerator/ExpGenerator.py' +'~/nupic/eng/lib/python2.6/site-packages/nupic/frameworks/opf/expGenerator/experiment_generator.py' """ from nupic.frameworks.opf.exp_description_api import ExperimentDescriptionAPI diff --git a/examples/opf/experiments/classification/base_category/description.py b/examples/opf/experiments/classification/base_category/description.py index 3ae8c005e5..650721d897 100644 --- a/examples/opf/experiments/classification/base_category/description.py +++ b/examples/opf/experiments/classification/base_category/description.py @@ -24,7 +24,7 @@ description.py file by replacing $XXXXXXXX tokens with desired values. This description.py file was generated by: -'~/nupic/eng/lib/python2.6/site-packages/nupic/frameworks/opf/expGenerator/ExpGenerator.py' +'~/nupic/eng/lib/python2.6/site-packages/nupic/frameworks/opf/expGenerator/experiment_generator.py' """ from nupic.frameworks.opf.exp_description_api import ExperimentDescriptionAPI diff --git a/examples/opf/experiments/classification/base_scalar/description.py b/examples/opf/experiments/classification/base_scalar/description.py index badfbbd03e..660c8c07ee 100644 --- a/examples/opf/experiments/classification/base_scalar/description.py +++ b/examples/opf/experiments/classification/base_scalar/description.py @@ -24,7 +24,7 @@ description.py file by replacing $XXXXXXXX tokens with desired values. This description.py file was generated by: -'~/nupic/eng/lib/python2.6/site-packages/nupic/frameworks/opf/expGenerator/ExpGenerator.py' +'~/nupic/eng/lib/python2.6/site-packages/nupic/frameworks/opf/expGenerator/experiment_generator.py' """ from nupic.frameworks.opf.exp_description_api import ExperimentDescriptionAPI diff --git a/examples/opf/experiments/missing_record/base/description.py b/examples/opf/experiments/missing_record/base/description.py index ea3cab8114..3b0998a61f 100644 --- a/examples/opf/experiments/missing_record/base/description.py +++ b/examples/opf/experiments/missing_record/base/description.py @@ -24,7 +24,7 @@ description.py file by replacing $XXXXXXXX tokens with desired values. This description.py file was generated by: -'~/nupic/eng/lib/python2.6/site-packages/nupic/frameworks/opf/expGenerator/ExpGenerator.py' +'~/nupic/eng/lib/python2.6/site-packages/nupic/frameworks/opf/expGenerator/experiment_generator.py' """ from nupic.frameworks.opf.exp_description_api import ExperimentDescriptionAPI diff --git a/examples/opf/experiments/multistep/base/description.py b/examples/opf/experiments/multistep/base/description.py index 493eb6ae17..432c572d24 100644 --- a/examples/opf/experiments/multistep/base/description.py +++ b/examples/opf/experiments/multistep/base/description.py @@ -24,7 +24,7 @@ description.py file by replacing $XXXXXXXX tokens with desired values. This description.py file was generated by: -'~/nupic/eng/lib/python2.6/site-packages/nupic/frameworks/opf/expGenerator/ExpGenerator.py' +'~/nupic/eng/lib/python2.6/site-packages/nupic/frameworks/opf/expGenerator/experiment_generator.py' """ from nupic.frameworks.opf.exp_description_api import ExperimentDescriptionAPI diff --git a/examples/opf/experiments/multistep/base/permutations_simple_3.py b/examples/opf/experiments/multistep/base/permutations_simple_3.py index 5e8e3cb6b6..d69abd24d2 100644 --- a/examples/opf/experiments/multistep/base/permutations_simple_3.py +++ b/examples/opf/experiments/multistep/base/permutations_simple_3.py @@ -27,7 +27,7 @@ """ import os from pkg_resources import resources_filename -from nupic.swarming.permutationhelpers import * +from nupic.swarming.permutation_helpers import * # The name of the field being predicted. Any allowed permutation MUST contain # the prediction field. @@ -35,25 +35,25 @@ predictedField = 'field2' permutations = { - # Encoder permutation choices + # Encoder permutation choices # Example: # # '__gym_encoder' : PermuteEncoder('gym', 'SDRCategoryEncoder', w=7, # n=100), - # - # '__address_encoder' : PermuteEncoder('address', 'SDRCategoryEncoder', + # + # '__address_encoder' : PermuteEncoder('address', 'SDRCategoryEncoder', # w=7, n=100), - # - # '__timestamp_timeOfDay_encoder' : PermuteEncoder('timestamp', + # + # '__timestamp_timeOfDay_encoder' : PermuteEncoder('timestamp', # 'DateEncoder.timeOfDay', w=7, radius=PermuteChoices([1, 8])), - # - # '__timestamp_dayOfWeek_encoder' : PermuteEncoder('timestamp', + # + # '__timestamp_dayOfWeek_encoder' : PermuteEncoder('timestamp', # 'DateEncoder.dayOfWeek', w=7, radius=PermuteChoices([1, 3])), - # - # '__consumption_encoder' : PermuteEncoder('consumption', 'ScalarEncoder', - # w=7, n=PermuteInt(13, 500, 20), minval=0, + # + # '__consumption_encoder' : PermuteEncoder('consumption', 'ScalarEncoder', + # w=7, n=PermuteInt(13, 500, 20), minval=0, # maxval=PermuteInt(100, 300, 25)), - # + # # (generated from PERM_ENCODER_CHOICES) 'predictedField': 'field2', 'predictionSteps': [1,3], @@ -63,10 +63,10 @@ 'dataSource': 'file://%s' % (resource_filename("nupic", relativePath)), '__field2_encoder' : PermuteEncoder(fieldName='field2', - clipInput=True, minval = 0, maxval=50, - encoderClass='ScalarEncoder', + clipInput=True, minval = 0, maxval=50, + encoderClass='ScalarEncoder', w=21, n=PermuteChoices([500])), - + } @@ -91,16 +91,16 @@ def permutationFilter(perm): """ This function can be used to selectively filter out specific permutation combinations. It is called by RunPermutations for every possible permutation of the variables in the permutations dict. It should return True for valid a - combination of permutation values and False for an invalid one. - + combination of permutation values and False for an invalid one. + Parameters: --------------------------------------------------------- perm: dict of one possible combination of name:value pairs chosen from permutations. """ - + # An example of how to use this #if perm['__consumption_encoder']['maxval'] > 300: # return False; - # + # return True diff --git a/examples/opf/experiments/multistep/hotgym/description.py b/examples/opf/experiments/multistep/hotgym/description.py index e58b2b0d7e..dd1a0469ae 100644 --- a/examples/opf/experiments/multistep/hotgym/description.py +++ b/examples/opf/experiments/multistep/hotgym/description.py @@ -24,7 +24,7 @@ description.py file by replacing $XXXXXXXX tokens with desired values. This description.py file was generated by: -'~/nupic/eng/lib/python2.6/site-packages/nupic/frameworks/opf/expGenerator/ExpGenerator.py' +'~/nupic/eng/lib/python2.6/site-packages/nupic/frameworks/opf/expGenerator/experiment_generator.py' """ from nupic.frameworks.opf.exp_description_api import ExperimentDescriptionAPI diff --git a/examples/opf/experiments/multistep/hotgym/permutations.py b/examples/opf/experiments/multistep/hotgym/permutations.py index 0b627f79ea..471feccbe8 100644 --- a/examples/opf/experiments/multistep/hotgym/permutations.py +++ b/examples/opf/experiments/multistep/hotgym/permutations.py @@ -24,11 +24,11 @@ permutations.py file by replacing $XXXXXXXX tokens with desired values. This permutations.py file was generated by: -'~/nupic/eng/lib/python2.6/site-packages/nupic/frameworks/opf/expGenerator/ExpGenerator.py' +'~/nupic/eng/lib/python2.6/site-packages/nupic/frameworks/opf/expGenerator/experiment_generator.py' """ -from nupic.swarming.permutationhelpers import * +from nupic.swarming.permutation_helpers import * # The name of the field being predicted. Any allowed permutation MUST contain # the prediction field. diff --git a/examples/opf/experiments/multistep/hotgym/permutations_sp.py b/examples/opf/experiments/multistep/hotgym/permutations_sp.py index 1ed89f74c6..779a00f325 100644 --- a/examples/opf/experiments/multistep/hotgym/permutations_sp.py +++ b/examples/opf/experiments/multistep/hotgym/permutations_sp.py @@ -26,7 +26,7 @@ '~/nupic/eng/lib/python2.6/site-packages/nupic/frameworks/opf/expGenerator/ExpGenerator.pyc' """ -from nupic.swarming.permutationhelpers import * +from nupic.swarming.permutation_helpers import * # The name of the field being predicted. Any allowed permutation MUST contain # the prediction field. diff --git a/examples/opf/experiments/opfrunexperiment_test/simpleOPF/hotgym/description.py b/examples/opf/experiments/opfrunexperiment_test/simpleOPF/hotgym/description.py index 803e650b35..50a6321f4d 100644 --- a/examples/opf/experiments/opfrunexperiment_test/simpleOPF/hotgym/description.py +++ b/examples/opf/experiments/opfrunexperiment_test/simpleOPF/hotgym/description.py @@ -24,7 +24,7 @@ description.py file by replacing $XXXXXXXX tokens with desired values. This description.py file was generated by: -'~/nupic/eng/lib/python2.6/site-packages/nupic/frameworks/opf/expGenerator/ExpGenerator.py' +'~/nupic/eng/lib/python2.6/site-packages/nupic/frameworks/opf/expGenerator/experiment_generator.py' """ from nupic.frameworks.opf.exp_description_api import ExperimentDescriptionAPI diff --git a/examples/opf/experiments/opfrunexperiment_test/simpleOPF/hotgym_1hr_agg/description.py b/examples/opf/experiments/opfrunexperiment_test/simpleOPF/hotgym_1hr_agg/description.py index 91a6a4f376..d9eef0aabd 100644 --- a/examples/opf/experiments/opfrunexperiment_test/simpleOPF/hotgym_1hr_agg/description.py +++ b/examples/opf/experiments/opfrunexperiment_test/simpleOPF/hotgym_1hr_agg/description.py @@ -24,7 +24,7 @@ description.py file by replacing $XXXXXXXX tokens with desired values. This description.py file was generated by: -'~/nupic/eng/lib/python2.6/site-packages/nupic/frameworks/opf/expGenerator/ExpGenerator.py' +'~/nupic/eng/lib/python2.6/site-packages/nupic/frameworks/opf/expGenerator/experiment_generator.py' """ from nupic.frameworks.opf.exp_description_api import ExperimentDescriptionAPI diff --git a/examples/opf/experiments/opfrunexperiment_test/simpleOPF/hotgym_no_agg/description.py b/examples/opf/experiments/opfrunexperiment_test/simpleOPF/hotgym_no_agg/description.py index 5f12f65b71..33035385bc 100644 --- a/examples/opf/experiments/opfrunexperiment_test/simpleOPF/hotgym_no_agg/description.py +++ b/examples/opf/experiments/opfrunexperiment_test/simpleOPF/hotgym_no_agg/description.py @@ -24,7 +24,7 @@ description.py file by replacing $XXXXXXXX tokens with desired values. This description.py file was generated by: -'~/nupic/eng/lib/python2.6/site-packages/nupic/frameworks/opf/expGenerator/ExpGenerator.py' +'~/nupic/eng/lib/python2.6/site-packages/nupic/frameworks/opf/expGenerator/experiment_generator.py' """ from nupic.frameworks.opf.exp_description_api import ExperimentDescriptionAPI diff --git a/examples/opf/experiments/spatial_classification/run_exp_generator.py b/examples/opf/experiments/spatial_classification/run_exp_generator.py index 83490cd722..0444a7079e 100755 --- a/examples/opf/experiments/spatial_classification/run_exp_generator.py +++ b/examples/opf/experiments/spatial_classification/run_exp_generator.py @@ -28,7 +28,7 @@ import json from optparse import OptionParser -from nupic.swarming.exp_generator.ExpGenerator import expGenerator +from nupic.swarming.exp_generator.experiment_generator import expGenerator @@ -42,51 +42,51 @@ dict. The schema for this dict can be found at py/nupic/swarming/exp_generator/experimentDescriptionSchema.json """ - - + + # ============================================================================ # Process command line arguments parser = OptionParser(helpString) parser.add_option("--verbosity", default=0, type="int", help="Verbosity level, either 0, 1, 2, or 3 [default: %default].") - + parser.add_option("--outDir", dest='outDir', default=None, help="Where to place generated files. Default is in the same directory" " as the searchDef script.") - - + + (options, args) = parser.parse_args() # Must provide the name of a script if len(args) != 1: parser.error("Missing required 'searchDef' argument") searchFileName = args[0] - + # ------------------------------------------------------------------------ # Read in the search script and get the search definition searchFile = open(searchFileName) vars = {} exec(searchFile, vars) searchFile.close() - + getSearchFunc = vars.get('getSearch', None) if getSearchFunc is None: raise RuntimeError("Error: the %s python script does not provide the " "required getSearch() method") - + searchDef = getSearchFunc(os.path.dirname(__file__)) if not isinstance(searchDef, dict): raise RuntimeError("The searchDef function should return a dict, but it " "returned %s" % (str(searchDef))) - + # ------------------------------------------------------------------------ # Figure out the output directory if not provided if options.outDir is None: options.outDir = os.path.dirname(searchFileName) - - + + # ------------------------------------------------------------------------ # Run through expGenerator expGenArgs = ['--description=%s' % (json.dumps(searchDef)), @@ -95,22 +95,22 @@ print "Running ExpGenerator with the following arguments: ", expGenArgs expGenerator(expGenArgs) - + # Get the permutations file name permutationsFilename = os.path.join(options.outDir, 'permutations.py') - + print "Successfully generated permutations file: %s" % (permutationsFilename) - - - - - - - - - - - - - - + + + + + + + + + + + + + + diff --git a/examples/prediction/experiments/dutyCycle/base/description.py b/examples/prediction/experiments/dutyCycle/base/description.py index a211b77f81..6b7dc2dbe8 100644 --- a/examples/prediction/experiments/dutyCycle/base/description.py +++ b/examples/prediction/experiments/dutyCycle/base/description.py @@ -21,12 +21,12 @@ import os import random -from nupic.frameworks.prediction.helpers import (updateConfigFromSubConfig, +from nupic.frameworks.prediction.helpers import (updateConfigFromSubConfig, getSubExpDir) from nupic.encoders import (LogEncoder, DateEncoder, - MultiEncoder, - CategoryEncoder, + MultiEncoder, + CategoryEncoder, ScalarEncoder, SDRCategoryEncoder) #from nupic.data import TextFileSource @@ -35,7 +35,7 @@ displaySPCoincidences, setAttribute, sensorOpen) -from nupic.regions.RecordSensorFilters.ModifyFields import ModifyFields +from nupic.regions.RecordSensorFilters.modify_fields import ModifyFields @@ -43,7 +43,7 @@ # ======================================================================== # Define this experiment's base configuration, and adjust for any modifications -# if imported from a sub-experiment. +# if imported from a sub-experiment. config = dict( sensorVerbosity = 0, spVerbosity = 0, @@ -54,7 +54,7 @@ spSynPermInactiveDec = 0.005, spCoincCount = 300, spMinPctDutyCycleAfterInh = 0.001, - + tpActivationThresholds = None, trainSP = True, @@ -63,14 +63,14 @@ trainingSet = "trainingData.csv", testingSet = "testingData.csv", - - # Data set and encoding + + # Data set and encoding numAValues = 25, numBValues = 25, b0Likelihood = 0.90, # Likelihood of getting 0 out of field B. None means - # not any more likely than any other B value. + # not any more likely than any other B value. testSetPct = 0.0, # What percent of unique combinations to reserve - + encodingFieldStyleA = 'sdr', # contiguous, sdr encodingFieldWidthA = 50, encodingOnBitsA = 21, @@ -83,9 +83,9 @@ updateConfigFromSubConfig(config) if config['encodingFieldWidthB'] is None: - config['encodingFieldWidthB'] = config['encodingFieldWidthA'] + config['encodingFieldWidthB'] = config['encodingFieldWidthA'] if config['encodingOnBitsB'] is None: - config['encodingOnBitsB'] = config['encodingOnBitsA'] + config['encodingOnBitsB'] = config['encodingOnBitsA'] if config['tpActivationThresholds'] is None: config['tpActivationThresholds'] = range(8, config['spNumActivePerInhArea']+1) @@ -97,7 +97,7 @@ def getBaseDatasets(): def getDatasets(baseDatasets, generate=False): # We're going to put datasets in data/dutyCycle/expname_.csv - + expDir = getSubExpDir() if expDir is None: name = "base" @@ -110,14 +110,14 @@ def getDatasets(baseDatasets, generate=False): datasets = dict(trainingFilename=trainingFilename) numUnique = config['numAValues'] * config['numBValues'] - testSetSize = int(config['testSetPct'] * numUnique) + testSetSize = int(config['testSetPct'] * numUnique) if testSetSize > 0: testingFilename = os.path.join(dataDir, config['testingSet']) datasets['testingFilename'] = testingFilename else: testingFilename = None - + if not generate: return datasets @@ -126,7 +126,7 @@ def getDatasets(baseDatasets, generate=False): # testing set contains combinations of A and B that do not appear in the # training set # - + if not os.path.exists(dataDir): os.makedirs(dataDir) @@ -191,7 +191,7 @@ def generateSample(): print "Creating training set: %s..." % (trainingFilename) if len(testSet) > 0: print "Contains %d samples, chosen from %d of the possible %d combinations " \ - "that are not in the test set" % (config['iterationCount'], + "that are not in the test set" % (config['iterationCount'], numUnique - testSetSize, numUnique) else: print "Contains %d samples" % (config['iterationCount']) @@ -205,7 +205,7 @@ def generateSample(): #print >>fd, "%d, %d" % (sample[0], sample[1]) o.appendRecord(list(sample)) numSamples += 1 - + return datasets def getDescription(datasets): @@ -227,12 +227,12 @@ def getDescription(datasets): if config['encodingFieldStyleB'] == 'contiguous': - encoder.addEncoder('fieldB', ScalarEncoder(w=config['encodingOnBitsB'], - n=config['encodingFieldWidthB'], minval=0, + encoder.addEncoder('fieldB', ScalarEncoder(w=config['encodingOnBitsB'], + n=config['encodingFieldWidthB'], minval=0, maxval=config['numBValues'], periodic=True, name='fieldB')) elif config['encodingFieldStyleB'] == 'sdr': - encoder.addEncoder('fieldB', SDRCategoryEncoder(w=config['encodingOnBitsB'], - n=config['encodingFieldWidthB'], + encoder.addEncoder('fieldB', SDRCategoryEncoder(w=config['encodingOnBitsB'], + n=config['encodingFieldWidthB'], categoryList=range(config['numBValues']), name='fieldB')) else: assert False @@ -249,7 +249,7 @@ def getDescription(datasets): inputDimensions = (1, encoder.getWidth()) # Layout the coincidences vertically stacked on top of each other, each - # looking at the entire input field. + # looking at the entire input field. columnDimensions = (config['spCoincCount'], 1) sensorParams = dict( @@ -264,7 +264,7 @@ def getDescription(datasets): potentialPct = 1.0, gaussianDist = 0, commonDistributions = 0, # should be False if possibly not training - localAreaDensity = -1, #0.05, + localAreaDensity = -1, #0.05, numActiveColumnsPerInhArea = config['spNumActivePerInhArea'], dutyCyclePeriod = 1000, stimulusThreshold = 1, @@ -297,7 +297,7 @@ def getDescription(datasets): network = dict( sensorDataSource = trainingDataSource, - sensorEncoder = encoder, + sensorEncoder = encoder, sensorParams = sensorParams, CLAType = 'py.CLARegion', @@ -310,7 +310,7 @@ def getDescription(datasets): if config['trainSP']: description['spTrain'] = dict( - iterationCount=config['iterationCount'], + iterationCount=config['iterationCount'], #iter=displaySPCoincidences(50), finish=printSPCoincidences() ), @@ -330,7 +330,7 @@ def getDescription(datasets): if True: datasetName = 'bothTraining' inferSteps.append( - dict(name = '%s_baseline' % datasetName, + dict(name = '%s_baseline' % datasetName, iterationCount = config['iterationCount'], setup = [sensorOpen(datasets['trainingFilename'])], ppOptions = dict(printLearnedCoincidences=True), @@ -338,7 +338,7 @@ def getDescription(datasets): ) inferSteps.append( - dict(name = '%s_acc' % datasetName, + dict(name = '%s_acc' % datasetName, iterationCount = config['iterationCount'], setup = [sensorOpen(datasets['trainingFilename'])], ppOptions = dict(onlyClassificationAcc=True, @@ -353,7 +353,7 @@ def getDescription(datasets): if 'testingFilename' in datasets: datasetName = 'bothTesting' inferSteps.append( - dict(name = '%s_baseline' % datasetName, + dict(name = '%s_baseline' % datasetName, iterationCount = config['iterationCount'], setup = [sensorOpen(datasets['testingFilename'])], ppOptions = dict(printLearnedCoincidences=False), @@ -361,7 +361,7 @@ def getDescription(datasets): ) inferSteps.append( - dict(name = '%s_acc' % datasetName, + dict(name = '%s_acc' % datasetName, iterationCount = config['iterationCount'], setup = [sensorOpen(datasets['testingFilename'])], ppOptions = dict(onlyClassificationAcc=True, diff --git a/src/nupic/regions/RecordSensorFilters/AddNoise.py b/src/nupic/regions/RecordSensorFilters/add_noise.py similarity index 100% rename from src/nupic/regions/RecordSensorFilters/AddNoise.py rename to src/nupic/regions/RecordSensorFilters/add_noise.py diff --git a/src/nupic/regions/RecordSensorFilters/ModifyFields.py b/src/nupic/regions/RecordSensorFilters/modify_fields.py similarity index 100% rename from src/nupic/regions/RecordSensorFilters/ModifyFields.py rename to src/nupic/regions/RecordSensorFilters/modify_fields.py diff --git a/src/nupic/regions/AnomalyLikelihoodRegion.py b/src/nupic/regions/anomaly_likelihood_region.py similarity index 100% rename from src/nupic/regions/AnomalyLikelihoodRegion.py rename to src/nupic/regions/anomaly_likelihood_region.py diff --git a/src/nupic/swarming/ModelRunner.py b/src/nupic/swarming/ModelRunner.py index 13c031f05d..4d3c75b629 100644 --- a/src/nupic/swarming/ModelRunner.py +++ b/src/nupic/swarming/ModelRunner.py @@ -31,7 +31,7 @@ from collections import deque from nupic.swarming.hypersearch import regression -from nupic.swarming.hypersearch.errorcodes import ErrorCodes +from nupic.swarming.hypersearch.error_codes import ErrorCodes from nupic.database.client_jobs_dao import ClientJobsDAO from nupic.frameworks.opf import helpers @@ -42,7 +42,7 @@ PeriodicActivityRequest) from nupic.frameworks.opf.prediction_metrics_manager import MetricsManager from nupic.support.configuration import Configuration -from nupic.swarming.experimentutils import InferenceElement +from nupic.swarming.experiment_utils import InferenceElement from nupic.swarming import utils diff --git a/src/nupic/swarming/DummyModelRunner.py b/src/nupic/swarming/dummy_model_runner.py similarity index 100% rename from src/nupic/swarming/DummyModelRunner.py rename to src/nupic/swarming/dummy_model_runner.py diff --git a/src/nupic/swarming/exp_generator/claDescriptionTemplate.tpl b/src/nupic/swarming/exp_generator/claDescriptionTemplate.tpl index 607d3b6c78..ce09cdd858 100644 --- a/src/nupic/swarming/exp_generator/claDescriptionTemplate.tpl +++ b/src/nupic/swarming/exp_generator/claDescriptionTemplate.tpl @@ -36,7 +36,7 @@ from nupic.frameworks.opf.exp_description_helpers import ( from nupic.frameworks.opf.htm_prediction_model_callbacks import * from nupic.frameworks.opf.metrics import MetricSpec -from nupic.swarming.experimentutils import (InferenceType, InferenceElement) +from nupic.swarming.experiment_utils import (InferenceType, InferenceElement) from nupic.support import aggregationDivide from nupic.frameworks.opf.opf_task_driver import ( diff --git a/src/nupic/swarming/exp_generator/descriptionTemplate.tpl b/src/nupic/swarming/exp_generator/descriptionTemplate.tpl index 3d47290cc4..f324e78ef0 100644 --- a/src/nupic/swarming/exp_generator/descriptionTemplate.tpl +++ b/src/nupic/swarming/exp_generator/descriptionTemplate.tpl @@ -36,7 +36,7 @@ from nupic.frameworks.opf.exp_description_helpers import ( from nupic.frameworks.opf.htm_prediction_model_callbacks import * from nupic.frameworks.opf.metrics import MetricSpec -from nupic.swarming.experimentutils import (InferenceType, InferenceElement) +from nupic.swarming.experiment_utils import (InferenceType, InferenceElement) from nupic.support import aggregationDivide from nupic.frameworks.opf.opf_task_driver import ( diff --git a/src/nupic/swarming/exp_generator/ExpGenerator.py b/src/nupic/swarming/exp_generator/experiment_generator.py similarity index 98% rename from src/nupic/swarming/exp_generator/ExpGenerator.py rename to src/nupic/swarming/exp_generator/experiment_generator.py index b8702c77b3..0c9adf0c05 100755 --- a/src/nupic/swarming/exp_generator/ExpGenerator.py +++ b/src/nupic/swarming/exp_generator/experiment_generator.py @@ -42,7 +42,7 @@ from nupic.support import aggregationDivide from nupic.support.configuration import Configuration from nupic.support.enum import Enum -from nupic.swarming.experimentutils import (InferenceType, InferenceElement) +from nupic.swarming.experiment_utils import (InferenceType, InferenceElement) @@ -172,7 +172,7 @@ def _handleDescriptionOption(cmdArgStr, outDir, usageStr, hsVersion, be 'v1' or 'v2' claDescriptionTemplateFile: Filename containing the template description retval: nothing - + """ # convert --description arg from JSON string to dict @@ -362,7 +362,7 @@ def _generateFileFromTemplates(templateFileNames, outputFilePath, templateFileName: A list of template file names; these files are assumed to be in - the same directory as the running ExpGenerator.py script. + the same directory as the running experiment_generator.py script. ExpGenerator will perform the substitution and concanetate the files in the order they are specified @@ -623,44 +623,44 @@ def _generateEncoderStringsV1(includedFields): def _generatePermEncoderStr(options, encoderDict): """ Generate the string that defines the permutations to apply for a given - encoder. - + encoder. + Parameters: ----------------------------------------------------------------------- options: experiment params encoderDict: the encoder dict, which gets placed into the description.py - - + + For example, if the encoderDict contains: - 'consumption': { + 'consumption': { 'clipInput': True, 'fieldname': u'consumption', 'n': 100, 'name': u'consumption', 'type': 'AdaptiveScalarEncoder', 'w': 21}, - + The return string will contain: - "PermuteEncoder(fieldName='consumption', - encoderClass='AdaptiveScalarEncoder', - w=21, - n=PermuteInt(28, 521), + "PermuteEncoder(fieldName='consumption', + encoderClass='AdaptiveScalarEncoder', + w=21, + n=PermuteInt(28, 521), clipInput=True)" """ permStr = "" - + # If it's the encoder for the classifier input, then it's always present so - # put it in as a dict in the permutations.py file instead of a - # PermuteEncoder(). + # put it in as a dict in the permutations.py file instead of a + # PermuteEncoder(). if encoderDict.get('classifierOnly', False): permStr = "dict(" for key, value in encoderDict.items(): if key == "name": continue - + if key == 'n' and encoderDict['type'] != 'SDRCategoryEncoder': permStr += "n=PermuteInt(%d, %d), " % (encoderDict["w"] + 7, encoderDict["w"] + 500) @@ -669,9 +669,9 @@ def _generatePermEncoderStr(options, encoderDict): permStr += "%s='%s', " % (key, value) else: permStr += "%s=%s, " % (key, value) - permStr += ")" - - + permStr += ")" + + else: # Scalar encoders if encoderDict["type"] in ["ScalarSpaceEncoder", "AdaptiveScalarEncoder", @@ -684,16 +684,16 @@ def _generatePermEncoderStr(options, encoderDict): key = "encoderClass" elif key == "name": continue - + if key == "n": - permStr += "n=PermuteInt(%d, %d), " % (encoderDict["w"] + 1, + permStr += "n=PermuteInt(%d, %d), " % (encoderDict["w"] + 1, encoderDict["w"] + 500) elif key == "runDelta": if value and not "space" in encoderDict: permStr += "space=PermuteChoices([%s,%s]), " \ % (_quoteAndEscape("delta"), _quoteAndEscape("absolute")) encoderDict.pop("runDelta") - + else: if issubclass(type(value), basestring): permStr += "%s='%s', " % (key, value) @@ -701,7 +701,7 @@ def _generatePermEncoderStr(options, encoderDict): permStr += "%s=%s, " % (key, value) permStr += ")" - # Category encoder + # Category encoder elif encoderDict["type"] in ["SDRCategoryEncoder"]: permStr = "PermuteEncoder(" for key, value in encoderDict.items(): @@ -711,13 +711,13 @@ def _generatePermEncoderStr(options, encoderDict): key = "encoderClass" elif key == "name": continue - + if issubclass(type(value), basestring): permStr += "%s='%s', " % (key, value) else: permStr += "%s=%s, " % (key, value) permStr += ")" - + # Datetime encoder elif encoderDict["type"] in ["DateEncoder"]: @@ -729,7 +729,7 @@ def _generatePermEncoderStr(options, encoderDict): continue elif key == "name": continue - + if key == "timeOfDay": permStr += "encoderClass='%s.timeOfDay', " % (encoderDict["type"]) permStr += "radius=PermuteFloat(0.5, 12), " @@ -752,7 +752,7 @@ def _generatePermEncoderStr(options, encoderDict): else: raise RuntimeError("Unsupported encoder type '%s'" % \ (encoderDict["type"])) - + return permStr @@ -810,18 +810,18 @@ def _generateEncoderStringsV2(includedFields, options): width = 21 encoderDictsList = [] - + # If this is a NontemporalClassification experiment, then the - # the "predicted" field (the classification value) should be marked to ONLY + # the "predicted" field (the classification value) should be marked to ONLY # go to the classifier if options['inferenceType'] in ["NontemporalClassification", - "NontemporalMultiStep", + "NontemporalMultiStep", "TemporalMultiStep", "MultiStep"]: classifierOnlyField = options['inferenceArgs']['predictedField'] else: classifierOnlyField = None - + # ========================================================================== # For each field, generate the default encoding dict and PermuteEncoder @@ -837,7 +837,7 @@ def _generateEncoderStringsV2(includedFields, options): # n=100 is reasonably hardcoded value for n when used by description.py # The swarming will use PermuteEncoder below, where n is variable and # depends on w - runDelta = fieldInfo.get("runDelta", False) + runDelta = fieldInfo.get("runDelta", False) if runDelta or "space" in fieldInfo: encoderDict = dict(type='ScalarSpaceEncoder', name=fieldName, fieldname=fieldName, n=100, w=width, clipInput=True) @@ -851,12 +851,12 @@ def _generateEncoderStringsV2(includedFields, options): encoderDict['minval'] = fieldInfo['minValue'] if 'maxValue' in fieldInfo: encoderDict['maxval'] = fieldInfo['maxValue'] - + # If both min and max were specified, use a non-adaptive encoder if ('minValue' in fieldInfo and 'maxValue' in fieldInfo) \ and (encoderDict['type'] == 'AdaptiveScalarEncoder'): encoderDict['type'] = 'ScalarEncoder' - + # Defaults may have been over-ridden by specifying an encoder type if 'encoderType' in fieldInfo: encoderDict['type'] = fieldInfo['encoderType'] @@ -921,7 +921,7 @@ def _generateEncoderStringsV2(includedFields, options): clEncoderDict['classifierOnly'] = True clEncoderDict['name'] = '_classifierInput' encoderDictsList.append(clEncoderDict) - + # If the predicted field needs to be excluded, take it out of the encoder # lists if options["inferenceArgs"]["inputPredictedField"] == "no": @@ -936,13 +936,13 @@ def _generateEncoderStringsV2(includedFields, options): encoderDictsList = tempList # ========================================================================== - # Now generate the encoderSpecsStr and permEncoderChoicesStr strings from + # Now generate the encoderSpecsStr and permEncoderChoicesStr strings from # encoderDictsList and constructorStringList encoderSpecsList = [] permEncoderChoicesList = [] for encoderDict in encoderDictsList: - + if encoderDict['name'].find('\\') >= 0: raise _ExpGeneratorException("Illegal character in field: '\\'") @@ -958,7 +958,7 @@ def _generateEncoderStringsV2(includedFields, options): encoderKey, 2*_ONE_INDENT, pprint.pformat(encoderDict, indent=2*_INDENT_STEP))) - + # Each permEncoderChoicesStr is of the form: # PermuteEncoder('gym', 'SDRCategoryEncoder', @@ -1095,7 +1095,7 @@ def _generateExperiment(options, outputDirPath, hsVersion, for propertyName in _gExperimentDescriptionSchema['properties']: _getPropertyValue(_gExperimentDescriptionSchema, propertyName, options) - + if options['inferenceArgs'] is not None: infArgs = _gExperimentDescriptionSchema['properties']['inferenceArgs'] for schema in infArgs['type']: @@ -1110,7 +1110,7 @@ def _generateExperiment(options, outputDirPath, hsVersion, for propertyName in schema['properties']: _getPropertyValue(schema, propertyName, options['anomalyParams']) - + # If the user specified nonTemporalClassification, make sure prediction # steps is 0 predictionSteps = options['inferenceArgs'].get('predictionSteps', None) @@ -1118,17 +1118,17 @@ def _generateExperiment(options, outputDirPath, hsVersion, if predictionSteps is not None and predictionSteps != [0]: raise RuntimeError("When NontemporalClassification is used, prediction" " steps must be [0]") - + # ------------------------------------------------------------------------- # If the user asked for 0 steps of prediction, then make this a spatial # classification experiment if predictionSteps == [0] \ - and options['inferenceType'] in ['NontemporalMultiStep', + and options['inferenceType'] in ['NontemporalMultiStep', 'TemporalMultiStep', 'MultiStep']: options['inferenceType'] = InferenceType.NontemporalClassification - - + + # If NontemporalClassification was chosen as the inferenceType, then the # predicted field can NOT be used as an input if options["inferenceType"] == InferenceType.NontemporalClassification: @@ -1137,12 +1137,12 @@ def _generateExperiment(options, outputDirPath, hsVersion, raise RuntimeError("When the inference type is NontemporalClassification" " inputPredictedField must be set to 'no'") options["inferenceArgs"]["inputPredictedField"] = "no" - - + + # ----------------------------------------------------------------------- # Process the swarmSize setting, if provided swarmSize = options['swarmSize'] - + if swarmSize is None: if options["inferenceArgs"]["inputPredictedField"] is None: options["inferenceArgs"]["inputPredictedField"] = "auto" @@ -1166,7 +1166,7 @@ def _generateExperiment(options, outputDirPath, hsVersion, options['maxModels'] = 200 if options["inferenceArgs"]["inputPredictedField"] is None: options["inferenceArgs"]["inputPredictedField"] = "auto" - + elif swarmSize == 'large': if options['minParticlesPerSwarm'] is None: options['minParticlesPerSwarm'] = 15 @@ -1177,12 +1177,12 @@ def _generateExperiment(options, outputDirPath, hsVersion, options['tryAll3FieldCombinationsWTimestamps'] = True if options["inferenceArgs"]["inputPredictedField"] is None: options["inferenceArgs"]["inputPredictedField"] = "auto" - + else: raise RuntimeError("Unsupported swarm size: %s" % (swarmSize)) - - + + # ----------------------------------------------------------------------- # Get token replacements tokenReplacements = dict() @@ -1321,7 +1321,7 @@ def _generateExperiment(options, outputDirPath, hsVersion, if inferenceType == 'MultiStep': inferenceType = InferenceType.TemporalMultiStep tokenReplacements['\$INFERENCE_TYPE'] = "'%s'" % inferenceType - + # Nontemporal classificaion uses only encoder and classifier if inferenceType == InferenceType.NontemporalClassification: tokenReplacements['\$SP_ENABLE'] = "False" @@ -1330,7 +1330,7 @@ def _generateExperiment(options, outputDirPath, hsVersion, tokenReplacements['\$SP_ENABLE'] = "True" tokenReplacements['\$TP_ENABLE'] = "True" tokenReplacements['\$CLA_CLASSIFIER_IMPL'] = "" - + tokenReplacements['\$ANOMALY_PARAMS'] = pprint.pformat( options['anomalyParams'], indent=2*_INDENT_STEP) @@ -1371,7 +1371,7 @@ def _generateExperiment(options, outputDirPath, hsVersion, # Option permuting over SP synapse decrement value tokenReplacements['\$PERM_SP_CHOICES'] = "" if options['spPermuteDecrement'] \ - and options['inferenceType'] != 'NontemporalClassification': + and options['inferenceType'] != 'NontemporalClassification': tokenReplacements['\$PERM_SP_CHOICES'] = \ _ONE_INDENT +"'synPermInactiveDec': PermuteFloat(0.0003, 0.1),\n" @@ -1399,7 +1399,7 @@ def _generateExperiment(options, outputDirPath, hsVersion, # The Classifier permutation parameters are only required for # Multi-step inference types if options['inferenceType'] in ['NontemporalMultiStep', 'TemporalMultiStep', - 'MultiStep', 'TemporalAnomaly', + 'MultiStep', 'TemporalAnomaly', 'NontemporalClassification']: tokenReplacements['\$PERM_CL_CHOICES'] = \ " 'alpha': PermuteFloat(0.0001, 0.1),\n" @@ -1408,44 +1408,44 @@ def _generateExperiment(options, outputDirPath, hsVersion, tokenReplacements['\$PERM_CL_CHOICES'] = "" - # The Permutations alwaysIncludePredictedField setting. - # * When the experiment description has 'inputPredictedField' set to 'no', we - # simply do not put in an encoder for the predicted field. - # * When 'inputPredictedField' is set to 'auto', we include an encoder for the + # The Permutations alwaysIncludePredictedField setting. + # * When the experiment description has 'inputPredictedField' set to 'no', we + # simply do not put in an encoder for the predicted field. + # * When 'inputPredictedField' is set to 'auto', we include an encoder for the # predicted field and swarming tries it out just like all the other fields. # * When 'inputPredictedField' is set to 'yes', we include this setting in # the permutations file which informs swarming to always use the - # predicted field (the first swarm will be the predicted field only) + # predicted field (the first swarm will be the predicted field only) tokenReplacements['\$PERM_ALWAYS_INCLUDE_PREDICTED_FIELD'] = \ "inputPredictedField = '%s'" % \ - (options["inferenceArgs"]["inputPredictedField"]) + (options["inferenceArgs"]["inputPredictedField"]) + - # The Permutations minFieldContribution setting if options.get('minFieldContribution', None) is not None: tokenReplacements['\$PERM_MIN_FIELD_CONTRIBUTION'] = \ - "minFieldContribution = %d" % (options['minFieldContribution']) + "minFieldContribution = %d" % (options['minFieldContribution']) else: tokenReplacements['\$PERM_MIN_FIELD_CONTRIBUTION'] = "" - + # The Permutations killUselessSwarms setting if options.get('killUselessSwarms', None) is not None: tokenReplacements['\$PERM_KILL_USELESS_SWARMS'] = \ - "killUselessSwarms = %r" % (options['killUselessSwarms']) + "killUselessSwarms = %r" % (options['killUselessSwarms']) else: tokenReplacements['\$PERM_KILL_USELESS_SWARMS'] = "" # The Permutations maxFieldBranching setting if options.get('maxFieldBranching', None) is not None: tokenReplacements['\$PERM_MAX_FIELD_BRANCHING'] = \ - "maxFieldBranching = %r" % (options['maxFieldBranching']) + "maxFieldBranching = %r" % (options['maxFieldBranching']) else: tokenReplacements['\$PERM_MAX_FIELD_BRANCHING'] = "" # The Permutations tryAll3FieldCombinations setting if options.get('tryAll3FieldCombinations', None) is not None: tokenReplacements['\$PERM_TRY_ALL_3_FIELD_COMBINATIONS'] = \ - "tryAll3FieldCombinations = %r" % (options['tryAll3FieldCombinations']) + "tryAll3FieldCombinations = %r" % (options['tryAll3FieldCombinations']) else: tokenReplacements['\$PERM_TRY_ALL_3_FIELD_COMBINATIONS'] = "" @@ -1453,7 +1453,7 @@ def _generateExperiment(options, outputDirPath, hsVersion, if options.get('tryAll3FieldCombinationsWTimestamps', None) is not None: tokenReplacements['\$PERM_TRY_ALL_3_FIELD_COMBINATIONS_W_TIMESTAMPS'] = \ "tryAll3FieldCombinationsWTimestamps = %r" % \ - (options['tryAll3FieldCombinationsWTimestamps']) + (options['tryAll3FieldCombinationsWTimestamps']) else: tokenReplacements['\$PERM_TRY_ALL_3_FIELD_COMBINATIONS_W_TIMESTAMPS'] = "" @@ -1461,14 +1461,14 @@ def _generateExperiment(options, outputDirPath, hsVersion, # The Permutations fieldFields setting if options.get('fixedFields', None) is not None: tokenReplacements['\$PERM_FIXED_FIELDS'] = \ - "fixedFields = %r" % (options['fixedFields']) + "fixedFields = %r" % (options['fixedFields']) else: tokenReplacements['\$PERM_FIXED_FIELDS'] = "" # The Permutations fastSwarmModelParams setting if options.get('fastSwarmModelParams', None) is not None: tokenReplacements['\$PERM_FAST_SWARM_MODEL_PARAMS'] = \ - "fastSwarmModelParams = %r" % (options['fastSwarmModelParams']) + "fastSwarmModelParams = %r" % (options['fastSwarmModelParams']) else: tokenReplacements['\$PERM_FAST_SWARM_MODEL_PARAMS'] = "" @@ -1476,7 +1476,7 @@ def _generateExperiment(options, outputDirPath, hsVersion, # The Permutations maxModels setting if options.get('maxModels', None) is not None: tokenReplacements['\$PERM_MAX_MODELS'] = \ - "maxModels = %r" % (options['maxModels']) + "maxModels = %r" % (options['maxModels']) else: tokenReplacements['\$PERM_MAX_MODELS'] = "" @@ -1785,7 +1785,7 @@ def _generateMetricSpecs(options): "steps": steps}) ) - + # ----------------------------------------------------------------------- @@ -1839,7 +1839,7 @@ def _generateMetricSpecs(options): metric="custom", params=options["customErrorMetric"]) optimizeMetricLabel = ".*custom_error_metric.*" - + metricSpecStrings.append(optimizeMetricSpec) diff --git a/src/nupic/swarming/exp_generator/permutationsTemplateEnsemble.tpl b/src/nupic/swarming/exp_generator/permutationsTemplateEnsemble.tpl index 35f58a49ee..1452feea78 100644 --- a/src/nupic/swarming/exp_generator/permutationsTemplateEnsemble.tpl +++ b/src/nupic/swarming/exp_generator/permutationsTemplateEnsemble.tpl @@ -28,7 +28,7 @@ $EXP_GENERATOR_PROGRAM_PATH """ import os -from nupic.swarming.permutationhelpers import * +from nupic.swarming.permutation_helpers import * # The name of the field being predicted. Any allowed permutation MUST contain # the prediction field. diff --git a/src/nupic/swarming/exp_generator/permutationsTemplateV2.tpl b/src/nupic/swarming/exp_generator/permutationsTemplateV2.tpl index c375bcad6b..9c44fb3b24 100644 --- a/src/nupic/swarming/exp_generator/permutationsTemplateV2.tpl +++ b/src/nupic/swarming/exp_generator/permutationsTemplateV2.tpl @@ -29,7 +29,7 @@ $EXP_GENERATOR_PROGRAM_PATH import os -from nupic.swarming.permutationhelpers import * +from nupic.swarming.permutation_helpers import * # The name of the field being predicted. Any allowed permutation MUST contain # the prediction field. diff --git a/src/nupic/swarming/experimentutils.py b/src/nupic/swarming/experiment_utils.py similarity index 100% rename from src/nupic/swarming/experimentutils.py rename to src/nupic/swarming/experiment_utils.py diff --git a/src/nupic/swarming/hypersearch/errorcodes.py b/src/nupic/swarming/hypersearch/error_codes.py similarity index 100% rename from src/nupic/swarming/hypersearch/errorcodes.py rename to src/nupic/swarming/hypersearch/error_codes.py diff --git a/src/nupic/swarming/hypersearch/ExtendedLogger.py b/src/nupic/swarming/hypersearch/extended_logger.py similarity index 100% rename from src/nupic/swarming/hypersearch/ExtendedLogger.py rename to src/nupic/swarming/hypersearch/extended_logger.py diff --git a/src/nupic/swarming/hypersearch/HsState.py b/src/nupic/swarming/hypersearch/hs_state.py similarity index 100% rename from src/nupic/swarming/hypersearch/HsState.py rename to src/nupic/swarming/hypersearch/hs_state.py diff --git a/src/nupic/swarming/hypersearch/ModelTerminator.py b/src/nupic/swarming/hypersearch/model_terminator.py similarity index 100% rename from src/nupic/swarming/hypersearch/ModelTerminator.py rename to src/nupic/swarming/hypersearch/model_terminator.py diff --git a/src/nupic/swarming/hypersearch/Particle.py b/src/nupic/swarming/hypersearch/particle.py similarity index 100% rename from src/nupic/swarming/hypersearch/Particle.py rename to src/nupic/swarming/hypersearch/particle.py diff --git a/src/nupic/swarming/hypersearch/SwarmTerminator.py b/src/nupic/swarming/hypersearch/swarm_terminator.py similarity index 100% rename from src/nupic/swarming/hypersearch/SwarmTerminator.py rename to src/nupic/swarming/hypersearch/swarm_terminator.py diff --git a/src/nupic/swarming/HypersearchV2.py b/src/nupic/swarming/hypersearch_v2.py similarity index 99% rename from src/nupic/swarming/HypersearchV2.py rename to src/nupic/swarming/hypersearch_v2.py index 03622d0b6a..d1ceb44044 100644 --- a/src/nupic/swarming/HypersearchV2.py +++ b/src/nupic/swarming/hypersearch_v2.py @@ -33,19 +33,19 @@ import pprint from nupic.swarming.hypersearch.permutation_helpers import * -from nupic.swarming.hypersearch.Particle import Particle -from nupic.swarming.hypersearch.errorcodes import ErrorCodes -from nupic.swarming.hypersearch.SwarmTerminator import SwarmTerminator -from nupic.swarming.hypersearch.HsState import HsState, HsSearchType +from nupic.swarming.hypersearch.particle import Particle +from nupic.swarming.hypersearch.error_codes import ErrorCodes +from nupic.swarming.hypersearch.swarm_terminator import SwarmTerminator +from nupic.swarming.hypersearch.hs_state import HsState, HsSearchType from nupic.frameworks.opf import helpers -from nupic.swarming.experimentutils import InferenceType +from nupic.swarming.experiment_utils import InferenceType from nupic.swarming.utils import sortedJSONDumpS, rApply, rCopy from nupic.swarming.utils import clippedObj from nupic.swarming.utils import (runModelGivenBaseAndParams, runDummyModel) from nupic.database.client_jobs_dao import ( ClientJobsDAO, InvalidConnectionException) -from nupic.swarming.exp_generator.ExpGenerator import expGenerator +from nupic.swarming.exp_generator.experiment_generator import expGenerator def _flattenKeys(keys): diff --git a/src/nupic/swarming/HypersearchWorker.py b/src/nupic/swarming/hypersearch_worker.py similarity index 99% rename from src/nupic/swarming/HypersearchWorker.py rename to src/nupic/swarming/hypersearch_worker.py index b01747d847..bcb139fda3 100755 --- a/src/nupic/swarming/HypersearchWorker.py +++ b/src/nupic/swarming/hypersearch_worker.py @@ -33,11 +33,11 @@ from nupic.support import initLogging from nupic.support.configuration import Configuration -from nupic.swarming.hypersearch.ExtendedLogger import ExtendedLogger -from nupic.swarming.hypersearch.errorcodes import ErrorCodes +from nupic.swarming.hypersearch.extended_logger import ExtendedLogger +from nupic.swarming.hypersearch.error_codes import ErrorCodes from nupic.swarming.utils import clippedObj, validate from nupic.database.client_jobs_dao import ClientJobsDAO -from HypersearchV2 import HypersearchV2 +from hypersearch_v2 import HypersearchV2 diff --git a/src/nupic/swarming/modelchooser.py b/src/nupic/swarming/model_chooser.py similarity index 100% rename from src/nupic/swarming/modelchooser.py rename to src/nupic/swarming/model_chooser.py diff --git a/src/nupic/swarming/permutationhelpers.py b/src/nupic/swarming/permutation_helpers.py similarity index 100% rename from src/nupic/swarming/permutationhelpers.py rename to src/nupic/swarming/permutation_helpers.py diff --git a/src/nupic/swarming/permutations_runner.py b/src/nupic/swarming/permutations_runner.py index 2f026c8380..02fc9a2371 100644 --- a/src/nupic/swarming/permutations_runner.py +++ b/src/nupic/swarming/permutations_runner.py @@ -33,9 +33,9 @@ from nupic.swarming.hypersearch import object_json as json import nupic.database.client_jobs_dao as cjdao -from nupic.swarming import HypersearchWorker -from nupic.swarming.HypersearchV2 import HypersearchV2 -from nupic.swarming.exp_generator.ExpGenerator import expGenerator +from nupic.swarming import hypersearch_worker +from nupic.swarming.hypersearch_v2 import HypersearchV2 +from nupic.swarming.exp_generator.experiment_generator import expGenerator from nupic.swarming.utils import * @@ -653,7 +653,7 @@ def __startSearch(self): print "==================================================================" print "RUNNING PERMUTATIONS INLINE as \"DRY RUN\"..." print "==================================================================" - jobID = HypersearchWorker.main(args) + jobID = hypersearch_worker.main(args) else: cmdLine = _setUpExports(self._options["exports"]) @@ -670,7 +670,7 @@ def __startSearch(self): maximumWorkers=maxWorkers, jobType=self.__cjDAO.JOB_TYPE_HS) - cmdLine = "python -m nupic.swarming.HypersearchWorker" \ + cmdLine = "python -m nupic.swarming.hypersearch_worker" \ " --jobID=%d" % (jobID) self._launchWorkers(cmdLine, maxWorkers) diff --git a/src/nupic/swarming/utils.py b/src/nupic/swarming/utils.py index da0e7e506d..e9aa03521e 100644 --- a/src/nupic/swarming/utils.py +++ b/src/nupic/swarming/utils.py @@ -453,7 +453,7 @@ def runModelGivenBaseAndParams(modelID, jobID, baseDescription, params, def runDummyModel(modelID, jobID, params, predictedField, reportKeys, optimizeKey, jobsDAO, modelCheckpointGUID, logLevel=None, predictionCacheMaxRecords=None): - from nupic.swarming.DummyModelRunner import OPFDummyModelRunner + from nupic.swarming.dummy_model_runner import OPFDummyModelRunner # The logger for this method logger = logging.getLogger('com.numenta.nupic.hypersearch.utils') diff --git a/tests/integration/nupic/opf/expgenerator_test.py b/tests/integration/nupic/opf/expgenerator_test.py index 912a763a8a..1f4066d7f7 100755 --- a/tests/integration/nupic/opf/expgenerator_test.py +++ b/tests/integration/nupic/opf/expgenerator_test.py @@ -38,11 +38,11 @@ from nupic.support import aggregationDivide from nupic.support.unittesthelpers.testcasebase import ( TestCaseBase as HelperTestCaseBase) -from nupic.swarming import HypersearchWorker -from nupic.swarming.permutationhelpers import PermuteChoices +from nupic.swarming import hypersearch_worker +from nupic.swarming.permutation_helpers import PermuteChoices from nupic.swarming.utils import generatePersistentJobGUID, rCopy from nupic.frameworks.opf.exp_description_api import OpfEnvironment -from nupic.swarming.exp_generator import ExpGenerator +from nupic.swarming.exp_generator import experiment_generator from nupic.frameworks.opf.opf_utils import (InferenceType, InferenceElement) @@ -181,7 +181,7 @@ def getModules(self, expDesc, hsVersion='v2'): "--version=%s" % (hsVersion) ] self.addExtraLogItem({'args':args}) - ExpGenerator.expGenerator(args) + experiment_generator.expGenerator(args) #---------------------------------------- @@ -250,7 +250,7 @@ def runBaseDescriptionAndPermutations(self, expDesc, hsVersion, maxModels=2): LOGGER.info("RUNNING PERMUTATIONS") LOGGER.info("============================================================") - jobID = HypersearchWorker.main(args) + jobID = hypersearch_worker.main(args) # Make sure all models completed successfully cjDAO = ClientJobsDAO.get() @@ -399,7 +399,7 @@ def test_ShowSchema(self): #---------------------------------------- # Run it - ExpGenerator.expGenerator(args) + experiment_generator.expGenerator(args) return @@ -449,10 +449,10 @@ def test_PredictionElement(self): # Make sure we have the right optimization designation self.assertEqual(perms.minimize, - ("multiStepBestPredictions:multiStep:errorMetric='altMAPE':" + ("multiStepBestPredictions:multiStep:errorMetric='altMAPE':" "steps=\\[1\\]:window=%d:field=consumption") - % ExpGenerator.METRIC_WINDOW, - msg="got: %s" % perms.minimize) + % experiment_generator.METRIC_WINDOW, + msg="got: %s" % perms.minimize) # Should not have any classifier info to permute over self.assertNotIn('clAlpha', perms.permutations) @@ -498,7 +498,7 @@ def assertMetric(self, base, perm, predictedField, optimizeString = ("multiStepBestPredictions:multiStep:" "errorMetric='%s':steps=\[1\]" ":window=%d:field=%s" % \ - (optimizeMetric, ExpGenerator.METRIC_WINDOW, + (optimizeMetric, experiment_generator.METRIC_WINDOW, predictedField)) print "perm.minimize=",perm.minimize print "optimizeString=",optimizeString diff --git a/tests/regression/run_opf_benchmarks_test.py b/tests/regression/run_opf_benchmarks_test.py index 8f57ac2d2a..6b3cd1b442 100755 --- a/tests/regression/run_opf_benchmarks_test.py +++ b/tests/regression/run_opf_benchmarks_test.py @@ -40,7 +40,7 @@ from collections import deque from nupic.database import client_jobs_dao as cjdao -from nupic.swarming.exp_generator import ExpGenerator +from nupic.swarming.exp_generator import experiment_generator from nupic.frameworks.opf.opf_utils import InferenceType from nupic.support.configuration import Configuration from nupic.support.unittesthelpers.testcasebase import unittest @@ -1084,21 +1084,21 @@ def generateModules(self, expDesc, outdir): if self.__doV2Term: # TODO BUG: args passed to expGenerator is not defined yet - ExpGenerator.expGenerator(args) + experiment_generator.expGenerator(args) args = [ "--description=%s" % (json.dumps(expDesc)), "--version=v2", "--outDir=%s" % (outdirv2noterm) ] if self.__doV2noTerm: - ExpGenerator.expGenerator(args) + experiment_generator.expGenerator(args) args = [ "--description=%s" % (json.dumps(expDesc)), "--version=v2", "--outDir=%s" % (outdirdef) ] if self.__doClusterDef: - ExpGenerator.expGenerator(args) + experiment_generator.expGenerator(args) def runV2noTerm(self, basedir, expname, searchtype, exportdict): diff --git a/tests/swarming/nupic/swarming/experiments/delta/description.py b/tests/swarming/nupic/swarming/experiments/delta/description.py index a48029d308..6883500eba 100644 --- a/tests/swarming/nupic/swarming/experiments/delta/description.py +++ b/tests/swarming/nupic/swarming/experiments/delta/description.py @@ -24,7 +24,7 @@ description.py file by replacing $XXXXXXXX tokens with desired values. This description.py file was generated by: -'/Users/ronmarianetti/nupic/eng/lib/python2.6/site-packages/nupic/frameworks/opf/expGenerator/ExpGenerator.py' +'/Users/ronmarianetti/nupic/eng/lib/python2.6/site-packages/nupic/frameworks/opf/expGenerator/experiment_generator.py' """ from nupic.frameworks.opf.exp_description_api import ExperimentDescriptionAPI diff --git a/tests/swarming/nupic/swarming/experiments/delta/permutations.py b/tests/swarming/nupic/swarming/experiments/delta/permutations.py index c3bc95ba5a..094a7cfed6 100644 --- a/tests/swarming/nupic/swarming/experiments/delta/permutations.py +++ b/tests/swarming/nupic/swarming/experiments/delta/permutations.py @@ -24,12 +24,12 @@ permutations.py file by replacing $XXXXXXXX tokens with desired values. This permutations.py file was generated by: -'/Users/ronmarianetti/nupic/eng/lib/python2.6/site-packages/nupic/frameworks/opf/expGenerator/ExpGenerator.py' +'/Users/ronmarianetti/nupic/eng/lib/python2.6/site-packages/nupic/frameworks/opf/expGenerator/experiment_generator.py' """ import os -from nupic.swarming.permutationhelpers import * +from nupic.swarming.permutation_helpers import * # The name of the field being predicted. Any allowed permutation MUST contain # the prediction field. diff --git a/tests/swarming/nupic/swarming/experiments/dummyV2/description.py b/tests/swarming/nupic/swarming/experiments/dummyV2/description.py index 1417aa9602..0edfadb502 100644 --- a/tests/swarming/nupic/swarming/experiments/dummyV2/description.py +++ b/tests/swarming/nupic/swarming/experiments/dummyV2/description.py @@ -24,7 +24,7 @@ description.py file by replacing $XXXXXXXX tokens with desired values. This description.py file was generated by: -'/Users/ronmarianetti/nupic/eng/lib/python2.6/site-packages/nupic/frameworks/opf/expGenerator/ExpGenerator.py' +'/Users/ronmarianetti/nupic/eng/lib/python2.6/site-packages/nupic/frameworks/opf/expGenerator/experiment_generator.py' """ from nupic.frameworks.opf.exp_description_api import ExperimentDescriptionAPI diff --git a/tests/swarming/nupic/swarming/experiments/dummyV2/permutations.py b/tests/swarming/nupic/swarming/experiments/dummyV2/permutations.py index 31e1337326..64e01bffe9 100644 --- a/tests/swarming/nupic/swarming/experiments/dummyV2/permutations.py +++ b/tests/swarming/nupic/swarming/experiments/dummyV2/permutations.py @@ -24,12 +24,12 @@ permutations.py file by replacing $XXXXXXXX tokens with desired values. This permutations.py file was generated by: -'/Users/ronmarianetti/nupic/eng/lib/python2.6/site-packages/nupic/frameworks/opf/expGenerator/ExpGenerator.py' +'/Users/ronmarianetti/nupic/eng/lib/python2.6/site-packages/nupic/frameworks/opf/expGenerator/experiment_generator.py' """ import os -from nupic.swarming.permutationhelpers import * +from nupic.swarming.permutation_helpers import * # The name of the field being predicted. Any allowed permutation MUST contain # the prediction field. diff --git a/tests/swarming/nupic/swarming/experiments/dummy_multi_v2/description.py b/tests/swarming/nupic/swarming/experiments/dummy_multi_v2/description.py index f795440991..78408099a8 100644 --- a/tests/swarming/nupic/swarming/experiments/dummy_multi_v2/description.py +++ b/tests/swarming/nupic/swarming/experiments/dummy_multi_v2/description.py @@ -24,7 +24,7 @@ description.py file by replacing $XXXXXXXX tokens with desired values. This description.py file was generated by: -'/Users/ronmarianetti/nupic/eng/lib/python2.6/site-packages/nupic/frameworks/opf/expGenerator/ExpGenerator.py' +'/Users/ronmarianetti/nupic/eng/lib/python2.6/site-packages/nupic/frameworks/opf/expGenerator/experiment_generator.py' """ from nupic.frameworks.opf.exp_description_api import ExperimentDescriptionAPI diff --git a/tests/swarming/nupic/swarming/experiments/dummy_multi_v2/permutations.py b/tests/swarming/nupic/swarming/experiments/dummy_multi_v2/permutations.py index 3cbb611126..e0f6a6949c 100644 --- a/tests/swarming/nupic/swarming/experiments/dummy_multi_v2/permutations.py +++ b/tests/swarming/nupic/swarming/experiments/dummy_multi_v2/permutations.py @@ -24,12 +24,12 @@ permutations.py file by replacing $XXXXXXXX tokens with desired values. This permutations.py file was generated by: -'/Users/ronmarianetti/nupic/eng/lib/python2.6/site-packages/nupic/frameworks/opf/expGenerator/ExpGenerator.py' +'/Users/ronmarianetti/nupic/eng/lib/python2.6/site-packages/nupic/frameworks/opf/expGenerator/experiment_generator.py' """ import os -from nupic.swarming.permutationhelpers import * +from nupic.swarming.permutation_helpers import * # The name of the field being predicted. Any allowed permutation MUST contain # the prediction field. diff --git a/tests/swarming/nupic/swarming/experiments/field_contrib_temporal/description.py b/tests/swarming/nupic/swarming/experiments/field_contrib_temporal/description.py index 825f4465c4..8ecfc4a2df 100644 --- a/tests/swarming/nupic/swarming/experiments/field_contrib_temporal/description.py +++ b/tests/swarming/nupic/swarming/experiments/field_contrib_temporal/description.py @@ -24,7 +24,7 @@ description.py file by replacing $XXXXXXXX tokens with desired values. This description.py file was generated by: -'/Users/ronmarianetti/nupic/eng/lib/python2.6/site-packages/nupic/frameworks/opf/expGenerator/ExpGenerator.py' +'/Users/ronmarianetti/nupic/eng/lib/python2.6/site-packages/nupic/frameworks/opf/expGenerator/experiment_generator.py' """ from nupic.frameworks.opf.exp_description_api import ExperimentDescriptionAPI diff --git a/tests/swarming/nupic/swarming/experiments/field_contrib_temporal/permutations.py b/tests/swarming/nupic/swarming/experiments/field_contrib_temporal/permutations.py index f0fc4b7769..7a89614674 100644 --- a/tests/swarming/nupic/swarming/experiments/field_contrib_temporal/permutations.py +++ b/tests/swarming/nupic/swarming/experiments/field_contrib_temporal/permutations.py @@ -24,12 +24,12 @@ permutations.py file by replacing $XXXXXXXX tokens with desired values. This permutations.py file was generated by: -'/Users/ronmarianetti/nupic/eng/lib/python2.6/site-packages/nupic/frameworks/opf/expGenerator/ExpGenerator.py' +'/Users/ronmarianetti/nupic/eng/lib/python2.6/site-packages/nupic/frameworks/opf/expGenerator/experiment_generator.py' """ import os -from nupic.swarming.permutationhelpers import * +from nupic.swarming.permutation_helpers import * # The name of the field being predicted. Any allowed permutation MUST contain # the prediction field. diff --git a/tests/swarming/nupic/swarming/experiments/field_threshold_temporal/description.py b/tests/swarming/nupic/swarming/experiments/field_threshold_temporal/description.py index fb0281c125..7c6698d961 100644 --- a/tests/swarming/nupic/swarming/experiments/field_threshold_temporal/description.py +++ b/tests/swarming/nupic/swarming/experiments/field_threshold_temporal/description.py @@ -24,7 +24,7 @@ description.py file by replacing $XXXXXXXX tokens with desired values. This description.py file was generated by: -'/Users/ronmarianetti/nupic/eng/lib/python2.6/site-packages/nupic/frameworks/opf/expGenerator/ExpGenerator.py' +'/Users/ronmarianetti/nupic/eng/lib/python2.6/site-packages/nupic/frameworks/opf/expGenerator/experiment_generator.py' """ from nupic.frameworks.opf.exp_description_api import ExperimentDescriptionAPI diff --git a/tests/swarming/nupic/swarming/experiments/field_threshold_temporal/permutations.py b/tests/swarming/nupic/swarming/experiments/field_threshold_temporal/permutations.py index a5779c5f8b..95113b14f0 100644 --- a/tests/swarming/nupic/swarming/experiments/field_threshold_temporal/permutations.py +++ b/tests/swarming/nupic/swarming/experiments/field_threshold_temporal/permutations.py @@ -24,12 +24,12 @@ permutations.py file by replacing $XXXXXXXX tokens with desired values. This permutations.py file was generated by: -'/Users/ronmarianetti/nupic/eng/lib/python2.6/site-packages/nupic/frameworks/opf/expGenerator/ExpGenerator.py' +'/Users/ronmarianetti/nupic/eng/lib/python2.6/site-packages/nupic/frameworks/opf/expGenerator/experiment_generator.py' """ import os -from nupic.swarming.permutationhelpers import * +from nupic.swarming.permutation_helpers import * # The name of the field being predicted. Any allowed permutation MUST contain # the prediction field. diff --git a/tests/swarming/nupic/swarming/experiments/input_predicted_field/permutations.py b/tests/swarming/nupic/swarming/experiments/input_predicted_field/permutations.py index 18ccbac36c..aa96460b71 100644 --- a/tests/swarming/nupic/swarming/experiments/input_predicted_field/permutations.py +++ b/tests/swarming/nupic/swarming/experiments/input_predicted_field/permutations.py @@ -29,7 +29,7 @@ import os -from nupic.swarming.permutationhelpers import * +from nupic.swarming.permutation_helpers import * # The name of the field being predicted. Any allowed permutation MUST contain # the prediction field. diff --git a/tests/swarming/nupic/swarming/experiments/legacy_cla_multistep/permutations.py b/tests/swarming/nupic/swarming/experiments/legacy_cla_multistep/permutations.py index b176ba3090..0bb27e9d9e 100644 --- a/tests/swarming/nupic/swarming/experiments/legacy_cla_multistep/permutations.py +++ b/tests/swarming/nupic/swarming/experiments/legacy_cla_multistep/permutations.py @@ -29,7 +29,7 @@ import os -from nupic.swarming.permutationhelpers import * +from nupic.swarming.permutation_helpers import * # The name of the field being predicted. Any allowed permutation MUST contain # the prediction field. diff --git a/tests/swarming/nupic/swarming/experiments/max_branching_temporal/description.py b/tests/swarming/nupic/swarming/experiments/max_branching_temporal/description.py index 46b1e53b5d..b7f6d38e91 100644 --- a/tests/swarming/nupic/swarming/experiments/max_branching_temporal/description.py +++ b/tests/swarming/nupic/swarming/experiments/max_branching_temporal/description.py @@ -24,7 +24,7 @@ description.py file by replacing $XXXXXXXX tokens with desired values. This description.py file was generated by: -'/Users/ronmarianetti/nupic/eng/lib/python2.6/site-packages/nupic/frameworks/opf/expGenerator/ExpGenerator.py' +'/Users/ronmarianetti/nupic/eng/lib/python2.6/site-packages/nupic/frameworks/opf/expGenerator/experiment_generator.py' """ from nupic.frameworks.opf.exp_description_api import ExperimentDescriptionAPI diff --git a/tests/swarming/nupic/swarming/experiments/max_branching_temporal/permutations.py b/tests/swarming/nupic/swarming/experiments/max_branching_temporal/permutations.py index 68574c59a9..7ab0a560f7 100644 --- a/tests/swarming/nupic/swarming/experiments/max_branching_temporal/permutations.py +++ b/tests/swarming/nupic/swarming/experiments/max_branching_temporal/permutations.py @@ -24,12 +24,12 @@ permutations.py file by replacing $XXXXXXXX tokens with desired values. This permutations.py file was generated by: -'/Users/ronmarianetti/nupic/eng/lib/python2.6/site-packages/nupic/frameworks/opf/expGenerator/ExpGenerator.py' +'/Users/ronmarianetti/nupic/eng/lib/python2.6/site-packages/nupic/frameworks/opf/expGenerator/experiment_generator.py' """ import os -from nupic.swarming.permutationhelpers import * +from nupic.swarming.permutation_helpers import * # The name of the field being predicted. Any allowed permutation MUST contain # the prediction field. diff --git a/tests/swarming/nupic/swarming/experiments/oneField/description.py b/tests/swarming/nupic/swarming/experiments/oneField/description.py index 3599e2143e..6b2a43e4ae 100644 --- a/tests/swarming/nupic/swarming/experiments/oneField/description.py +++ b/tests/swarming/nupic/swarming/experiments/oneField/description.py @@ -24,7 +24,7 @@ description.py file by replacing $XXXXXXXX tokens with desired values. This description.py file was generated by: -'/Users/ronmarianetti/nupic/eng/lib/python2.6/site-packages/nupic/frameworks/opf/expGenerator/ExpGenerator.py' +'/Users/ronmarianetti/nupic/eng/lib/python2.6/site-packages/nupic/frameworks/opf/expGenerator/experiment_generator.py' """ from nupic.frameworks.opf.exp_description_api import ExperimentDescriptionAPI diff --git a/tests/swarming/nupic/swarming/experiments/oneField/permutations.py b/tests/swarming/nupic/swarming/experiments/oneField/permutations.py index 1bffa6b59b..127c732b7d 100644 --- a/tests/swarming/nupic/swarming/experiments/oneField/permutations.py +++ b/tests/swarming/nupic/swarming/experiments/oneField/permutations.py @@ -24,12 +24,12 @@ permutations.py file by replacing $XXXXXXXX tokens with desired values. This permutations.py file was generated by: -'/Users/ronmarianetti/nupic/eng/lib/python2.6/site-packages/nupic/frameworks/opf/expGenerator/ExpGenerator.py' +'/Users/ronmarianetti/nupic/eng/lib/python2.6/site-packages/nupic/frameworks/opf/expGenerator/experiment_generator.py' """ import os -from nupic.swarming.permutationhelpers import * +from nupic.swarming.permutation_helpers import * # The name of the field being predicted. Any allowed permutation MUST contain # the prediction field. diff --git a/tests/swarming/nupic/swarming/experiments/simpleV2/description.py b/tests/swarming/nupic/swarming/experiments/simpleV2/description.py index a87da4d157..56c40fd971 100644 --- a/tests/swarming/nupic/swarming/experiments/simpleV2/description.py +++ b/tests/swarming/nupic/swarming/experiments/simpleV2/description.py @@ -24,7 +24,7 @@ description.py file by replacing $XXXXXXXX tokens with desired values. This description.py file was generated by: -'/Users/ronmarianetti/nupic/eng/lib/python2.6/site-packages/nupic/frameworks/opf/expGenerator/ExpGenerator.py' +'/Users/ronmarianetti/nupic/eng/lib/python2.6/site-packages/nupic/frameworks/opf/expGenerator/experiment_generator.py' """ from nupic.frameworks.opf.exp_description_api import ExperimentDescriptionAPI diff --git a/tests/swarming/nupic/swarming/experiments/simpleV2/permutations.py b/tests/swarming/nupic/swarming/experiments/simpleV2/permutations.py index 18ac1e5b53..6bb3ef96a0 100644 --- a/tests/swarming/nupic/swarming/experiments/simpleV2/permutations.py +++ b/tests/swarming/nupic/swarming/experiments/simpleV2/permutations.py @@ -24,12 +24,12 @@ permutations.py file by replacing $XXXXXXXX tokens with desired values. This permutations.py file was generated by: -'/Users/ronmarianetti/nupic/eng/lib/python2.6/site-packages/nupic/frameworks/opf/expGenerator/ExpGenerator.py' +'/Users/ronmarianetti/nupic/eng/lib/python2.6/site-packages/nupic/frameworks/opf/expGenerator/experiment_generator.py' """ import os -from nupic.swarming.permutationhelpers import * +from nupic.swarming.permutation_helpers import * # The name of the field being predicted. Any allowed permutation MUST contain # the prediction field. diff --git a/tests/swarming/nupic/swarming/experiments/simple_cla_multistep/permutations.py b/tests/swarming/nupic/swarming/experiments/simple_cla_multistep/permutations.py index 9f073f22d9..2d8ac82e48 100644 --- a/tests/swarming/nupic/swarming/experiments/simple_cla_multistep/permutations.py +++ b/tests/swarming/nupic/swarming/experiments/simple_cla_multistep/permutations.py @@ -29,7 +29,7 @@ import os -from nupic.swarming.permutationhelpers import * +from nupic.swarming.permutation_helpers import * # The name of the field being predicted. Any allowed permutation MUST contain # the prediction field. diff --git a/tests/swarming/nupic/swarming/experiments/smart_speculation_spatial_classification/description.py b/tests/swarming/nupic/swarming/experiments/smart_speculation_spatial_classification/description.py index eca998b12c..f0b571d70e 100644 --- a/tests/swarming/nupic/swarming/experiments/smart_speculation_spatial_classification/description.py +++ b/tests/swarming/nupic/swarming/experiments/smart_speculation_spatial_classification/description.py @@ -24,7 +24,7 @@ description.py file by replacing $XXXXXXXX tokens with desired values. This description.py file was generated by: -'/Users/ronmarianetti/nupic/eng/lib/python2.6/site-packages/nupic/frameworks/opf/expGenerator/ExpGenerator.py' +'/Users/ronmarianetti/nupic/eng/lib/python2.6/site-packages/nupic/frameworks/opf/expGenerator/experiment_generator.py' """ from nupic.frameworks.opf.exp_description_api import ExperimentDescriptionAPI diff --git a/tests/swarming/nupic/swarming/experiments/smart_speculation_spatial_classification/permutations.py b/tests/swarming/nupic/swarming/experiments/smart_speculation_spatial_classification/permutations.py index 06aa6ce943..bdaca6906c 100644 --- a/tests/swarming/nupic/swarming/experiments/smart_speculation_spatial_classification/permutations.py +++ b/tests/swarming/nupic/swarming/experiments/smart_speculation_spatial_classification/permutations.py @@ -24,12 +24,12 @@ permutations.py file by replacing $XXXXXXXX tokens with desired values. This permutations.py file was generated by: -'/Users/ronmarianetti/nupic/eng/lib/python2.6/site-packages/nupic/frameworks/opf/expGenerator/ExpGenerator.py' +'/Users/ronmarianetti/nupic/eng/lib/python2.6/site-packages/nupic/frameworks/opf/expGenerator/experiment_generator.py' """ import os -from nupic.swarming.permutationhelpers import * +from nupic.swarming.permutation_helpers import * # The name of the field being predicted. Any allowed permutation MUST contain # the prediction field. @@ -37,18 +37,18 @@ predictedField = 'attendance' permutations = { - + 'modelParams': { 'sensorParams': { 'encoders': { 'A': PermuteEncoder(fieldName='daynight', encoderClass='SDRCategoryEncoder', w=7, n=100), 'B': PermuteEncoder(fieldName='daynight', encoderClass='SDRCategoryEncoder', w=7, n=100), 'C': PermuteEncoder(fieldName='precip', encoderClass='SDRCategoryEncoder', w=7, n=100), - '_classifierInput': dict(fieldNname='attendance', + '_classifierInput': dict(fieldNname='attendance', classifierOnly=True, - type='AdaptiveScalarEncoder', - maxval=36067, - n=PermuteInt(13, 500, 25), + type='AdaptiveScalarEncoder', + maxval=36067, + n=PermuteInt(13, 500, 25), clipInput=True, w=7, minval=0), }, }, @@ -91,7 +91,7 @@ def dummyModelParams(perm): if not perm['modelParams']['sensorParams']['encoders']['C'] is None: errScore -= 20 delay = 0 - + # Make the best model in sprint 0 run slower so that we create more # speculative models encoderCount = 0 @@ -103,21 +103,21 @@ def dummyModelParams(perm): # NOTE: The _classifierInput is always present. It seems that speculation # favors fields that are not done yet, so make the worse fields take # longer so that the speculative particles choose them in the second - # sprint. - if encoderCount == 2: + # sprint. + if encoderCount == 2: delay = 0.1 - + # Make speculative swarms that should be killed take longer... elif encoderCount == 3 \ and perm['modelParams']['sensorParams']['encoders']["A"] is None: delay = 0.2 # Make the best possible combination take the longest so that we have - # an opportunity to kill other swarms before we finish + # an opportunity to kill other swarms before we finish elif encoderCount == 3: delay = 0.3 - + dummyModelParams = dict( metricValue = errScore, metricFunctions = None, diff --git a/tests/swarming/nupic/swarming/experiments/smart_speculation_temporal/description.py b/tests/swarming/nupic/swarming/experiments/smart_speculation_temporal/description.py index 02a97c03b0..187b45cbbc 100644 --- a/tests/swarming/nupic/swarming/experiments/smart_speculation_temporal/description.py +++ b/tests/swarming/nupic/swarming/experiments/smart_speculation_temporal/description.py @@ -24,7 +24,7 @@ description.py file by replacing $XXXXXXXX tokens with desired values. This description.py file was generated by: -'/Users/ronmarianetti/nupic/eng/lib/python2.6/site-packages/nupic/frameworks/opf/expGenerator/ExpGenerator.py' +'/Users/ronmarianetti/nupic/eng/lib/python2.6/site-packages/nupic/frameworks/opf/expGenerator/experiment_generator.py' """ from nupic.frameworks.opf.exp_description_api import ExperimentDescriptionAPI diff --git a/tests/swarming/nupic/swarming/experiments/smart_speculation_temporal/permutations.py b/tests/swarming/nupic/swarming/experiments/smart_speculation_temporal/permutations.py index c117fe6c3e..daa9875df0 100644 --- a/tests/swarming/nupic/swarming/experiments/smart_speculation_temporal/permutations.py +++ b/tests/swarming/nupic/swarming/experiments/smart_speculation_temporal/permutations.py @@ -24,12 +24,12 @@ permutations.py file by replacing $XXXXXXXX tokens with desired values. This permutations.py file was generated by: -'/Users/ronmarianetti/nupic/eng/lib/python2.6/site-packages/nupic/frameworks/opf/expGenerator/ExpGenerator.py' +'/Users/ronmarianetti/nupic/eng/lib/python2.6/site-packages/nupic/frameworks/opf/expGenerator/experiment_generator.py' """ import os -from nupic.swarming.permutationhelpers import * +from nupic.swarming.permutation_helpers import * # The name of the field being predicted. Any allowed permutation MUST contain # the prediction field. diff --git a/tests/swarming/nupic/swarming/experiments/spatial_classification/permutations.py b/tests/swarming/nupic/swarming/experiments/spatial_classification/permutations.py index 00252c0a3a..ebd1816082 100644 --- a/tests/swarming/nupic/swarming/experiments/spatial_classification/permutations.py +++ b/tests/swarming/nupic/swarming/experiments/spatial_classification/permutations.py @@ -29,7 +29,7 @@ import os -from nupic.swarming.permutationhelpers import * +from nupic.swarming.permutation_helpers import * # The name of the field being predicted. Any allowed permutation MUST contain # the prediction field. diff --git a/tests/swarming/nupic/swarming/swarming_test.py b/tests/swarming/nupic/swarming/swarming_test.py index 7a66b7fd39..927b34909f 100755 --- a/tests/swarming/nupic/swarming/swarming_test.py +++ b/tests/swarming/nupic/swarming/swarming_test.py @@ -45,10 +45,10 @@ from nupic.support import configuration, initLogging from nupic.support.unittesthelpers.testcasebase import (unittest, TestCaseBase as HelperTestCaseBase) -from nupic.swarming import HypersearchWorker +from nupic.swarming import hypersearch_worker from nupic.swarming.api import getSwarmModelParams, createAndStartSwarm from nupic.swarming.utils import generatePersistentJobGUID -from nupic.swarming.DummyModelRunner import OPFDummyModelRunner +from nupic.swarming.dummy_model_runner import OPFDummyModelRunner DEFAULT_JOB_TIMEOUT_SEC = 60 * 2 @@ -355,7 +355,7 @@ def _runPermutationsLocal(self, jobParams, loggingLevel=logging.INFO, # Run it in the current process try: - HypersearchWorker.main(args) + hypersearch_worker.main(args) # The dummy model runner will call sys.exit(0) when # NTA_TEST_sysExitAfterNIterations is set @@ -438,7 +438,7 @@ def _runPermutationsCluster(self, jobParams, loggingLevel=logging.INFO, else: envStr = '' - cmdLine = '%s python -m nupic.swarming.HypersearchWorker ' \ + cmdLine = '%s python -m nupic.swarming.hypersearch_worker ' \ '--jobID={JOBID} --logLevel=%d' \ % (envStr, loggingLevel) @@ -449,7 +449,7 @@ def _runPermutationsCluster(self, jobParams, loggingLevel=logging.INFO, jobType = cjDAO.JOB_TYPE_HS) # Launch the workers ourself if necessary (no nupic engine running). - workerCmdLine = '%s python -m nupic.swarming.HypersearchWorker ' \ + workerCmdLine = '%s python -m nupic.swarming.hypersearch_worker ' \ '--jobID=%d --logLevel=%d' \ % (envStr, jobID, loggingLevel) workers = self._launchWorkers(cmdLine=workerCmdLine, numWorkers=maxNumWorkers) diff --git a/tests/unit/nupic/regions/anomaly_likelihood_region_test.py b/tests/unit/nupic/regions/anomaly_likelihood_region_test.py index 32fc7442fb..844f7379b2 100644 --- a/tests/unit/nupic/regions/anomaly_likelihood_region_test.py +++ b/tests/unit/nupic/regions/anomaly_likelihood_region_test.py @@ -33,7 +33,7 @@ from nupic.regions.AnomalyLikelihoodRegion_capnp import\ AnomalyLikelihoodRegionProto -from nupic.regions.AnomalyLikelihoodRegion import AnomalyLikelihoodRegion +from nupic.regions.anomaly_likelihood_region import AnomalyLikelihoodRegion from nupic.algorithms.anomaly_likelihood import AnomalyLikelihood from pkg_resources import resource_filename