UI はローカライズ済みです。スキルの紹介と説明文書は選択した言語へ AI が自動翻訳し、コード・コマンド・パス・専門用語は原文のままです。原作者の文書が優先されます。
スキルを探す
生産性・共同作業 · SKILL.md

opf-prediction

opf-prediction

Use NuPIC legacy Online Prediction Framework models, experiment directories, prediction outputs, and checkpoints.

Independent GitHub snapshot · Automated classification · Original documentation governs

スキルの説明

GitHub

name: opf-prediction description: "Use NuPIC legacy Online Prediction Framework models, experiment directories, prediction outputs, and checkpoints." disable-model-invocation: true metadata: disco-role: operating license: MIT

OPF Prediction

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.

Route first

  • For CSV header rows, field type conversion rules, stream sources, and model parameter YAML/JSON structure, read ../data-and-configuration/ before changing OPF code.
  • For encoder, Spatial Pooler, Temporal Memory, classifier, anomaly-score, or SDR internals below OPF, read ../htm-algorithms/.
  • For models generated by a swarm, read ../swarming/ first, then return here to run the generated best OPF model.
  • For package installation, Python 2.7, 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.

Fast workflow map

  1. Create and run a model from CSV: load model params, call 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.
  2. Extract one- or multi-step predictions: read 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.
  3. Run an OPF experiment directory: use the installed experiment runner against an experiment directory containing description.py; list tasks/checkpoints before long runs. Command patterns and checkpoint layout: references/opf-workflows.md.
  4. Checkpoint or reload a model: direct API uses model.save(saveModelDir) and ModelFactory.loadFromCheckpoint(saveModelDir); experiment runs use savedmodels/<label>.nta under the experiment directory. Details: references/api-reference.md.
  5. Debug failures: predicted-field mismatches, malformed model params, unconverted raw strings, missing inference keys, runner usage errors, checkpoint directory shape, missing bindings/capnp, and Python 2 print syntax are covered in references/troubleshooting.md.

Bundled scripts

  • Run 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.
  • Run 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.

Minimal direct API skeleton

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.

保存したスキル