Wakan, When you create a swarm, you give it a predicted field and some settings, and it's job is to find the best set of model parameters for NuPIC for predicting that specific field. So it permutes over lots of different model parameters, running each model for some period of time and comparing the model's performance to other model's it has evaluated. It saves all this information, and continues to permute using a PSO method [1] to iterate over model param settings. Have you read this wiki page about it [2]?
Anyway, the swarm_def.json allows you to configure the swarm itself. Some of the values in this config are actually model parameters as you noticed, like "inferenceType". Other swarm config values like "iterationCount" and "swarmSize" are settings for the swarm itself. You can read more about them in the wiki I liked above. To answer your question, I don't think there is a way to get the raw model params used to create an OPF model from the model instance. I looked at the code, and the ModelFactory splits the model params up [3] in order to create the model, and the are all specifically stored in different variables [4]. The "writeToCheckpoint" method is not documented at this point because it is still under development. This is the new serialization method using Cap'n Proto. It's not quite ready to use yet. Instead, use model.save(path). [1] https://en.wikipedia.org/wiki/Particle_swarm_optimization [2] https://github.com/numenta/nupic/wiki/Running-Swarms#30000-foot-view-of-the-swarming-process [3] https://github.com/numenta/nupic/blob/master/src/nupic/frameworks/opf/modelfactory.py#L80 [4] https://github.com/numenta/nupic/blob/master/src/nupic/frameworks/opf/clamodel.py#L118-L134 Hope that helps, --------- Matt Taylor OS Community Flag-Bearer Numenta On Sat, Apr 30, 2016 at 7:38 AM, Wakan Tanka <[email protected]> wrote: > Hello NuPIC, > > There is "inferenceType" field both in search_def and also in model_params > (generated from search_def) Are there also equivalents for "iterationCount" > and "swarmSize" in model_params? I'm asking because I've resurrected model > standard way: > model = ModelFactory.loadFromCheckpoint("saved_model_state") > > and I'm wondering if it is possible to get the model_params which were used > when this model was created (before it was saved using model.save)? So far > I've set debugger on line where model was resurrected and started to play > with it. I've noticed that there are various get* functions: > > > ipdb> model. > model.anomalyAddLabel model.enableInference model.getInferenceArgs > model.isInferenceEnabled model.resetSequenceStates > model.setFieldStatistics > model.anomalyGetLabels model.enableLearning model.getInferenceType > model.isLearningEnabled model.run model.write > model.anomalyRemoveLabels model.finishLearning model.getParameter > model.load model.save > model.writeToCheckpoint > model.disableInference model.getAnomalyParameter model.getProtoType > model.read model.setAnomalyParameter > model.disableLearning model.getFieldInfo model.getRuntimeStats > model.readFromCheckpoint model.setEncoderLearning > > The closest I get are those functions but I do not know if e.g. numRunCalls > corresponds to iterationCount: > ########################################################################################################## > > ipdb> model.getFieldInfo(includeClassifierOnlyField=True) > (FieldMetaInfoBase(name='sine', type='float', special=''),) > > ipdb> model.getFieldInfo() > (FieldMetaInfoBase(name='sine', type='float', special=''),) > > ipdb> model.getInferenceArgs() > {'predictedField': 'sine'} > > ipdb> model.getInferenceType() > 'TemporalAnomaly' > > ipdb> model.getRuntimeStats() > {'numRunCalls': 3000, 'TemporalNextStep': {}} > > > Those are not working (I do not know what parameters should I to pass into > it): > ############################################################################### > > ipdb> model.getAnomalyParameter("swarmSize") > ERR: No item named: swarmSize > [/home/travis/build/numenta/nupic.core/src/nupic/ntypes/Collection.cpp line > 94] > *** Exception: getParameter -- parameter name 'swarmSize' does not exist in > region AnomalyClassifier of type py.KNNAnomalyClassifierRegion > > # > https://github.com/numenta/nupic/blob/master/src/nupic/frameworks/opf/clamodel.py#L332 > # self._getAnomalyClassifier().getParameter(param) > ipdb> model._getAnomalyClassifier() > <nupic.engine.Region object at 0x7fb9de282bd0> > > > ipdb> model.getParameter("swarmSize") > *** RuntimeError: 'swarmSize' parameter is not exposed by clamodel. > > > I was studying following documents/codes but I did not figured it out: > ##################################################################### > http://numenta.org/docs/nupic/classnupic_1_1frameworks_1_1opf_1_1modelfactory_1_1_model_factory.html > http://numenta.org/docs/nupic/classnupic_1_1frameworks_1_1opf_1_1model_1_1_model.html > > https://github.com/numenta/nupic/blob/master/src/nupic/frameworks/opf/clamodel.py > https://github.com/numenta/nupic/blob/master/src/nupic/frameworks/opf/model.py > https://github.com/numenta/nupic/blob/master/src/nupic/frameworks/opf/modelfactory.py > > > > One surprising thing that I've noticed is that e.g. there is function > "writeToCheckpoint" of model (see above my ipdb command) but in this > documentation it is not mentioned > http://numenta.org/docs/nupic/classnupic_1_1frameworks_1_1opf_1_1model_1_1_model.html > How is this possible? > > Regards > > Wakan Tanka > > -- > Best Regards > > Name: Wakan Tanka a.k.a. Wakatana a.k.a. MackoP00h > Location: Europe > Note: I'm non native English speaker so please bare with me ;) > Contact: > [email protected] > http://stackoverflow.com/users/1616488/wakan-tanka > https://github.com/wakatana > https://twitter.com/MackoP00h
