To add to Subutai's answer, the reason it looks like the predictions are lagging behind the actual is that initially the model is untrained, so its prediction of the next timestep is the same as the value it saw in the current timestep.
Looking at the example John provided, when it sees 45.4, it doesn't know anything else at that point, so it just predicts 45.4. This prediction is lined up with the actual in the next timestep. The prediction was incorrect, and that's why it looks weird. Eventually, when the model gets enough training, you should see the actual and the predicted values in each row become close to equal. On Tue, Feb 18, 2014 at 5:28 PM, Subutai Ahmad <[email protected]> wrote: > Hi John, > > I'm not sure I know all the details, but here's a stab at it: > > The OPF provides a set of API's for creating and running a particular type > of CLA model designed for streaming in temporal datasets. > > The code in examples/opf/clients/hotgym is a simple example of using that > API to create a model, feed in data, and retrieve results. It currently > doesn't save predictions to a file, but it could be easily modified to do > that. > > In this code the result object contains the result for each prediction as > it's being made. If you want to see this, insert the following print > statement into the code right after "model.run": > > print "timestamp:",modelInput['timestamp'], > "actual:",modelInput['consumption'],\ > "1-step > prediction",result.inferences['multiStepBestPredictions'][1],\ > "5-step > prediction",result.inferences['multiStepBestPredictions'][5] > > You could also write the results to a CSV file if you want. You should > also change the global _NUM_RECORDS to a large value, like 10000 so that > you see the whole dataset. > > OpfRunExperiment.py is a much more complex wrapper around the OPF for > running experiments and evaluating results on different datasets. For > convenience, one of the things it does is *shift* the predictions after the > fact so that the actual and predictions line up in the CSV file. This makes > it easy to use a spreadsheet and display actual vs predicted values in a > chart. > > In this case multiStepBestPredictions.1 shows one step predictions and is > shifted down by one row. multiStepBestPredictions.5 shows 5 step-ahead > predictions and is shifted down by 5 rows. > > Hope this helps, > > --Subutai > > > On Tue, Feb 18, 2014 at 2:54 PM, John Blackburn < > [email protected]> wrote: > >> I have recently installed NuPIC and am trying the hotgym example which >> seems to be the simplest. I have tried running python client hotgym.py and >> would like to ask a few questions if I may. >> >> First, am I right in saying that the client loads data from >> >> nupic/examples/prediction/data/extra/hotgym/rec-centre-hourly.csv ? >> >> (despite the client being located in nupic/examples/opf/clients/hotgym) >> >> When I run the client itself, it simply produces numbers at stdout. >> However, if I run it as an experiment, using >> >> python $NUPIC/examples/opf/bin/OpfRunExperiment.py >> $NUPIC/examples/opf/experiments/multistep/hotgym/ >> >> It outputs a CSV file "DefaultTask..predictionLog.csv" which I can view in a >> spreadsheet. I want to know exactly what the various colums in this >> spreadsheet mean. I notice there is a column marked >> "multiStepBestPredictions.1". Is this meant to be predicting the next value >> of the time series? Also there is "multiStepBestPredictions.5", is this >> meant to be predicting 5 steps in advance? >> >> After about 10 timesteps, I notice the multiStepBestPredictions.1 seems to >> shadow the actual input but is one step *behind*, eg, >> >> actual multiStepBestPredictions.1 >> >> 45.4 47.5 >> >> 46.1 45.4 >> >> 41.5 46.1 >> >> It seems to me this is the opposite of what we want! ie >> multiStepBestPredictions.1 is "predicting" *after* the input has occurred >> rather than before it. multiStepBestPredictions.5 seems to have the same >> problem. >> >> >> So when is the prediction actually being made? How can I tell if the HTM got >> it right? >> >> Ideally I would like a quick example so I can see that it works and convince >> my colleageus in a presentation tomorrow! (GMT time). If hotgym is not >> appropriate is there another example I could show them? >> >> >> Many thanks for your help and sorry for the rush! >> >> >> John. >> >> >> _______________________________________________ >> 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
