AGENT SKILL

opf-prediction

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

License 许可
MIT
最近更新
2026-09-03
Stars
★ 351
Forks
27

01 前言 Front Matter

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

02 资源文件 5

03 SKILL.md 正文

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.

04 同仓库更多 Skills

VectorSpaceLab
VectorSpaceLab/AREX-Skill

passnet-triton-opt

Make a single PassNet Triton kernel fast AND numerically faithful: performance model (when a replacement can win at all), block/grid/warp tuning, autotune policy, launch overhead, and per-op numeric recipes to pass the dtype baseline tolerances. Use when a pass matches and is correct but speedup below expected, or when correctness fails by small numeric margins.

★ 351
VectorSpaceLab
VectorSpaceLab/AREX-Skill

passnet-solve

END-TO-END playbook for solving one PassNet sample: analyze the computation graphs, decide the optimization strategy (what to fuse, what to replace, what to leave alone), drive the iteration loop, and maximize the sample score. This is the ENTRY skill — invoke it first for any PassNet optimization task; it tells you when to use passnet-pattern-fusion, passnet-triton-opt and passnet-feedback.

★ 351
VectorSpaceLab
VectorSpaceLab/AREX-Skill

passnet-skill

PassNet GPU kernel optimization via compiler passes. Design and implement Triton-based optimization passes, create pass files under ./pass_dir/, self-evaluate with pass_evaluator, and iterate to maximize GPU speedup.

★ 351
VectorSpaceLab
VectorSpaceLab/AREX-Skill

passnet-pattern-fusion

Author PassNet pass files: write patterns that actually MATCH the FX graph, pick fusion regions (which ops to absorb into one Triton kernel), and structure multi-pass submissions with the mandatory shared-dispatch architecture. Use when creating or fixing pattern()/replacement_args()/replacement_func() files, when a pass "failed to match", or when deciding how to fuse multiple kernels/ops.

★ 351
VectorSpaceLab
VectorSpaceLab/AREX-Skill

passnet-orchestrate

Round/batch planning and decision support for PassNet graph optimization. Use for multi-sample triage, worker allocation, eval-budget policy, and post-eval keep/revert decisions. For solving one concrete sample end to end, use passnet-solve as the entry skill; consult this skill only when you need broader planning or a specific decision gate.

★ 351
VectorSpaceLab
VectorSpaceLab/AREX-Skill

passnet-feedback

Fast, deterministic feedback for PassNet work: pre-flight pattern/match verification WITHOUT burning a GPU evaluation, per-node bottleneck analysis of a sample's graphs, and eval-log parsing into per-variant status + estimated score + failure classification. Use BEFORE every GPU evaluation (check_pattern), at the START of a sample (analyze_graph), and AFTER every evaluation (parse_eval_log).

★ 351