Code Monkey home page Code Monkey logo

htm.java's People

Contributors

addos avatar antidata avatar anubhavchaturvedi avatar breznak avatar calclavia avatar chelu avatar clumsy avatar cogmission avatar connollyst avatar erinloy avatar eronwright avatar fergalbyrne avatar hopding avatar jamesweakley avatar jonnoftw avatar mandarx avatar pravsonawane avatar rhyolight avatar sambitgaan avatar setus avatar skidder avatar smadasu avatar solovyevk avatar timboudreau avatar utensil avatar vova616 avatar wilsondy avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

htm.java's Issues

Add LICENSE.txt and copyright header to all source files

LICENSE.txt should be exactly the same as https://github.com/numenta/nupic/blob/master/LICENSE.txt. Copyright header should be at the top of all source code files:

/* ---------------------------------------------------------------------
 * Numenta Platform for Intelligent Computing (NuPIC)
 * Copyright (C) 2014, 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 General Public License version 3 as
 * published by the Free Software Foundation.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
 * See the GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program.  If not, see http://www.gnu.org/licenses.
 *
 * http://numenta.org/licenses/
 * ---------------------------------------------------------------------
 */

htm.java needs a PassThruEncoder

This class and test should be created to follow the same idioms and structure as the Encoder.java and ScalarEncoder.java class. The CategoryEncoder, can be used as an example.

htm.java needs a SparsePassThroughEncoder

This class and test should be created to follow the same idioms and structure as the Encoder.java and ScalarEncoder.java class. The CategoryEncoder, can be used as an example.

Q: Which Java version(s) do we support?

In the pom.xml we specify source & target Java versions of 1.7; likewise in build.gradle.

However, I see we aren't using 1.7 niceties such as 'diamonds', e.g.:
Map<Integer, String> map = new HashMap<>

Can I feel free to code against Java 7 or do we want to support Java 6 also? If the latter, I'll put in a ticket to update the pom.xml and build.gradle.

Finalizing Parameters

I propose a few more step to finalize parameters:

  1. Make constructor private. Only allow instantiation with Factory methods. This way we will never have erroneous Parameters with missing attributes. Right now we have just one Factory method: Parameters getDefaultParameters(). It return global defaults.
    But we can have different flavors of it, for example: Parameters getMonkeyBrainParameters()

  2. I mark 27 parameters constructor(Parameters.java:365). as depriciated, we will have only default private constructor, see my comments

  3. I marked method getMap(Parameters.java:433) as depriciated. We remove direct access to the map

  4. I'll use following pattern for parameters in all plases

/All parameters set to default/
Parameters params = Parameters.getDefaultParameters();
/Now just change what you need/
params.setParameterByKey(Parameters.KEY.CELLS_PER_COLUMN, 20);
/Apply to what you need/
Parameters.apply(conn, params);

Any suggetions?

Code Analysis - we need some cleanup

I perform code analisys for 9 files from my last commit here solovyevk@faa9928

Results below, errors related to not matching names in JavaDoc, there are many meaningfull warnings as you see:

