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 / SDR.java
Created January 29, 2016 21:01
SDR RoaringBitmap wrapper api so far
package org.numenta.nupic.research.sdrs;
import java.util.Arrays;
import java.util.Iterator;
import java.util.stream.IntStream;
import org.roaringbitmap.RoaringBitmap;
public class SDR implements Iterable<Integer> {
@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 / 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 / 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 / UniversalRandom.java
Last active September 21, 2016 15:54
UniversalRandom Using George Marsaglia's elegant Xorshift (In Python and 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.
*