This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from nupic.frameworks.opf.clamodel import CLAModel | |
params = \ | |
{'clParams': {'alpha': 0.0001, | |
'clVerbosity': 0, | |
'regionName': 'CLAClassifierRegion', | |
'steps': '1,5'}, | |
'inferenceType': 'TemporalMultiStep', | |
'sensorParams': {'encoders': {'consumption': {'clipInput': True, | |
'fieldname': u'consumption', | |
'n': 100, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import types | |
import web | |
urls = [] | |
def GET(route): | |
def decorate(fn): | |
clsName = '%s_%s' % (fn.__name__, 'GET') |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
>>> dictify = lambda t:dict(zip(*[iter(t)]*2)) | |
>>> dictify(('a', 'A', 'c', 'C', 'b', 'B')) | |
{'a': 'A', 'c': 'C', 'b': 'B'} | |
>>> | |
>>> tuplify = lambda d:tuple(chain(*d.iteritems())) | |
>>> tuplify({'a': 'A', 'c': 'C', 'b': 'B'}) | |
('a', 'A', 'c', 'C', 'b', 'B') | |
>>> | |
>>> assert (lambda d:dictify(tuplify(d))==d)({'a': 'A', 'c': 'C', 'b': 'B'}) | |
>>> assert (lambda t:tuplify(dictify(t))==t)(('a', 'A', 'c', 'C', 'b', 'B')) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
>>> from operator import itemgetter | |
>>> iterable=[('foo', 'bar', 'baz'), ('apple', 'banana', 'orange')] | |
>>> [i[1] for i in foo] | |
['bar', 'banana'] | |
>>> map(itemgetter(1),foo) | |
['bar', 'banana'] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
>>> (lambda s: ['a', s, 'c'])('b') | |
['a', 'b', 'c'] | |
>>> 'a %s c' % 'b' | |
'a b c' |
NewerOlder