Skip to content

Instantly share code, notes, and snippets.

from nupic.bindings.sdr import SDR
from nupic.bindings.algorithms import SpatialPooler as SP
a=SDR([100])
a.randomize(0.05)
a.sparse
b=SDR([100])
sp=SP([100],[100])
sp.compute(a.sparse, True, b.sparse)
b.sparse
@breznak
breznak / swarming_models
Created July 3, 2015 10:41
NuPIC OPF swarming - is really best model chosen?
####>> UPDATED JOB RESULTS:
{ u'bestModel': 104195,
u'bestValue': 4.43,
u'metrics': { u"multiStepBestPredictions:multiStep:errorMetric='aae':steps=1:window=1000:field=ecg": 4.43,
u"multiStepBestPredictions:multiStep:errorMetric='altMAPE':steps=1:window=1000:field=ecg": 0.46635898904319556,
u"prediction:trivial:errorMetric='aae':steps=1:window=1000:field=ecg": 3.752,
u"prediction:trivial:errorMetric='altMAPE':steps=1:window=1000:field=ecg": 0.39498395640859363},
u'saved': True} (elapsed time: 31110.6 secs)
##>> UPDATED STATUS:
Completed generation #2 of swarm 'modelParams|sensorParams|encoders|ecg' with a best errScore of 4.601. Matured swarm(s): [u'modelParams|sensorParams|encoders|ecg']
@breznak
breznak / gist:cf1fa05469c147032c15
Created May 21, 2015 06:47
Nupic Coordinate Encoder Union percentage
#!python
import numpy as np
import random as r
import nupic
from nupic.encoders.coordinate import CoordinateEncoder as Enc
e=Enc(w=25, n=1000)
print e
@breznak
breznak / VectorSpeedtest.py
Created November 13, 2013 10:35
NuPIC: comparing speed-mem demands of SimpleVector encoder
from nupic.encoders.multi import SimpleVector as Vec
import time
mx=10**5
start=time.time()
#create big Vector
v = Vec(mx,0,100)
stop=time.time()