计划执行与检查节点
executing-plans
按既定实施计划完成工作,保持过程检查和反馈。
opf-prediction【效率与协作】Use NuPIC legacy Online Prediction Framework models, experiment directories, prediction outputs, and checkpoints.
独立 GitHub 快照 · 自动分类 · 以原作者文档为准
Use this sub-skill when the task mentions NuPIC legacy OPF, ModelFactory, HTMPredictionModel, model.run, result.inferences, multiStepBestPredictions, run_opf_experiment, experiment description.py directories, or OPF checkpoints.
../data-and-configuration/ before changing OPF code.../htm-algorithms/.../swarming/ first, then return here to run the generated best OPF model.nupic.bindings, numpy, pycapnp, or capnproto failures, start with root troubleshooting at ../../references/troubleshooting.md and then use the OPF-specific troubleshooting below.NuPIC legacy OPF is a Python 2.7-era API. Expect environments to need the legacy nupic package, compiled nupic.bindings, numpy 1.12.x-era compatibility, and pycapnp/capnproto for some serialization paths.
ModelFactory.create(modelConfig, logLevel=40), call model.enableInference({'predictedField': '<field>'}), convert each CSV value to the declared Python type, call model.run(record), and read result.inferences. Full recipe: references/opf-workflows.md.result.inferences['multiStepBestPredictions'][step] and confidence from result.inferences['multiStepPredictions'][step][predictedValue], allowing warm-up None/empty predictions. Shapes and API keys: references/api-reference.md.description.py; list tasks/checkpoints before long runs. Command patterns and checkpoint layout: references/opf-workflows.md.model.save(saveModelDir) and ModelFactory.loadFromCheckpoint(saveModelDir); experiment runs use savedmodels/<label>.nta under the experiment directory. Details: references/api-reference.md.references/troubleshooting.md.scripts/opf_prediction_smoke.py as a deterministic import/API smoke check; with --params, --csv, and --predicted-field it can run a tiny bounded OPF CSV pass without depending on the original repository checkout.scripts/opf_experiment_help.py to print self-contained OPF experiment runner command patterns, or use --runner-help/--check-import inside an installed NuPIC legacy environment.from nupic.frameworks.opf.model_factory import ModelFactory
model = ModelFactory.create(modelConfig, logLevel=40)
model.enableInference({'predictedField': 'consumption'})
record = {'timestamp': timestamp_datetime, 'consumption': 21.2}
result = model.run(record)
best = result.inferences['multiStepBestPredictions']
all_predictions = result.inferences['multiStepPredictions']
if best.get(1) is not None:
one_step = best[1]
confidence = all_predictions[1][one_step]
Keep OPF records typed before model.run; raw CSV strings are a common source of misleading failures.