Warning:(926, 11) Local variabls\development\htm.java\src\main\java\org\numenta\nupic\encoders\GeospatialCoordinateEncoder.java
Warning:Warning:line (25)[UNUSED_IMPORT] Unused import statement
Warning:Warning:line (26)[UNUSED_IMPORT] Unused import statement
Warning:Warning:line (64)Local variable 'radius' hides field in class 'GeospatialCoordinateEncoder'
Error:Error:line (94)Cannot resolve symbol 'lon'
Error:Error:line (95)Cannot resolve symbol 'lat'
Warning:Warning:line (117)Local variable 'radius' hides field in class 'GeospatialCoordinateEncoder'
Error:Error:line (123)Cannot resolve symbol 'EncoderBuilder'
Warning:Warning:line (168)'StringBuilder' can be replaced with 'String'
Warning:Warning:line (183)Casting 'this' to 'Builder' is redundant
Warning:Warning:line (193)Casting 'this' to 'Builder' is redundant
Z:\projects\development\htm.java\src\main\java\org\numenta\nupic\encoders\MultiEncoder.java
Warning:Warning:line (50)Field 'ncategories' is never used
Warning:Warning:line (52)Field 'categoryToIndex' is never used
Warning:Warning:line (52)Explicit type argument String can be replaced with <>
Warning:Warning:line (53)Field 'indexToCategory' is never used
Warning:Warning:line (53)Explicit type argument String can be replaced with <>
Warning:Warning:line (55)Field 'categoryList' is never used
Warning:Warning:line (75)Explicit type argument EncoderTuple, List can be replaced with <>
Warning:Warning:line (83)Local variable 'name' hides field in class 'MultiEncoder'
Warning:Warning:line (96)Local variable 'name' hides field in class 'MultiEncoder'
Warning:Warning:line (103)Manual array copy
Warning:Warning:line (110)Method 'encodeField(java.lang.String, java.lang.Object)' is never used
Warning:Warning:line (112)Local variable 'name' hides field in class 'MultiEncoder'
Warning:Warning:line (123)Method 'encodeEachField(java.lang.Object)' is never used
Warning:Warning:line (124)Explicit type argument int[] can be replaced with <>
Warning:Warning:line (127)Local variable 'name' hides field in class 'MultiEncoder'
Warning:Warning:line (150)Explicit type argument String can be replaced with <>
Error:Error:line (287)Cannot resolve symbol 'EncoderBuilder'
Z:\projects\development\htm.java\src\main\java\org\numenta\nupic\encoders\CategoryEncoder.java
Warning:Warning:line (80)Explicit type argument String can be replaced with <>
Warning:Warning:line (81)Explicit type argument String can be replaced with <>
Warning:Warning:line (182)Format string '"input: %s, val: %s, value: %d, output: %s"' does not match the type of its arguments
Warning:Warning:line (207)Explicit type argument MinMax can be replaced with <>
Warning:Warning:line (231)Explicit type argument String, RangeList can be replaced with <>
Warning:Warning:line (234)Redundant array creation for calling varargs method
Error:Error:line (261)Cannot resolve symbol 'returnType'
Warning:Warning:line (271)Local variable 'topDownMapping' hides field in class 'CategoryEncoder'
Warning:Warning:line (303)Local variable 'topDownMapping' hides field in class 'CategoryEncoder'
Warning:Warning:line (309)Method 'getCategoryList()' is never used
Error:Error:line (318)Cannot resolve symbol 'EncoderBuilder'
Error:Error:line (361)Cannot resolve symbol 'stuff'
Z:\projects\development\htm.java\src\main\java\org\numenta\nupic\encoders\CoordinateEncoder.java
Warning:Warning:line (92)Explicit type argument int[] can be replaced with <>
Warning:Warning:line (120)Explicit type argument Double, Integer can be replaced with <>
Warning:Warning:line (141)Missing '@OverRide' annotation on 'orderForCoordinate()'
Warning:Warning:line (218)'StringBuilder' can be replaced with 'String'
Z:\projects\development\htm.java\src\main\java\org\numenta\nupic\encoders\PassThroughEncoder.java
Warning:Warning:line (99)Variable 'r' initializer '0.0' is redundant
Warning:Warning:line (128)Missing '@OverRide' annotation on 'encodeIntoArray()'
Warning:Warning:line (130)Format string '"Different input (%i) and output (%i) sizes"' is malformed
Warning:Warning:line (132)Format string '"Input has %i bits but w was set to %i."' is malformed
Warning:Warning:line (141)Missing '@OverRide' annotation on 'decode()'
Warning:Warning:line (145)Result of 'String.format()' is ignored
Warning:Warning:line (147)Explicit type argument MinMax can be replaced with <>
Warning:Warning:line (150)Explicit type argument String, RangeList can be replaced with <>
Warning:Warning:line (154)Redundant array creation for calling varargs method
Error:Error:line (170)Cannot resolve symbol 'EncoderBuilder'
Z:\projects\development\htm.java\src\main\java\org\numenta\nupic\encoders\ScalarEncoder.java
Warning:Warning:line (174)Missing '@OverRide' annotation on 'isDelta()'
Warning:Warning:line (240)String values are compared using '==', not 'equals()'
Error:Error:line (247)Cannot resolve symbol 'c'
Error:Error:line (297)Cannot resolve symbol 'c'
Warning:Warning:line (341)Casting '((int)((input - getMinVal()) * getNInternal() / getRange()))' to 'int' is redundant
Warning:Warning:line (343)Casting '((int)(((input - getMinVal()) + getResolution()/2) / getResolution()))' to 'int' is redundant
Warning:Warning:line (346)Local variable 'minbin' is redundant
Error:Error:line (352)Cannot resolve symbol 'c'
Warning:Warning:line (366)Redundant array creation for calling varargs method
Warning:Warning:line (372)Missing '@OverRide' annotation on 'getWidth()'
Error:Error:line (408)Cannot resolve symbol 'getW()'
Error:Error:line (411)Cannot resolve symbol 'inputData'
Error:Error:line (412)Cannot resolve symbol 'getW()'
Warning:Warning:line (432)Local variable 'range' hides field in class 'ScalarEncoder'
Warning:Warning:line (458)Missing '@OverRide' annotation on 'decode()'
Warning:Warning:line (507)Missing '@OverRide' annotation on 'eval()'
Warning:Warning:line (511)Explicit type argument Tuple can be replaced with <>
Warning:Warning:line (532)Casting 'runs.get(l).get(0)' to 'Integer' is redundant
Warning:Warning:line (544)Variable 'left' initializer '0' is redundant
Warning:Warning:line (545)Variable 'right' initializer '0' is redundant
Warning:Warning:line (546)Explicit type argument MinMax can be replaced with <>
Warning:Warning:line (608)Explicit type argument String, RangeList can be replaced with <>
Warning:Warning:line (611)Redundant array creation for calling varargs method
Error:Error:line (641)Cannot resolve symbol 'c'
Warning:Warning:line (662)Local variable 'topDownMapping' hides field in class 'ScalarEncoder'
Warning:Warning:line (664)Explicit type argument int[] can be replaced with <>
Warning:Warning:line (667)Local variable 'topDownValues' hides field in class 'ScalarEncoder'
Warning:Warning:line (669)Local variable 'minVal' hides field in class 'ScalarEncoder'
Warning:Warning:line (670)Local variable 'maxVal' hides field in class 'ScalarEncoder'
Error:Error:line (705)Cannot resolve symbol 'returnType'
Warning:Warning:line (715)Local variable 'topDownMapping' hides field in class 'ScalarEncoder'
Warning:Warning:line (730)Local variable 'topDownMapping' hides field in class 'ScalarEncoder'
Warning:Warning:line (745)Redundant array creation for calling varargs method
Warning:Warning:line (756)Local variable 'topDownMapping' hides field in class 'ScalarEncoder'
Warning:Warning:line (771)Explicit type argument Tuple can be replaced with <>
Error:Error:line (795)Cannot resolve symbol 'EncoderBuilder'
Warning:Warning:line (834)[UnusedDeclaration] Parameter 'stuff' is never used
Z:\projects\development\htm.java\src\main\java\org\numenta\nupic\encoders\LogEncoder.java
Error:Error:line (226)Cannot resolve symbol 'getW()'
Error:Error:line (229)Cannot resolve symbol 'inputData'
Error:Error:line (230)Cannot resolve symbol 'getW()'
Warning:Warning:line (234)Missing '@OverRide' annotation on 'encodeIntoArray()'
Warning:Warning:line (239)'return' is unnecessary as the last statement in a 'void' method
Warning:Warning:line (254)Missing '@OverRide' annotation on 'decode()'
Warning:Warning:line (277)Casting 'outRanges.getRange(i)' to 'MinMax' is redundant
Warning:Warning:line (296)Explicit type argument String, RangeList can be replaced with <>
Warning:Warning:line (299)Explicit type argument String can be replaced with <>
Warning:Warning:line (334)Redundant array creation for calling varargs method
Warning:Warning:line (348)Redundant array creation for calling varargs method
Warning:Warning:line (355)Missing '@OverRide' annotation on 'closenessScores()'
Warning:Warning:line (377)Local variable 'err' is redundant
Error:Error:line (386)Cannot resolve symbol 'EncoderBuilder'
Warning:Warning:line (425)Method 'setStuff(int)' is never used
Warning:Warning:line (425)[UnusedDeclaration] Parameter 'stuff' is never used
Z:\projects\development\htm.java\src\main\java\org\numenta\nupic\encoders\Encoder.java
Error:Error:line (447)Cannot resolve symbol 'e'
Warning:Warning:line (453)Explicit type argument EncoderTuple, List can be replaced with <>
Warning:Warning:line (457)Variable 'childEncoders' initializer 'null' is redundant
Warning:Warning:line (459)Explicit type argument EncoderTuple can be replaced with <>
Warning:Warning:line (471)Explicit type argument EncoderTuple, List can be replaced with <>
Warning:Warning:line (499)Explicit type argument EncoderTuple, List can be replaced with <>
Warning:Warning:line (525)Method 'getFlattenedFieldTypeList(org.numenta.nupic.encoders.Encoder)' is never used
Warning:Warning:line (527)Explicit type argument Tuple, List can be replaced with <>
Warning:Warning:line (531)Variable 'fieldTypes' initializer 'null' is redundant
Warning:Warning:line (533)Explicit type argument FieldMetaType can be replaced with <>
Warning:Warning:line (563)Method 'getScalarNames()' is never used
Warning:Warning:line (572)Method 'setScalarNames(java.util.List<java.lang.String>)' is never used
Warning:Warning:line (586)Method 'isDelta()' is never used
Error:Error:line (620)Cannot resolve symbol 'encodeIntoArray(double, int[])'
Warning:Warning:line (642)Explicit type argument String can be replaced with <>
Warning:Warning:line (644)Local variable 'encoders' hides field in class 'Encoder'
Warning:Warning:line (647)Explicit type argument String can be replaced with <>
Warning:Warning:line (649)Local variable 'name' hides field in class 'Encoder'
Warning:Warning:line (678)Explicit type argument FieldMetaType can be replaced with <>
Warning:Warning:line (715)Local variable 'encoders' hides field in class 'Encoder'
Warning:Warning:line (715)Explicit type argument Encoder can be replaced with <>
Warning:Warning:line (751)Local variable 'encoders' hides field in class 'Encoder'
Warning:Warning:line (777)Method 'getEncodedValues(S)' is never used
Warning:Warning:line (778)Explicit type argument String can be replaced with <>
Warning:Warning:line (779)Local variable 'encoders' hides field in class 'Encoder'
Warning:Warning:line (801)Local variable 'encoders' hides field in class 'Encoder'
Warning:Warning:line (823)Local variable 'encoders' hides field in class 'Encoder'
Warning:Warning:line (844)Method 'scalarsToStr(java.util.List<?>, java.util.List<java.lang.String>)' is never used
Warning:Warning:line (852)Format string '", %s:%.2f"' does not match the type of its arguments
Warning:Warning:line (854)Format string '"%s:%.2f"' does not match the type of its arguments
Warning:Warning:line (884)Method 'encodedBitDescription(int, boolean)' is never used
Warning:Warning:line (886)Local variable 'description' hides field in class 'Encoder'
Warning:Warning:line (918)Method 'pprintHeader(java.lang.String)' is never used
Warning:Warning:line (921)Local variable 'description' hides field in class 'Encoder'
Warning:Warning:line (926)Local variable 'name' hides field in class 'Encoder'
Warning:Warning:line (947)Method 'pprint(int[], java.lang.String)' is never used
Warning:Warning:line (950)Local variable 'description' hides field in class 'Encoder'
Warning:Warning:line (1,030)Explicit type argument String, Tuple can be replaced with <>
Warning:Warning:line (1,031)Explicit type argument String can be replaced with <>
Warning:Warning:line (1,036)Local variable 'encoders' hides field in class 'Encoder'
Warning:Warning:line (1,040)Variable 'nextOffset' initializer '0' is redundant
Warning:Warning:line (1,112)Explicit type argument EncoderResult can be replaced with <>
Warning:Warning:line (1,115)Variable 'nextBucketOffset' initializer '-1' is redundant
Warning:Warning:line (1,116)Variable 'childEncoders' initializer 'null' is redundant
Warning:Warning:line (1,165)Explicit type argument EncoderResult can be replaced with <>
Warning:Warning:line (1,167)Local variable 'encoders' hides field in class 'Encoder'
Warning:Warning:line (1,194)Local variable 'encoders' hides field in class 'Encoder'
Warning:Warning:line (1,197)Variable 'closeness' initializer '-1' is redundant
Warning:Warning:line (1,204)Casting 'err' to 'double' is redundant
Warning:Warning:line (1,239)Casting 'matrix.getObject(i)' to 'int[]' is redundant
Error:Error:line (1,258)Cannot resolve symbol ''
Z:\projects\development\htm.java\src\main\java\org\numenta\nupic\encoders\SDRCategoryEncoder.java
Warning:Warning:line (379)Unchecked cast: 'java.util.Set<java.lang.String>' to 'java.util.Collection'
Warning:Warning:line (483)Method 'encoderSeed(int)' is never used

