GitHub PullRequestReviewCommentEvent at 2014-08-24 22:12:07
Repository: htm.java
Actor: rhyolight
Payload: {"action":"created","comment":{"url":"https://api.github.com/repos/numenta/htm.java/pulls/comments/16638282","id":16638282,"diff_hunk":"@@ -0,0 +1,581 @@\n+package org.numenta.nupic.research;\n+\n+import gnu.trove.list.array.TIntArrayList;\n+\n+import org.numenta.nupic.data.SparseBinaryMatrix;\n+import org.numenta.nupic.data.SparseDoubleMatrix;\n+import org.numenta.nupic.data.SparseMatrix;\n+import org.numenta.nupic.data.SparseObjectMatrix;\n+import org.numenta.nupic.model.Column;\n+import org.numenta.nupic.model.Lattice;\n+\n+public class SpatialLattice extends Lattice {\n+\t\n+\tprivate int potentialRadius = 16;\n+\tprivate double potentialPct = 0.5;\n+\tprivate boolean globalInhibition = false;\n+\tprivate double localAreaDensity = -1.0;\n+\tprivate double numActiveColumnsPerInhArea;\n+\tprivate double stimulusThreshold = 0;\n+\tprivate double synPermInactiveDec = 0.01;\n+\tprivate double synPermActiveInc = 0.10;\n+\tprivate double synPermConnected = 0.10;\n+\tprivate double minPctOverlapDutyCycle = 0.001;\n+\tprivate double minPctActiveDutyCycle = 0.001;\n+\tprivate double dutyCyclePeriod = 1000;\n+\tprivate double maxBoost = 10.0;\n+\tprivate int spVerbosity = 0;\n+\tprivate int seed;\n+\t\n+\tprivate int numInputs = 1;  //product of input dimensions\n+\tprivate int numColumns = 1;\t//product of column dimensions\n+\t\n+\t//Extra parameter settings\n+\tprivate double synPermMin = 0.0;\n+\tprivate double synPermMax = 1.0;\n+\tprivate double synPermTrimThreshold = synPermActiveInc / 2.0;\n+\tprivate int updatePeriod = 50;\n+\tprivate double initConnectedPct = 0.5;\n+\t\n+\t//Internal state\n+\tprivate double version = 1.0;\n+\tprivate int interationNum = 0;\n+\tprivate int iterationLearnNum = 0;\n+\t/**\n+\t * Store the set of all inputs that are within each column's potential pool.\n+     * 'potentialPools' is a matrix, whose rows represent cortical columns, and\n+     * whose columns represent the input bits. if potentialPools[i][j] == 1,\n+     * then input bit 'j' is in column 'i's potential pool. A column can only be\n+     * connected to inputs in its potential pool. The indices refer to a\n+     * flattened version of both the inputs and columns. Namely, irrespective\n+     * of the topology of the inputs and columns, they are treated as being a\n+     * one dimensional array. Since a column is typically connected to only a\n+     * subset of the inputs, many of the entries in the matrix are 0. Therefore\n+     * the potentialPool matrix is stored using the SparseBinaryMatrix\n+     * class, to reduce memory footprint and computation time of algorithms that\n+     * require iterating over the data structure.\n+     */\n+\tprivate SparseObjectMatrix<TIntArrayList> potentialPools;\n+\t/**\n+\t * Initialize the permanences for each column. Similar to the\n+     * 'self._potentialPools', the permanences are stored in a matrix whose rows\n+     * represent the cortical columns, and whose columns represent the input\n+     * bits. If self._permanences[i][j] = 0.2, then the synapse connecting\n+     * cortical column 'i' to input bit 'j'  has a permanence of 0.2. Here we\n+     * also use the SparseMatrix class to reduce the memory footprint and\n+     * computation time of algorithms that require iterating over the data\n+     * structure. This permanence matrix is only allowed to have non-zero\n+     * elements where the potential pool is non-zero.\n+     */\n+\tprivate SparseDoubleMatrix permanences;\n+\t/**\n+\t * Initialize a tiny random tie breaker. This is used to determine winning\n+     * columns where the overlaps are identical.\n+     */\n+\tprivate SparseDoubleMatrix tieBreaker;\n+\t/**\n+\t * 'self._connectedSynapses' is a similar matrix to 'self._permanences'\n+     * (rows represent cortical columns, columns represent input bits) whose\n+     * entries represent whether the cortical column is connected to the input\n+     * bit, i.e. its permanence value is greater than 'synPermConnected'. While\n+     * this information is readily available from the 'self._permanence' matrix,\n+     * it is stored separately for efficiency purposes.\n+     */\n+\tprivate SparseBinaryMatrix connectedSynapses;\n+\t/** \n+\t * Stores the number of connected synapses for each column. This is simply\n+     * a sum of each row of 'self._connectedSynapses'. again, while this\n+     * information is readily available from 'self._connectedSynapses', it is\n+     * stored separately for efficiency purposes.\n+\t */\n+\tprivate int[] connectedCounts = new int[numColumns];\n+\t/**\n+\t * The inhibition radius determines the size of a column's local\n+     * neighborhood. of a column. A cortical column must overcome the overlap\n+     * score of columns in his neighborhood in order to become actives. This\n+     * radius is updated every learning round. It grows and shrinks with the\n+     * average number of connected synapses per column.\n+\t */\n+\tprivate int inhibitionRadius = 0;\n+\t\n+\t\n+\t/**\n+\t * Constructs a new {@code SpatialLattice}\n+\t */\n+\tpublic SpatialLattice(Parameters p) {\n+\t\tsuper();\n+\t\t\n+\t\tif(p != null) {\n+\t\t\tParameters.apply(this, p);\n+\t\t}\n+\t\t\n+\t\tmemory = new SparseObjectMatrix<Column>(columnDimensions);\n+\t\tinputMatrix = new SparseBinaryMatrix(inputDimensions);\n+\t\t\n+\t\tfor(int i = 0;i < inputDimensions.length;i++) {\n+\t\t\tnumInputs *= inputDimensions[i];\n+\t\t}\n+\t\tfor(int i = 0;i < columnDimensions.length;i++) {\n+\t\t\tnumColumns *= columnDimensions[i];\n+\t\t}\n+\t\t\n+\t\tpotentialPools = new SparseObjectMatrix<TIntArrayList>(new int[] { numColumns, numInputs } );\n+\t\t\n+\t\tpermanences = new SparseDoubleMatrix(new int[] { numColumns, numInputs } );\n+\t\t\n+\t\ttieBreaker = new SparseDoubleMatrix(new int[] { numColumns, numInputs } );\n+\t\tfor(int i = 0;i < numColumns;i++) {\n+\t\t\tfor(int j = 0;j < numInputs;j++) {\n+\t\t\t\ttieBreaker.set(new int[] { i, j }, 0.01 * random.nextDouble());\n+\t\t\t}\n+\t\t}\n+\t\t/**\n+\t\t * 'self._connectedSynapses' is a similar matrix to 'self._permanences'\n+\t     * (rows represent cortical columns, columns represent input bits) whose\n+\t     * entries represent whether the cortical column is connected to the input\n+\t     * bit, i.e. its permanence value is greater than 'synPermConnected'. While\n+\t     * this information is readily available from the 'self._permanence' matrix,\n+\t     * it is stored separately for efficiency purposes.\n+\t     */\n+\t\tconnectedSynapses = new SparseBinaryMatrix(new int[] { numColumns, numInputs } );","path":"src/main/java/org/numenta/nupic/research/SpatialLattice.java","position":140,"original_position":140,"commit_id":"db8f145909ec1a29322035a7ecf4c24b181bc7ec","original_commit_id":"db8f145909ec1a29322035a7ecf4c24b181bc7ec","user":{"login":"rhyolight","id":15566,"avatar_url":"https://avatars.githubusercontent.com/u/15566?v=2","gravatar_id":"92b95d73c678f23c6060e63bff3dbcbd","url":"https://api.github.com/users/rhyolight","html_url":"https://github.com/rhyolight","followers_url":"https://api.github.com/users/rhyolight/followers","following_url":"https://api.github.com/users/rhyolight/following{/other_user}","gists_url":"https://api.github.com/users/rhyolight/gists{/gist_id}","starred_url":"https://api.github.com/users/rhyolight/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/rhyolight/subscriptions","organizations_url":"https://api.github.com/users/rhyolight/orgs","repos_url":"https://api.github.com/users/rhyolight/repos","events_url":"https://api.github.com/users/rhyolight/events{/privacy}","received_events_url":"https://api.github.com/users/rhyolight/received_events","type":"User","site_admin":false},"body":"Indentation.","created_at":"2014-08-24T22:12:07Z","updated_at":"2014-08-24T22:12:07Z","html_url":"https://github.com/numenta/htm.java/pull/13#discussion_r16638282","pull_request_url":"https://api.github.com/repos/numenta/htm.java/pulls/13","_links":{"self":{"href":"https://api.github.com/repos/numenta/htm.java/pulls/comments/16638282"},"html":{"href":"https://github.com/numenta/htm.java/pull/13#discussion_r16638282"},"pull_request":{"href":"https://api.github.com/repos/numenta/htm.java/pulls/13"}}},"pull_request":{"url":"https://api.github.com/repos/numenta/htm.java/pulls/13","id":20224348,"html_url":"https://github.com/numenta/htm.java/pull/13","diff_url":"https://github.com/numenta/htm.java/pull/13.diff","patch_url":"https://github.com/numenta/htm.java/pull/13.patch","issue_url":"https://api.github.com/repos/numenta/htm.java/issues/13","number":13,"state":"open","locked":false,"title":"Spatial pooler ongoing dev","user":{"login":"cogmission","id":2340086,"avatar_url":"https://avatars.githubusercontent.com/u/2340086?v=2","gravatar_id":"e868820b8302df4c98d05d36b443ff82","url":"https://api.github.com/users/cogmission","html_url":"https://github.com/cogmission","followers_url":"https://api.github.com/users/cogmission/followers","following_url":"https://api.github.com/users/cogmission/following{/other_user}","gists_url":"https://api.github.com/users/cogmission/gists{/gist_id}","starred_url":"https://api.github.com/users/cogmission/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/cogmission/subscriptions","organizations_url":"https://api.github.com/users/cogmission/orgs","repos_url":"https://api.github.com/users/cogmission/repos","events_url":"https://api.github.com/users/cogmission/events{/privacy}","received_events_url":"https://api.github.com/users/cogmission/received_events","type":"User","site_admin":false},"body":"Refactored a lot to encapsulate state in another class and remove if from the Spatial Pooler - fix tests so they work with new architecture","created_at":"2014-08-24T22:05:20Z","updated_at":"2014-08-24T22:12:07Z","closed_at":null,"merged_at":null,"merge_commit_sha":"63f65b72a73cebca8c599e563a1d41d8c48b80eb","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/numenta/htm.java/pulls/13/commits","review_comments_url":"https://api.github.com/repos/numenta/htm.java/pulls/13/comments","review_comment_url":"https://api.github.com/repos/numenta/htm.java/pulls/comments/{number}","comments_url":"https://api.github.com/repos/numenta/htm.java/issues/13/comments","statuses_url":"https://api.github.com/repos/numenta/htm.java/statuses/db8f145909ec1a29322035a7ecf4c24b181bc7ec","head":{"label":"cogmission:SpatialPooler_Ongoing_Dev","ref":"SpatialPooler_Ongoing_Dev","sha":"db8f145909ec1a29322035a7ecf4c24b181bc7ec","user":{"login":"cogmission","id":2340086,"avatar_url":"https://avatars.githubusercontent.com/u/2340086?v=2","gravatar_id":"e868820b8302df4c98d05d36b443ff82","url":"https://api.github.com/users/cogmission","html_url":"https://github.com/cogmission","followers_url":"https://api.github.com/users/cogmission/followers","following_url":"https://api.github.com/users/cogmission/following{/other_user}","gists_url":"https://api.github.com/users/cogmission/gists{/gist_id}","starred_url":"https://api.github.com/users/cogmission/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/cogmission/subscriptions","organizations_url":"https://api.github.com/users/cogmission/orgs","repos_url":"https://api.github.com/users/cogmission/repos","events_url":"https://api.github.com/users/cogmission/events{/privacy}","received_events_url":"https://api.github.com/users/cogmission/received_events","type":"User","site_admin":false},"repo":{"id":23130933,"name":"htm.java","full_name":"cogmission/htm.java","owner":{"login":"cogmission","id":2340086,"avatar_url":"https://avatars.githubusercontent.com/u/2340086?v=2","gravatar_id":"e868820b8302df4c98d05d36b443ff82","url":"https://api.github.com/users/cogmission","html_url":"https://github.com/cogmission","followers_url":"https://api.github.com/users/cogmission/followers","following_url":"https://api.github.com/users/cogmission/following{/other_user}","gists_url":"https://api.github.com/users/cogmission/gists{/gist_id}","starred_url":"https://api.github.com/users/cogmission/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/cogmission/subscriptions","organizations_url":"https://api.github.com/users/cogmission/orgs","repos_url":"https://api.github.com/users/cogmission/repos","events_url":"https://api.github.com/users/cogmission/events{/privacy}","received_events_url":"https://api.github.com/users/cogmission/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/cogmission/htm.java","description":"Community Platform for Intelligent Computing for Java (CoPIC-J) - a Community-Driven Java port of the Numenta Platform for Intelligent Computing (NuPIC).","fork":true,"url":"https://api.github.com/repos/cogmission/htm.java","forks_url":"https://api.github.com/repos/cogmission/htm.java/forks","keys_url":"https://api.github.com/repos/cogmission/htm.java/keys{/key_id}","collaborators_url":"https://api.github.com/repos/cogmission/htm.java/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/cogmission/htm.java/teams","hooks_url":"https://api.github.com/repos/cogmission/htm.java/hooks","issue_events_url":"https://api.github.com/repos/cogmission/htm.java/issues/events{/number}","events_url":"https://api.github.com/repos/cogmission/htm.java/events","assignees_url":"https://api.github.com/repos/cogmission/htm.java/assignees{/user}","branches_url":"https://api.github.com/repos/cogmission/htm.java/branches{/branch}","tags_url":"https://api.github.com/repos/cogmission/htm.java/tags","blobs_url":"https://api.github.com/repos/cogmission/htm.java/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/cogmission/htm.java/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/cogmission/htm.java/git/refs{/sha}","trees_url":"https://api.github.com/repos/cogmission/htm.java/git/trees{/sha}","statuses_url":"https://api.github.com/repos/cogmission/htm.java/statuses/{sha}","languages_url":"https://api.github.com/repos/cogmission/htm.java/languages","stargazers_url":"https://api.github.com/repos/cogmission/htm.java/stargazers","contributors_url":"https://api.github.com/repos/cogmission/htm.java/contributors","subscribers_url":"https://api.github.com/repos/cogmission/htm.java/subscribers","subscription_url":"https://api.github.com/repos/cogmission/htm.java/subscription","commits_url":"https://api.github.com/repos/cogmission/htm.java/commits{/sha}","git_commits_url":"https://api.github.com/repos/cogmission/htm.java/git/commits{/sha}","comments_url":"https://api.github.com/repos/cogmission/htm.java/comments{/number}","issue_comment_url":"https://api.github.com/repos/cogmission/htm.java/issues/comments/{number}","contents_url":"https://api.github.com/repos/cogmission/htm.java/contents/{+path}","compare_url":"https://api.github.com/repos/cogmission/htm.java/compare/{base}...{head}","merges_url":"https://api.github.com/repos/cogmission/htm.java/merges","archive_url":"https://api.github.com/repos/cogmission/htm.java/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/cogmission/htm.java/downloads","issues_url":"https://api.github.com/repos/cogmission/htm.java/issues{/number}","pulls_url":"https://api.github.com/repos/cogmission/htm.java/pulls{/number}","milestones_url":"https://api.github.com/repos/cogmission/htm.java/milestones{/number}","notifications_url":"https://api.github.com/repos/cogmission/htm.java/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/cogmission/htm.java/labels{/name}","releases_url":"https://api.github.com/repos/cogmission/htm.java/releases{/id}","created_at":"2014-08-20T00:54:27Z","updated_at":"2014-08-23T10:51:18Z","pushed_at":"2014-08-24T22:03:18Z","git_url":"git://github.com/cogmission/htm.java.git","ssh_url":"git@github.com:cogmission/htm.java.git","clone_url":"https://github.com/cogmission/htm.java.git","svn_url":"https://github.com/cogmission/htm.java","homepage":"","size":3102,"stargazers_count":0,"watchers_count":0,"language":"Java","has_issues":false,"has_downloads":true,"has_wiki":true,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"numenta:master","ref":"master","sha":"7857c238592ced0d768c953eb4fbed0ffabea97f","user":{"login":"numenta","id":1039191,"avatar_url":"https://avatars.githubusercontent.com/u/1039191?v=2","gravatar_id":"faac04630eba5ec1aeda8bcbca3ff018","url":"https://api.github.com/users/numenta","html_url":"https://github.com/numenta","followers_url":"https://api.github.com/users/numenta/followers","following_url":"https://api.github.com/users/numenta/following{/other_user}","gists_url":"https://api.github.com/users/numenta/gists{/gist_id}","starred_url":"https://api.github.com/users/numenta/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/numenta/subscriptions","organizations_url":"https://api.github.com/users/numenta/orgs","repos_url":"https://api.github.com/users/numenta/repos","events_url":"https://api.github.com/users/numenta/events{/privacy}","received_events_url":"https://api.github.com/users/numenta/received_events","type":"Organization","site_admin":false},"repo":{"id":22795312,"name":"htm.java","full_name":"numenta/htm.java","owner":{"login":"numenta","id":1039191,"avatar_url":"https://avatars.githubusercontent.com/u/1039191?v=2","gravatar_id":"faac04630eba5ec1aeda8bcbca3ff018","url":"https://api.github.com/users/numenta","html_url":"https://github.com/numenta","followers_url":"https://api.github.com/users/numenta/followers","following_url":"https://api.github.com/users/numenta/following{/other_user}","gists_url":"https://api.github.com/users/numenta/gists{/gist_id}","starred_url":"https://api.github.com/users/numenta/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/numenta/subscriptions","organizations_url":"https://api.github.com/users/numenta/orgs","repos_url":"https://api.github.com/users/numenta/repos","events_url":"https://api.github.com/users/numenta/events{/privacy}","received_events_url":"https://api.github.com/users/numenta/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/numenta/htm.java","description":"Hierarchical Temporal Memory implementation in Java - a Community-Driven Java port of the Numenta Platform for Intelligent Computing (NuPIC).","fork":false,"url":"https://api.github.com/repos/numenta/htm.java","forks_url":"https://api.github.com/repos/numenta/htm.java/forks","keys_url":"https://api.github.com/repos/numenta/htm.java/keys{/key_id}","collaborators_url":"https://api.github.com/repos/numenta/htm.java/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/numenta/htm.java/teams","hooks_url":"https://api.github.com/repos/numenta/htm.java/hooks","issue_events_url":"https://api.github.com/repos/numenta/htm.java/issues/events{/number}","events_url":"https://api.github.com/repos/numenta/htm.java/events","assignees_url":"https://api.github.com/repos/numenta/htm.java/assignees{/user}","branches_url":"https://api.github.com/repos/numenta/htm.java/branches{/branch}","tags_url":"https://api.github.com/repos/numenta/htm.java/tags","blobs_url":"https://api.github.com/repos/numenta/htm.java/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/numenta/htm.java/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/numenta/htm.java/git/refs{/sha}","trees_url":"https://api.github.com/repos/numenta/htm.java/git/trees{/sha}","statuses_url":"https://api.github.com/repos/numenta/htm.java/statuses/{sha}","languages_url":"https://api.github.com/repos/numenta/htm.java/languages","stargazers_url":"https://api.github.com/repos/numenta/htm.java/stargazers","contributors_url":"https://api.github.com/repos/numenta/htm.java/contributors","subscribers_url":"https://api.github.com/repos/numenta/htm.java/subscribers","subscription_url":"https://api.github.com/repos/numenta/htm.java/subscription","commits_url":"https://api.github.com/repos/numenta/htm.java/commits{/sha}","git_commits_url":"https://api.github.com/repos/numenta/htm.java/git/commits{/sha}","comments_url":"https://api.github.com/repos/numenta/htm.java/comments{/number}","issue_comment_url":"https://api.github.com/repos/numenta/htm.java/issues/comments/{number}","contents_url":"https://api.github.com/repos/numenta/htm.java/contents/{+path}","compare_url":"https://api.github.com/repos/numenta/htm.java/compare/{base}...{head}","merges_url":"https://api.github.com/repos/numenta/htm.java/merges","archive_url":"https://api.github.com/repos/numenta/htm.java/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/numenta/htm.java/downloads","issues_url":"https://api.github.com/repos/numenta/htm.java/issues{/number}","pulls_url":"https://api.github.com/repos/numenta/htm.java/pulls{/number}","milestones_url":"https://api.github.com/repos/numenta/htm.java/milestones{/number}","notifications_url":"https://api.github.com/repos/numenta/htm.java/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/numenta/htm.java/labels{/name}","releases_url":"https://api.github.com/repos/numenta/htm.java/releases{/id}","created_at":"2014-08-09T21:12:50Z","updated_at":"2014-08-24T07:08:49Z","pushed_at":"2014-08-23T17:11:53Z","git_url":"git://github.com/numenta/htm.java.git","ssh_url":"git@github.com:numenta/htm.java.git","clone_url":"https://github.com/numenta/htm.java.git","svn_url":"https://github.com/numenta/htm.java","homepage":"","size":3248,"stargazers_count":6,"watchers_count":6,"language":"Java","has_issues":true,"has_downloads":true,"has_wiki":true,"forks_count":3,"mirror_url":null,"open_issues_count":3,"forks":3,"open_issues":3,"watchers":6,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/numenta/htm.java/pulls/13"},"html":{"href":"https://github.com/numenta/htm.java/pull/13"},"issue":{"href":"https://api.github.com/repos/numenta/htm.java/issues/13"},"comments":{"href":"https://api.github.com/repos/numenta/htm.java/issues/13/comments"},"review_comments":{"href":"https://api.github.com/repos/numenta/htm.java/pulls/13/comments"},"review_comment":{"href":"https://api.github.com/repos/numenta/htm.java/pulls/comments/{number}"},"commits":{"href":"https://api.github.com/repos/numenta/htm.java/pulls/13/commits"},"statuses":{"href":"https://api.github.com/repos/numenta/htm.java/statuses/db8f145909ec1a29322035a7ecf4c24b181bc7ec"}}}}