Skip to content

Instantly share code, notes, and snippets.

View cogmission's full-sized avatar

David Ray cogmission

View GitHub Profile
@cogmission
cogmission / Example.java
Last active August 29, 2015 14:09
Alternate Suggestion
import java.util.Set;
public class Example {
public static void main(final String[] args) {
final ParamMap<Param.ICE> map = (ParamMap<ICE>) new DummyParamMap();
final Price VWAP = map.get(ICE.SESSION_VWAP);
@cogmission
cogmission / gist:25aebc26a8f464c06298
Last active August 29, 2015 14:09
Encoder terminology is (i.e. variable names) confusing
Dylan Wilson asked this question:
> Also, I wanted to bring up a larger question about what our goals with the Java version is. For
> example, the variable names in the ScalarEncoder are pretty bad... w is described as "width" but
> getWidth returns n. Are we trying to maintain some connection to the Python code or are we free to
> fix these kinds of things ?
Good question. Yes we should maintain a definite connection with the Python code, and if we detect
"issues" with it, we should also correct the Python version and keep them in lock step. The main goal
@cogmission
cogmission / AdaptiveScalarEncoder.java
Last active August 29, 2015 14:10
Changes to get Builder to work
package org.numenta.nupic.encoders;
public class AdaptiveScalarEncoder extends ScalarEncoder {
/*
* This is an implementation of the scalar encoder that adapts the min and
* max of the scalar encoder dynamically. This is essential to the streaming
* model of the online prediction framework.
*
@cogmission
cogmission / initEncoderMethodChange
Created January 13, 2015 21:55
Seed as -1 issue
public void initEncoder(double resolution, int w, int n, Double offset,
long seed) {
// MersenneTwister says it is better to pass an int seed even though it
// accepts long??
rng = seed == -1 ? new MersenneTwister() : new MersenneTwister(seed);
initializeBucketMap(getMaxBuckets(), getOffset());
if (getName() == null || getName().isEmpty()) {
@cogmission
cogmission / ObservableTestBase.java
Last active July 21, 2016 12:34
ObservableTestBase
package org.numenta.nupic.network;
import rx.observers.TestObserver;
/**
* Base class for tests which use the Observable framework to test
* their methods. Contains useful methods to
* @author cogmission
*
*/
@cogmission
cogmission / QuickTest.py
Last active July 28, 2016 15:53
Example Use of Raw HTM Algorithms
'''
Created on Feb 8, 2015
@author: David Ray
'''
import numpy as np
from nupic.encoders.scalar import ScalarEncoder as ScalarEncoder
from nupic.algorithms.CLAClassifier import CLAClassifier as CLAClassifier
@cogmission
cogmission / AbstractGenerator.java
Created July 31, 2016 19:28
Java Version of Python Generator
/* ---------------------------------------------------------------------
* Numenta Platform for Intelligent Computing (NuPIC)
* Copyright (C) 2016, Numenta, Inc. Unless you have an agreement
* with Numenta, Inc., for a separate license for this software code, the
* following terms and conditions apply:
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License version 3 as
* published by the Free Software Foundation.
*
@cogmission
cogmission / Snippet.java
Created July 31, 2016 19:58
```excitedColumnsGenerator()``` Method in Java
/* ---------------------------------------------------------------------
* Numenta Platform for Intelligent Computing (NuPIC)
* Copyright (C) 2016, Numenta, Inc. Unless you have an agreement
* with Numenta, Inc., for a separate license for this software code, the
* following terms and conditions apply:
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero Public License version 3 as
* published by the Free Software Foundation.
*
@cogmission
cogmission / PALayer.java
Created August 26, 2016 02:41
Prediction Assisted Experiments
/* ---------------------------------------------------------------------
* Numenta Platform for Intelligent Computing (NuPIC)
* Copyright (C) 2016, Numenta, Inc. Unless you have an agreement
* with Numenta, Inc., for a separate license for this software code, the
* following terms and conditions apply:
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero Public License version 3 as
* published by the Free Software Foundation.
*
@cogmission
cogmission / JavaOut
Created September 8, 2016 20:29
Python & Java TM Output for TravelTime_387.csv
This file has been truncated, but you can view the full file.
===================================
--------------------------------------------
Record #: 0
Raw Input: 2015-07-10 14:24:00,564
TemporalMemory Input: [717, 737, 739, 745, 758, 782, 793, 798, 805, 812, 833, 841, 846, 857, 1482, 1515, 1536, 1577, 1578, 1600, 1608, 1612, 1642, 1644, 1645, 1646, 1647, 1648, 1649, 1655, 1661, 1663, 1667, 1669, 1677, 1683, 1688, 1706, 1710, 1720]
TemporalMemory prev. predicted: null
TemporalMemory active: [717, 737, 739, 745, 758, 782, 793, 798, 805, 812, 833, 841, 846, 857, 1482, 1515, 1536, 1577, 1578, 1600, 1608, 1612, 1642, 1644, 1645, 1646, 1647, 1648, 1649, 1655, 1661, 1663, 1667, 1669, 1677, 1683, 1688, 1706, 1710, 1720]