SpatialPoolerTest.testGetNeighbours failed with ifinite recurse

java.lang.OutOfMemoryError: Java heap space
at gnu.trove.list.array.TIntArrayList.(TIntArrayList.java:91)
at gnu.trove.list.array.TIntArrayList.(TIntArrayList.java:67)
at org.numenta.nupic.util.ArrayUtils.recurseAssembleCoordinates(ArrayUtils.java:671)
at org.numenta.nupic.util.ArrayUtils.recurseAssembleCoordinates(ArrayUtils.java:671)
at org.numenta.nupic.util.ArrayUtils.recurseAssembleCoordinates(ArrayUtils.java:671)
at org.numenta.nupic.util.ArrayUtils.recurseAssembleCoordinates(ArrayUtils.java:671)
at org.numenta.nupic.util.ArrayUtils.recurseAssembleCoordinates(ArrayUtils.java:671)
at org.numenta.nupic.util.ArrayUtils.recurseAssembleCoordinates(ArrayUtils.java:671)
at org.numenta.nupic.util.ArrayUtils.recurseAssembleCoordinates(ArrayUtils.java:671)
at org.numenta.nupic.util.ArrayUtils.recurseAssembleCoordinates(ArrayUtils.java:671)
at org.numenta.nupic.util.ArrayUtils.recurseAssembleCoordinates(ArrayUtils.java:671)
at org.numenta.nupic.util.ArrayUtils.recurseAssembleCoordinates(ArrayUtils.java:671)
at org.numenta.nupic.util.ArrayUtils.recurseAssembleCoordinates(ArrayUtils.java:671)
at org.numenta.nupic.util.ArrayUtils.recurseAssembleCoordinates(ArrayUtils.java:671)
at org.numenta.nupic.util.ArrayUtils.recurseAssembleCoordinates(ArrayUtils.java:671)
at org.numenta.nupic.util.ArrayUtils.recurseAssembleCoordinates(ArrayUtils.java:671)
at org.numenta.nupic.util.ArrayUtils.recurseAssembleCoordinates(ArrayUtils.java:671)
at org.numenta.nupic.util.ArrayUtils.recurseAssembleCoordinates(ArrayUtils.java:671)
at org.numenta.nupic.util.ArrayUtils.recurseAssembleCoordinates(ArrayUtils.java:671)
at org.numenta.nupic.util.ArrayUtils.recurseAssembleCoordinates(ArrayUtils.java:671)
at org.numenta.nupic.util.ArrayUtils.recurseAssembleCoordinates(ArrayUtils.java:671)
at org.numenta.nupic.util.ArrayUtils.recurseAssembleCoordinates(ArrayUtils.java:671)
at org.numenta.nupic.util.ArrayUtils.recurseAssembleCoordinates(ArrayUtils.java:671)
at org.numenta.nupic.util.ArrayUtils.recurseAssembleCoordinates(ArrayUtils.java:671)
at org.numenta.nupic.util.ArrayUtils.recurseAssembleCoordinates(ArrayUtils.java:671)
at org.numenta.nupic.util.ArrayUtils.recurseAssembleCoordinates(ArrayUtils.java:671)
at org.numenta.nupic.util.ArrayUtils.recurseAssembleCoordinates(ArrayUtils.java:671)
at org.numenta.nupic.util.ArrayUtils.recurseAssembleCoordinates(ArrayUtils.java:671)
at org.numenta.nupic.util.ArrayUtils.recurseAssembleCoordinates(ArrayUtils.java:671)
at org.numenta.nupic.util.ArrayUtils.recurseAssembleCoordinates(ArrayUtils.java:671)
at org.numenta.nupic.util.ArrayUtils.recurseAssembleCoordinates(ArrayUtils.java:671)
at org.numenta.nupic.util.ArrayUtils.recurseAssembleCoordinates(ArrayUtils.java:671)

