Question 1:
May I get your support on how can i get the future 5 stps in the hierarchy_network_demo.py?
I have change the ‘steps’: ‘5’ in classifierParams, but how can i get the prediction valve for the future 5 step? i want write it the csv.
Queation 2:
can i change the numRecords = dataSource.getDataRowCount()
to datetime? I want to make the prediction based on the date diffrence.
@rhyolight
Sandy, I don’t think this is the example you want to use. We put this here years about because some of our community wanted to see an example of how one might use the Network API to create a hierarchy, but this is not how we currently advise users to use NuPIC. Please see our quick start guides, where you’ll find a better Network API demo. You can also run the complete example from a script.
Thanks very much, may i confirm again:oneStep is the 1 step predection valve, fiveStep is the 5 step predection valve for future? or for now?
predictionResults = getPredictionResults(network, "classifier")
oneStep = predictionResults[1]["predictedValue"]
oneStepConfidence = predictionResults[1]["predictionConfidence"]
fiveStep = predictionResults[5]["predictedValue"]
fiveStepConfidence = predictionResults[5]["predictionConfidence"]
Yes, that is correct. Now can you describe the data you are attempting to process? At what interval is the data aggregated (or is it)?
I want try some price for stock, it’s daily but some missing, so i want try the record number based on datetime not based on the row.
That might be a good project to learn the NuPIC system, but I can tell you that you most likely will not be successful predicting stock prices with NuPIC or any other system. There are too many unknown and un-instrumented factors we cannot realistically take into account.
However, there is some value in stock anomaly detection. We created a demo app called HTM for Stocks year ago (not sure it is still available in the app stores, but still open source). This app only tried to give anomaly indications for stock tickers, based on change in stock volume over time and twitter cashtag activity.
Yes, it’s really hard.
I still want find the advise how to change the numRecords based on the date diffrence?
numRecords = min(numRecords, dataSource.getDataRowCount())
I don’t understand this question. numRecords
is just a count of the input data rows. It is just used to loop over the input data and output to stdout. It has nothing to do with date.
Is the numRecords used for Classifier to find the SDRs to learn?
No, it is not used at all. It just just for record keeping outside the HTM system. It is simply counting input rows.
so, how the Classifier find the 1 step SDRs? I want to find the one day step or five day step.
Here are some place you can read / view more about classification in HTM:
Although the “CLA” Classifier has been replaced by the “SDR” Classifier, the concepts are the same.
Yes, that’s why i want to change the numRecords, because i think this SDR classifier will learn the SDRs based on 1 step diffrent of numRecords, is it correct?
No, numRecords
is never even exposed to NuPIC or the classifiers. Classifiers keep track of how many rows of input they have seen. When you create a classifier you tell it how many steps ahead to classify.
c = SDRClassifier(steps=[1], alpha=0.1, actValueAlpha=0.1, verbosity=0)
# learning
c.compute(recordNum=0, patternNZ=[1, 5, 9],
classification={"bucketIdx": 4, "actValue": 34.7},
learn=True, infer=False)
# inference
result = c.compute(recordNum=1, patternNZ=[1, 5, 9],
classification={"bucketIdx": 4, "actValue": 34.7},
learn=False, infer=True)
# Print the top three predictions for 1 steps out.
topPredictions = sorted(zip(result[1],
result["actualValues"]), reverse=True)[:3]
for probability, value in topPredictions:
print "Prediction of {} has probability of {}.".format(value,
probability*100.0)