Skip to content
Back to skills

Opf Prediction

ASecurity

"Use NuPIC legacy Online Prediction Framework models, experiment

  • 247 stars
  • 0 votes
  • 0 copies
  • 3 views
  • Added September 8, 2026
toolspythongoapi

Works with

  • api

Security analysis

A100/100

Pro scans all 6 files and shows the line behind each finding

Scanned September 8, 2026

npx -y skills add VectorSpaceLab/AREX-Skill --skill opf-prediction --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of Opf Prediction?

Add the live security badge to your README. It updates with every re-scan.

Security grade badge for Opf Prediction
[![Security: A — Skills Directory](https://www.skillsdirectory.com/api/skills/vectorspacelab-opf-prediction/badge)](https://www.skillsdirectory.com/skills/vectorspacelab-opf-prediction)

More formats (shields.io, HTML) on the badges page. Keep it an A: scan every change in CI with Pro.

Download with Pro
SKILL.md
---
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/`](../data-and-configuration/) before changing OPF code.
- For encoder, Spatial Pooler, Temporal Memory, classifier, anomaly-score, or SDR internals below OPF, read [`../htm-algorithms/`](../htm-algorithms/).
- For models generated by a swarm, read [`../swarming/`](../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`](../../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`](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`](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`](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`](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`](references/troubleshooting.md).

## Bundled scripts

- Run [`scripts/opf_prediction_smoke.py`](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`](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

```python
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.

Files in this skill

  • SKILL.md4.1 KB
  • references/api-reference.md8.7 KB
  • references/opf-workflows.md9.3 KB
  • references/troubleshooting.md8.5 KB
  • scripts/opf_experiment_help.py6.1 KB
  • scripts/opf_prediction_smoke.py9.5 KB

Attribution

Is this your skill, or is something wrong with this listing? Request removal or report an issue. Author removals are honored within 72 hours.

Comments

Loading comments…

Newsletter

Get the weekly list of safe new skills, and the ones we pulled.