Change Encoder Library to be strict stateful 00

The Encoder base class and ScalarEncoder were written to use the same "functional" pattern as the SpatialPooler and TemporalMemory. This pattern doesn't apply to the encoders and would be best implemented in the regular OO style. Requires re-writing all method signatures in classes and tests

ScalarEncoder needs initialization and tests for same

We need a basic Encoder for experimentation that will be easy to work with. So I decided to do the SpatialEncoder. The RandomXXX and GEOXXX will follow. This will help me get familiar with encoders also and allow for the Encoder base class hierarchy development to be correct and checked.

Code documentation needs updating

Java Docs have not been generated since the beginning of development and need to be updated. Also, Matt should be consulted for Doxygen recommendations.

Support multiple dimensions for SparseBinaryMatrix

David,

I looked into SparseBinaryMatrix and it looks like it restricted to 2D(doesn't support more than 2 dimensions).
Please check https://github.com/solovyevk/htm.java/tree/test-sparse-matrix where I extend SparseBinaryMatrixTest to test backing and slicing for multiple dimensional matrix.
Failed to set value for 3D here org/numenta/nupic/util/SparseBinaryMatrix.java:144 because slice by first coordinate assumed to be a vector, not the case for 3D.
In some places looks like it is working with multiple dimensions, but loop here (org/numenta/nupic/util/SparseBinaryMatrix.java:64) not used, but last iteration result.
I'm going to modify it to support any number of dimensions. Let me know if you OK with it :)

htm.java needs DeltaEncoder

This class and test should be created to follow the same idioms and structure as the Encoder.java and ScalarEncoder.java class. The CategoryEncoder, can be used as an example.

Should use only the Joda Date Library

htm.java needs a GEOSpatialCoordinateEncoder

This class and test should be created to follow the same idioms and structure as the Encoder.java and ScalarEncoder.java class. The CategoryEncoder, can be used as an example.

This class should extend the CoordinateEncoder which will also have to be created to act as a base class

java.lang.OutOfMemoryError: Java heap space

Running the tests, I kept getting:

java.lang.OutOfMemoryError: Java heap space
    at gnu.trove.list.array.TIntArrayList.<init>(TIntArrayList.java:91)
    at gnu.trove.list.array.TIntArrayList.<init>(TIntArrayList.java:67)
    at org.numenta.nupic.util.ArrayUtils.recurseAssembleCoordinates(ArrayUtils.java:668)
    at org.numenta.nupic.util.ArrayUtils.recurseAssembleCoordinates(ArrayUtils.java:668)
    at org.numenta.nupic.util.ArrayUtils.recurseAssembleCoordinates(ArrayUtils.java:668)
    at org.numenta.nupic.util.ArrayUtils.recurseAssembleCoordinates(ArrayUtils.java:668)
    at org.numenta.nupic.util.ArrayUtils.recurseAssembleCoordinates(ArrayUtils.java:668)
    at org.numenta.nupic.util.ArrayUtils.recurseAssembleCoordinates(ArrayUtils.java:668)
    at org.numenta.nupic.util.ArrayUtils.recurseAssembleCoordinates(ArrayUtils.java:668)
    at org.numenta.nupic.util.ArrayUtils.recurseAssembleCoordinates(ArrayUtils.java:668

testGetNeighborsND is the only test that fails.

I've tried:

export JAVA_OPTS=-Xms1024m -Xmx1024m
mvn test
gradle test

No luck. The recursion doesn't look right.

Consider alternatives to int arrays for bits ?

Maybe this has already been discussed, decided... but just in case.

We're using int[] arrays for storing zeros and ones, e.g. encoder output, and I presume the rest of the machinery work directly on these int[] arrays. I bring it up because each entry in the array is using 32 bits when it could use only 1. Now reading up a bit I can see how wasting the space might be useful to align better with bus width, but my guess is we would rather use a 64 bit wide value if that is our aim.

http://stackoverflow.com/questions/8804435/alternative-to-java-bitset-with-array-like-performance

https://github.com/lemire/RoaringBitmap

Remove coveralls.io repo token from pom.xml

Since you are using travis for your builds you don't actually need to supply a token - but if you did you should pass it via a mvn command line parameter -DrepoToken

Not a huge huge issue, as it would just let people submit "false" code coverage reports (in this case) - but I would still get your token changed/updated by coveralls.

All Classes Need Numenta Copyright Notice

A lot of classes have been added since the last time these notices were added. These should be added to the header of each class. As an example, please use one of the classes that already contains the copyright notice and copy it and paste it into all the new classes.

htm.java needs a MultiEncoder

This class and test should be created to follow the same idioms and structure as the Encoder.java and ScalarEncoder.java class. The CategoryEncoder, can be used as an example.

Since this class is a "composite" of others, its understood to be ongoing, and other encoders should be added to it as they get developed.

This task is for a super enterprising individual who will stick with the effort and update as needed.

HTM.java needs to be buildable by JDK 1.8

Travis CI and build support constructs need to allow JDK 1.8 build, using JDK 1.7 as a lower bound requirement. All support files and build configurations need to be adjusted to allow the build to take place on JDK 1.8 with JDK 1.7 code compliance minimum.

htm.java needs a DateEncoder

This class and test should be created to follow the same idioms and structure as the Encoder.java and ScalarEncoder.java class. The CategoryEncoder, can be used as an example.

Implement encoder functionality

Next step to Java port is to add encoder functionality. This will be an ongoing issue until base encoder class and derivative classes (i.e. GEOSpatialEncoder) have be completed - and so will have an associated branch.

This class is a "catch-all" for all Encoder development work

Encoders should employ "Builder" Pattern

The initialization of the classes in the encoder package should use the "builder" pattern to initialize. The ScalarEncoder and CategoryEncoder should be transformed and serve as an example for the initialization idiom

ScalarEncoder.topDownComputer is returning incorrect value

Following this example: https://github.com/numenta/nupic/blob/master/tests/unit/py2/nupic/encoders/multi_test.py , lines 75-83.

Executing the following commands:

ScalarEncoder dow = ScalarEncoder.builder()
                .w(3)
                .resolution(1)
                .minVal(1)
                .maxVal(8)
                .periodic(true)
                .name("day of week")
                .forced(true)
                .build();
EncodeResult res = dow.topDownCompute(dow.encode(4.)).get(0);

should result in res.getValue() == 4.0; however, the actual result is

res = EncoderResult(value=4.5, scalar=4.5, encoding=[0, 0, 1, 1, 1, 0, 0]

The other example (involving myval=6) works as expected.

Endless loop in certain scenarios for ScalarEncoder's topDownCompute

Maybe it's me, but it seems like when I create a ScalarEncoder with, say, minVal = 0.0 it looks like one of the following happens:
The encoder is put into incorrect state right from the start with resolution set to 0 by default and not changed due to a check in initEncoder. Is 0.0 prohibited or is it put there to check for default values?
0.0 seems like a valid value to me, it's that they can't be both 0.0 with maxVal that would make sense to me. This results in an endless loop when calling topDownCompute as it iterates with 0.0 increment - that is forever.

It looks as if the invariants are not properly preserved, if I did something wrong during construction a RuntimeException should have been thrown when invoking ScalarEncoder.build() method.

The following test results in OutOfMemoryError due to endless append operation to an primitive collection:

@Test
    public void endlessLoopInTopDownCompute() {
        ScalarEncoder encoder = ScalarEncoder.builder()
            .w( 5 )
            .n( 10 )
            .forced( true )
            .minVal( 0 )
            .maxVal( 100 )
            .build();
        encoder.topDownCompute( new int[] { 0, 0, 0, 0, 0, 0, 0, 0, 0, 1 } );
    }

htm.java needs a SDRCategoryEncoder

This class and test should be created to follow the same idioms and structure as the Encoder.java and ScalarEncoder.java class. The CategoryEncoder, can be used as an example.

HTM.java needs a KNNClassifier

The KNNClassifier is required in order to have a full set of classifiers. In order to complete this, the swig wrapper class mapping of method implementations need to be identified. Namely these:

NearestNeighbor32: <-- I need to be able to view the implementation of these methods which I haven't been able to find in the NearestNeighbor.hpp file or any of their includes. I think that they are given aliases by swig generation or something? Anyway, if someone can point me to these I can begin work.

def rowDist(*args, **kwargs):
    """rowDist(self, row, xIn) -> Real"""
    return _math._NearestNeighbor32_rowDist(*args, **kwargs)

def vecLpDist(*args, **kwargs):
    """vecLpDist(self, p, xIn, take_root=True) -> PyObject"""
    return _math._NearestNeighbor32_vecLpDist(*args, **kwargs)

def LpNearest(*args, **kwargs):
    """LpNearest(self, p, row, k=1, take_root=True) -> PyObject"""
    return _math._NearestNeighbor32_LpNearest(*args, **kwargs)

def closestLp_w(*args, **kwargs):
    """closestLp_w(self, p, row) -> PyObject"""
    return _math._NearestNeighbor32_closestLp_w(*args, **kwargs)

def closestDot(*args, **kwargs):
    """closestDot(self, row) -> PyObject"""
    return _math._NearestNeighbor32_closestDot(*args, **kwargs)

def projLpNearest(*args, **kwargs):
    """projLpNearest(self, p, py_x, k=1, take_root=False) -> PyObject"""
    return _math._NearestNeighbor32_projLpNearest(*args, **kwargs)

def projRbf(*args, **kwargs):
    """projRbf(self, p, k, py_x) -> PyObject"""
    return _math._NearestNeighbor32_projRbf(*args, **kwargs)

HTM.java needs auto-javadoc generation

The javadoc shell script jdoc.sh should be used to automatically rebuild javadocs upon CI cycling. The jdoc.sh file should also have the functionality added to build a htmjava_docs.jar file. (Eventually, this stuff should be versioned with same versioning as the sister Python revision system to mark which "version" of the Python NuPIC distribution the code corresponds with.)

This should all be done automatically.

Fix SpatialPooler java doc

The example usage coding steps in the class java doc needs to be surrounded in <pre> </pre> tags so that the formatting is preserved.

htm.java needs an LogEncoder

This class and test should be created to follow the same idioms and structure as the Encoder.java and ScalarEncoder.java class. The CategoryEncoder, can be used as an example.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.