协作头脑风暴
brainstorming
在实现前澄清需求、探索设计选择,并形成清晰的开发方向。
htm-algorithms【开发与工程】Direct NuPIC legacy HTM encoders, SpatialPooler, TemporalMemory, SDRClassifier, anomaly score, and anomaly likelihood workflows.
独立 GitHub 快照 · 自动分类 · 以原作者文档为准
Use this sub-skill when a task asks for direct NuPIC legacy HTM algorithm APIs: encoders, SpatialPooler, TemporalMemory, SDRClassifier, raw anomaly score, or anomaly likelihood for a small streaming scalar/temporal example.
NuPIC legacy is a Python 2.7 package. Direct algorithm workflows normally require installed nupic, nupic.bindings, numpy in the legacy-compatible range, and pycapnp/Cap'n Proto only when serialization is needed.
ScalarEncoder, RandomDistributedScalarEncoder, DateEncoder, CategoryEncoder, MultiEncoder, SpatialPooler.compute, TemporalMemory.compute, SDRClassifier.compute, computeRawAnomalyScore, and AnomalyLikelihood.anomalyProbability.ModelFactory, OPF inference dictionaries, checkpoints, and experiment workflows to ../opf-prediction/.../../references/troubleshooting.md; local reference files also cross-link to that guide from their own relative paths.nupic, nupic.bindings, and numpy.encoder.getWidth() and call encoder.encodeIntoArray(value, bits).SpatialPooler(inputDimensions=(encodingWidth,), columnDimensions=(columnCount,), ...) so encodingWidth == len(concatenatedEncoding).activeArray = numpy.zeros(columnCount, dtype="uint32"), call sp.compute(encoding, learn, activeArray), then pass numpy.nonzero(activeArray)[0] to TemporalMemory.compute.TemporalMemory(columnDimensions=(columnCount,), ...) to the same column count used by the SP. Use tm.getActiveCells() for classifier patternNZ; use tm.getPredictiveCells() plus tm.columnForCell(cell) to build next-step predicted columns for anomaly score.classifier.compute(recordNum, patternNZ, {"bucketIdx": bucketIdx, "actValue": rawValue}, learn=True, infer=True). Look for integer step keys such as 1 plus the "actualValues" key in the result.computeRawAnomalyScore(activeColumns, prevPredictedColumns), then optionally update AnomalyLikelihood with the raw value, anomaly score, and timestamp.From this sub-skill directory in a prepared NuPIC legacy environment:
python scripts/algorithm_smoke.py --mode all --records 20 --encoder scalar
Expected success signal: the script prints PASS, encoder/SP/TM dimensions, a final one-step prediction summary, and bounded anomaly likelihood values. If it fails before imports, use root install/import troubleshooting; if it fails after imports, use the local troubleshooting reference.
This sub-skill distills NuPIC legacy algorithm evidence from source/doc paths such as src/nupic/algorithms/, src/nupic/encoders/, docs/source/quick-start/algorithms.rst, docs/examples/algo/complete-algo-example.py, examples/sp/hello_sp.py, examples/tm/hello_tm.py, and unit tests under tests/unit/nupic/algorithms/ and tests/unit/nupic/encoders/. Runtime guidance here is self-contained; future agents should not need to open the original checkout examples to use it.