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' |
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
| >>> 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
| 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
| 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
| $ ./bootstrap-nta.sh | |
| Running virtualenv with interpreter /usr/bin/python2.6 | |
| New python executable in nta/bin/python2.6 | |
| Also creating executable in nta/bin/python | |
| Installing setuptools............done. | |
| Installing pip...............done. | |
| Cloning into 'nupic'... | |
| remote: Counting objects: 12804, done. | |
| remote: Compressing objects: 100% (8984/8984), done. | |
| remote: Total 12804 (delta 3622), reused 12540 (delta 3558) |
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 validictory | |
| import yaml | |
| data = yaml.load(""" | |
| - foo | |
| - bar: [baz, null, 1.0, 2] | |
| """) | |
| with open('schema.yml', 'r') as inp: | |
| schema = yaml.load(inp.read()) |
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
| sudo apt-get update | |
| sudo apt-get install python-dev git python-pip automake libtool libssl-dev | |
| git clone https://github.com/numenta/nupic.git | |
| mkdir -p nta/eng | |
| echo " | |
| export NTA=$HOME/nta/eng | |
| export NUPIC=$HOME/nupic | |
| export BUILDDIR=/tmp/ntabuild | |
| export MK_JOBS=3 | |
| source $HOME/nupic/env.sh" >> ~/.bashrc |
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
| foo.split("").reverse().join("").split(/:(?!([\\]))/).map(function(_){if (_) {return _.split("").reverse().join("")} else {return _ }}).reverse().filter(function(_) {return (_)}) |
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
| ============================= test session starts ============================== | |
| platform linux2 -- Python 2.7.6 -- pytest-2.4.2 | |
| plugins: cov, xdist | |
| collected 788 items / 1 errors / 2 skipped | |
| ../usr/local/lib/python2.7/dist-packages/tests/unit/nupic/utils_test.py ... | |
| ../usr/local/lib/python2.7/dist-packages/tests/unit/nupic/algorithms/anomaly_likelihood_jeff_test.py ...ss.. | |
| ../usr/local/lib/python2.7/dist-packages/tests/unit/nupic/algorithms/anomaly_likelihood_test.py ............. | |
| ../usr/local/lib/python2.7/dist-packages/tests/unit/nupic/algorithms/anomaly_test.py ............ | |
| ../usr/local/lib/python2.7/dist-packages/tests/unit/nupic/algorithms/cells4_test.py |
OlderNewer