From ad2672ec705dfafdf522fb717fa09d21005a3e02 Mon Sep 17 00:00:00 2001 From: Scott Purdy Date: Wed, 7 Jun 2017 11:17:24 -0700 Subject: [PATCH 1/3] Add documentation to ExperimentDescriptionAPI --- .../frameworks/opf/exp_description_api.py | 35 +++++++++++++++++-- 1 file changed, 33 insertions(+), 2 deletions(-) diff --git a/src/nupic/frameworks/opf/exp_description_api.py b/src/nupic/frameworks/opf/exp_description_api.py index e8195f5234..969b7d6119 100644 --- a/src/nupic/frameworks/opf/exp_description_api.py +++ b/src/nupic/frameworks/opf/exp_description_api.py @@ -122,8 +122,39 @@ def convertNupicEnvToOPF(self): class ExperimentDescriptionAPI(DescriptionIface): - """ - TODO: Document this. + """Interface for specifying OPF experiments. + + This class is used to specify the model and control parameters for an OPF + experiment. The model config includes the necessary information for + constructing an OPF model and the control includes information about the + environment, where to get the data from, etc. + + The experiment_runner takes an instance of this class as the description + of the experiment to run. Similarly, scripts/run_opf_experiment.py looks + for an instance of this class in a variable called `descriptionInterface` + in the experiment files that are passed to it. + + :param modelConfig: (dict) a specification of the model to use, including + the following keys: + model: the name of the OPF model to create + version: the config format version to use + modelParams: parameters to pass to the OPF model + There may be other required fields such as predictionSteps, + predictedField, and numRecords + :param control: (dict): a specification of the experimental setup, + including the following keys: + environment: the environment that the model will be run in + dataset: input specification as defined in + `src/nupic/frameworks/opf/jsonschema/stream_def.json` + iterationCount: maximum number of iterations, or -1 to iterate + until the data source is exhausted + inferenceArgs: a dict containing all the supplementary parameters + for inference, including "predictedField" and "predictionSteps" + metrics: a list of MetricSpec instances that specify the metrics to + compute during this experiment + loggedMetrics: a sequence of regular expression strings that specify + which metrics should be logged at each iteration of the + experiment """ def __init__(self, modelConfig, control): From 7b26f24be545a5b2ea7fb3842013287286abced4 Mon Sep 17 00:00:00 2001 From: Matthew Taylor Date: Wed, 7 Jun 2017 12:39:41 -0700 Subject: [PATCH 2/3] RST formatting on exp-description-api --- .../frameworks/opf/exp_description_api.py | 22 +++++++++++-------- 1 file changed, 13 insertions(+), 9 deletions(-) diff --git a/src/nupic/frameworks/opf/exp_description_api.py b/src/nupic/frameworks/opf/exp_description_api.py index 969b7d6119..92cd764f25 100644 --- a/src/nupic/frameworks/opf/exp_description_api.py +++ b/src/nupic/frameworks/opf/exp_description_api.py @@ -136,23 +136,27 @@ class ExperimentDescriptionAPI(DescriptionIface): :param modelConfig: (dict) a specification of the model to use, including the following keys: - model: the name of the OPF model to create - version: the config format version to use - modelParams: parameters to pass to the OPF model + + - **model**: the name of the OPF model to create + - **version**: the config format version to use + - **modelParams**: parameters to pass to the OPF model + There may be other required fields such as predictionSteps, predictedField, and numRecords + :param control: (dict): a specification of the experimental setup, including the following keys: - environment: the environment that the model will be run in - dataset: input specification as defined in + + - **environment**: the environment that the model will be run in + - **dataset**: input specification as defined in `src/nupic/frameworks/opf/jsonschema/stream_def.json` - iterationCount: maximum number of iterations, or -1 to iterate + - **iterationCount**: maximum number of iterations, or -1 to iterate until the data source is exhausted - inferenceArgs: a dict containing all the supplementary parameters + - **inferenceArgs**: a dict containing all the supplementary parameters for inference, including "predictedField" and "predictionSteps" - metrics: a list of MetricSpec instances that specify the metrics to + - **metrics**: a list of MetricSpec instances that specify the metrics to compute during this experiment - loggedMetrics: a sequence of regular expression strings that specify + - **loggedMetrics**: a sequence of regular expression strings that specify which metrics should be logged at each iteration of the experiment """ From c1ede0ea3249f5d25f021a4128d22435991fd74f Mon Sep 17 00:00:00 2001 From: Scott Purdy Date: Wed, 7 Jun 2017 13:09:39 -0700 Subject: [PATCH 3/3] Clean up comments --- src/nupic/frameworks/opf/exp_description_api.py | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/src/nupic/frameworks/opf/exp_description_api.py b/src/nupic/frameworks/opf/exp_description_api.py index 92cd764f25..2474ebfa69 100644 --- a/src/nupic/frameworks/opf/exp_description_api.py +++ b/src/nupic/frameworks/opf/exp_description_api.py @@ -129,10 +129,11 @@ class ExperimentDescriptionAPI(DescriptionIface): constructing an OPF model and the control includes information about the environment, where to get the data from, etc. - The experiment_runner takes an instance of this class as the description - of the experiment to run. Similarly, scripts/run_opf_experiment.py looks - for an instance of this class in a variable called `descriptionInterface` - in the experiment files that are passed to it. + The :mod:`~nupic.frameworks.opf.experiment_runner` takes an instance of + this class as the description of the experiment to run. Similarly, + `scripts/run_opf_experiment.py` looks for an instance of this class in a + variable called "descriptionInterface" in the experiment files that are + passed to it. :param modelConfig: (dict) a specification of the model to use, including the following keys: @@ -156,8 +157,8 @@ class ExperimentDescriptionAPI(DescriptionIface): for inference, including "predictedField" and "predictionSteps" - **metrics**: a list of MetricSpec instances that specify the metrics to compute during this experiment - - **loggedMetrics**: a sequence of regular expression strings that specify - which metrics should be logged at each iteration of the + - **loggedMetrics**: a sequence of regular expression strings that + specify which metrics should be logged at each iteration of the experiment """