When you run the "run.py" file, you're not using the swarm description anymore. The swarm description is used to get the best model parameters. The run.py uses the model params returned by the swarm to create a new NuPIC model and pass data into it.
Can you show me your model params python file as well as your new run.py file? Even better, can you push your code to Github or Bitbucket? --------- Matt Taylor OS Community Flag-Bearer Numenta On Mon, Jun 30, 2014 at 12:52 PM, joseph skippings <[email protected]> wrote: > I fixed the last error and ran into another (error message below) . Is > this occurring because the fields open, high, low, close and adjclose are > included in the description.py and, not included in the run.py?? > > ------------------------------------------------------------------------------------------------------------------------ > > > -------------------------------------------------------------------------------------------------------------------- > > > Traceback (most recent call last): > File "run.py", line 50, in <module> > runStockData() > File "run.py", line 47, in runStockData > runModel(model) > File "run.py", line 38, in runModel > "Volume": volume > File > "/home/wolf_maroon/nupic/build/release/lib/python2.7/site-packages/nupic/frameworks/opf/clamodel.py", > line 391, in run > self._sensorCompute(inputRecord) > File > "/home/wolf_maroon/nupic/build/release/lib/python2.7/site-packages/nupic/frameworks/opf/clamodel.py", > line 461, in _sensorCompute > sensor.compute() > File > "/home/wolf_maroon/nupic/build/release/lib/python2.7/site-packages/nupic/engine/__init__.py", > line 443, in compute > return self._region.compute() > File > "/home/wolf_maroon/nupic/build/release/lib/python2.7/site-packages/nupic/bindings/engine_internal.py", > line 1235, in compute > return _engine_internal.Region_compute(*args, **kwargs) > File > "/home/wolf_maroon/nupic/build/release/lib/python2.7/site-packages/nupic/regions/RecordSensor.py", > line 294, in compute > self.encoder.encodeIntoArray(data, outputs["dataOut"]) > File > "/home/wolf_maroon/nupic/build/release/lib/python2.7/site-packages/nupic/encoders/multi.py", > line 74, in encodeIntoArray > encoder.encodeIntoArray(self._getInputValue(obj, name), > output[offset:]) > File > "/home/wolf_maroon/nupic/build/release/lib/python2.7/site-packages/nupic/encoders/base.py", > line 223, in _getInputValue > fieldName, knownFields, fieldName > ValueError: Unknown field name 'Low' in input record. Known fields are > 'Date, Volume'. > This could be because input headers are mislabeled, or because input data > rows do not contain a value for 'Low' > ------------------------------------------------------ > SWARM_DESCRIPTION = { > "includedFields": [ > { > "fieldName": "Date", > "fieldType": "datetime" > }, > { > "fieldName": "Open", > "fieldType": "float", > "maxValue": 41.33, > "minValue": 0.0 > }, > { > "fieldName": "High", > "fieldType": "float", > "maxValue": 41.72, > "minValue": 0.0 > }, > { > "fieldName": "Low", > "fieldType": "float", > "maxValue": 41.02, > "minValue": 0.0 > }, > { > "fieldName": "Close", > "fieldType": "float", > "maxValue": 41.23, > "minValue": 0.0 > }, > { > "fieldName": "Volume", > "fieldType": "float", > "maxValue": 66062700, > "minValue": 0.0 > }, > { > "fieldName": "AdjClose", > "fieldType": "float", > "maxValue": 41.23, > "minValue": 0.0 > } > ], > "streamDef": { > "info": "Volume", > "version": 1, > "streams": [ > { > "info": "yahoo_data_test", > "source": "file://table.csv", > "columns": [ > "*" > ] > } > ] > }, > > "inferenceType": "TemporalMultiStep", > "inferenceArgs": { > "predictionSteps": [ > 1 > ], > "predictedField": "Volume" > }, > "iterationCount": -1, > "swarmSize": "medium" > } > ----------------------------------------------------------- > > > > On Mon, Jun 30, 2014 at 2:10 PM, Matthew Taylor <[email protected]> wrote: > >> Thanks for the extra details. Try renaming your "table_model_params.py" >> file to "model_params.py". Is the "table_model_params.py" in a directory >> called "model_params"? If so, you might need to create an empty file within >> that directory called "__init__.py". This tells python to treat that >> directory as an importable module. See the structure of the example at >> https://github.com/numenta/nupic/tree/master/examples/opf/clients/hotgym/prediction/one_gym/model_params >> >> --------- >> Matt Taylor >> OS Community Flag-Bearer >> Numenta >> >> >> On Mon, Jun 30, 2014 at 10:58 AM, joseph skippings < >> [email protected]> wrote: >> >>> Using the hot_gym tutorial on youtube as a guide, I am trying to get my >>> run.py file to complie. Command python swarm.py ran successfully creating >>> the model params folder and file but when running the command python >>> run.py I get the error below. Inside the model_params folder the file is >>> called table_model_params.py. >>> >>> -------------------------------------------------------------------------------------------- >>> python run.py >>> Traceback (most recent call last): >>> File "run.py", line 8, in <module> >>> from model_params import model_params >>> ImportError: No module named model_params >>> >>> >>> ------------------------------------------------------------------------------------------------- >>> >>> #!/usr/bin/env python >>> >>> import csv >>> import datetime >>> >>> from nupic.frameworks.opf.modelfactory import ModelFactory >>> >>> from model_params import model_params >>> >>> >>> DATE_FORMAT = "%y/%m/%d" >>> >>> >>> def createModel(modelParams): >>> model = ModelFactory.create(model_Params.MODEL_PARAMS) >>> model.enableInference({"predictedField": "Volume"}) >>> return model >>> >>> def runModel(model): >>> inputFilePath = "table.csv" >>> inputFile = open(inputFilePath, "rb") >>> csvReader = csv.reader(inputFile) >>> # skip header rows >>> csvReader.next() >>> csvReader.next() >>> csvReader.next() >>> >>> counter = 0 >>> for row in csvReader: >>> counter += 1 >>> if (counter % 100 == 0): >>> print "Read %i lines..." % counter >>> date = datetime.datetime.strptime(row[0], DATE_FORMAT) >>> volume = float(row[1]) >>> result = model.run({ >>> "Date": date, >>> "Volume": volume >>> }) >>> >>> prediction = result.inferences["multiStepBestPredictions"][1] >>> print prediction >>> >>> >>> def runStockData(): >>> model = createModel() >>> runModel(model) >>> >>> if __name__ == "__main__": >>> runStockData() >>> >>> ------------------------------------------ >>> >>> >>> >>> On Mon, Jun 30, 2014 at 1:25 PM, Matthew Taylor <[email protected]> >>> wrote: >>> >>>> Joseph, >>>> >>>> When reporting problems to the mailing list, it is essential that you >>>> include the following information so we can help you: >>>> >>>> - exact command you ran that received the error >>>> - any steps you took before that command >>>> - what you are trying to achieve with the command >>>> - complete output that contains the error (use pastebin.com if it is >>>> very long) >>>> >>>> From what I can tell about your report, you have model params in a file >>>> named "table_model_params.py", but you are importing "model_params". You >>>> should "import table_model_params" to get that file imported into another >>>> Python script. >>>> >>>> --------- >>>> Matt Taylor >>>> OS Community Flag-Bearer >>>> Numenta >>>> >>>> >>>> On Mon, Jun 30, 2014 at 9:48 AM, Joseph Skippings < >>>> [email protected]> wrote: >>>> >>>>> Hello, >>>>> >>>>> I get this error when I run file run.py "From model_params >>>>> import model_params. ImportError: no module named model_params." In my >>>>> model_params folder the file is called table_model_params.py, I'm not sure >>>>> if that is causing the error. >>>>> >>>>> Thanks in advance. >>>>> >>>>> Sent from my iPhone >>>>> _______________________________________________ >>>>> nupic mailing list >>>>> [email protected] >>>>> http://lists.numenta.org/mailman/listinfo/nupic_lists.numenta.org >>>>> >>>> >>>> >>>> _______________________________________________ >>>> nupic mailing list >>>> [email protected] >>>> http://lists.numenta.org/mailman/listinfo/nupic_lists.numenta.org >>>> >>>> >>> >>> _______________________________________________ >>> nupic mailing list >>> [email protected] >>> http://lists.numenta.org/mailman/listinfo/nupic_lists.numenta.org >>> >>> >> >> _______________________________________________ >> nupic mailing list >> [email protected] >> http://lists.numenta.org/mailman/listinfo/nupic_lists.numenta.org >> >> > > _______________________________________________ > nupic mailing list > [email protected] > http://lists.numenta.org/mailman/listinfo/nupic_lists.numenta.org > >
_______________________________________________ nupic mailing list [email protected] http://lists.numenta.org/mailman/listinfo/nupic_lists.numenta.org
