{"action":"created","comment":{"url":"https://api.github.com/repos/numenta/nupic.fluent/pulls/comments/36204096","id":36204096,"diff_hunk":"@@ -75,10 +75,47 @@ def logEncodings(self, patterns, path):\n       jp[\"pattern\"][\"bitmap\"] = jp[\"pattern\"].get(\"bitmap\", None).tolist()\n       jp[\"labels\"] = jp.get(\"labels\", None).tolist()\n \n-    with open(os.path.join(path, \"encoding_log.txt\"), \"w\") as f:\n+    with open(os.path.join(dirName, \"encoding_log.txt\"), \"w\") as f:\n       f.write(json.dumps(jsonPatterns, indent=1))\n \n \n+  def writeOutCategories(self, dirName, comparisons=None, labelRefs=None):\n+    \"\"\"\n+    For models which define categories with bitmaps, log the categories (and\n+    their relative distances) to a JSON specified by the dirName. The JSON will\n+    contain the dict of category bitmaps, and if specified, dicts of label\n+    references and category bitmap comparisons.\n+    \"\"\"\n+    if not hasattr(self, \"categoryBitmaps\"):\n+      raise TypeError(\"This model does not have category encodings compatible \"\n+                      \"for logging.\")\n+\n+    if not os.path.isdir(dirName):\n+      raise ValueError(\"Invalid path to write file.\")\n+\n+    with open(os.path.join(dirName, \"category_distances.json\"), \"w\") as f:\n+      if labelRefs:\n+        json.dump(\n+            dict(enumerate(labelRefs)),\n+            f,\n+            sort_keys=False,\n+            indent=2,\n+            separators=(',', ': '))","path":"fluent/models/classification_model.py","position":42,"original_position":42,"commit_id":"28923a05d0080b337a58d17f9de251f627331a3b","original_commit_id":"28923a05d0080b337a58d17f9de251f627331a3b","user":{"login":"scottpurdy","id":239726,"avatar_url":"https://avatars.githubusercontent.com/u/239726?v=3","gravatar_id":"","url":"https://api.github.com/users/scottpurdy","html_url":"https://github.com/scottpurdy","followers_url":"https://api.github.com/users/scottpurdy/followers","following_url":"https://api.github.com/users/scottpurdy/following{/other_user}","gists_url":"https://api.github.com/users/scottpurdy/gists{/gist_id}","starred_url":"https://api.github.com/users/scottpurdy/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/scottpurdy/subscriptions","organizations_url":"https://api.github.com/users/scottpurdy/orgs","repos_url":"https://api.github.com/users/scottpurdy/repos","events_url":"https://api.github.com/users/scottpurdy/events{/privacy}","received_events_url":"https://api.github.com/users/scottpurdy/received_events","type":"User","site_admin":false},"body":"double quotes","created_at":"2015-08-04T15:45:50Z","updated_at":"2015-08-04T15:45:50Z","html_url":"https://github.com/numenta/nupic.fluent/pull/126#discussion_r36204096","pull_request_url":"https://api.github.com/repos/numenta/nupic.fluent/pulls/126","_links":{"self":{"href":"https://api.github.com/repos/numenta/nupic.fluent/pulls/comments/36204096"},"html":{"href":"https://github.com/numenta/nupic.fluent/pull/126#discussion_r36204096"},"pull_request":{"href":"https://api.github.com/repos/numenta/nupic.fluent/pulls/126"}}},"pull_request":{"url":"https://api.github.com/repos/numenta/nupic.fluent/pulls/126","id":41516028,"html_url":"https://github.com/numenta/nupic.fluent/pull/126","diff_url":"https://github.com/numenta/nupic.fluent/pull/126.diff","patch_url":"https://github.com/numenta/nupic.fluent/pull/126.patch","issue_url":"https://api.github.com/repos/numenta/nupic.fluent/issues/126","number":126,"state":"open","locked":false,"title":"Compare category bitmaps","user":{"login":"BoltzmannBrain","id":8323700,"avatar_url":"https://avatars.githubusercontent.com/u/8323700?v=3","gravatar_id":"","url":"https://api.github.com/users/BoltzmannBrain","html_url":"https://github.com/BoltzmannBrain","followers_url":"https://api.github.com/users/BoltzmannBrain/followers","following_url":"https://api.github.com/users/BoltzmannBrain/following{/other_user}","gists_url":"https://api.github.com/users/BoltzmannBrain/gists{/gist_id}","starred_url":"https://api.github.com/users/BoltzmannBrain/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/BoltzmannBrain/subscriptions","organizations_url":"https://api.github.com/users/BoltzmannBrain/orgs","repos_url":"https://api.github.com/users/BoltzmannBrain/repos","events_url":"https://api.github.com/users/BoltzmannBrain/events{/privacy}","received_events_url":"https://api.github.com/users/BoltzmannBrain/received_events","type":"User","site_admin":false},"body":"","created_at":"2015-08-03T22:17:26Z","updated_at":"2015-08-04T15:45:50Z","closed_at":null,"merged_at":null,"merge_commit_sha":"64728793bbd9e49359d4fd55310e7b022e3d9887","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/numenta/nupic.fluent/pulls/126/commits","review_comments_url":"https://api.github.com/repos/numenta/nupic.fluent/pulls/126/comments","review_comment_url":"https://api.github.com/repos/numenta/nupic.fluent/pulls/comments{/number}","comments_url":"https://api.github.com/repos/numenta/nupic.fluent/issues/126/comments","statuses_url":"https://api.github.com/repos/numenta/nupic.fluent/statuses/28923a05d0080b337a58d17f9de251f627331a3b","head":{"label":"BoltzmannBrain:compare_categories","ref":"compare_categories","sha":"28923a05d0080b337a58d17f9de251f627331a3b","user":{"login":"BoltzmannBrain","id":8323700,"avatar_url":"https://avatars.githubusercontent.com/u/8323700?v=3","gravatar_id":"","url":"https://api.github.com/users/BoltzmannBrain","html_url":"https://github.com/BoltzmannBrain","followers_url":"https://api.github.com/users/BoltzmannBrain/followers","following_url":"https://api.github.com/users/BoltzmannBrain/following{/other_user}","gists_url":"https://api.github.com/users/BoltzmannBrain/gists{/gist_id}","starred_url":"https://api.github.com/users/BoltzmannBrain/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/BoltzmannBrain/subscriptions","organizations_url":"https://api.github.com/users/BoltzmannBrain/orgs","repos_url":"https://api.github.com/users/BoltzmannBrain/repos","events_url":"https://api.github.com/users/BoltzmannBrain/events{/privacy}","received_events_url":"https://api.github.com/users/BoltzmannBrain/received_events","type":"User","site_admin":false},"repo":{"id":34636415,"name":"nupic.fluent","full_name":"BoltzmannBrain/nupic.fluent","owner":{"login":"BoltzmannBrain","id":8323700,"avatar_url":"https://avatars.githubusercontent.com/u/8323700?v=3","gravatar_id":"","url":"https://api.github.com/users/BoltzmannBrain","html_url":"https://github.com/BoltzmannBrain","followers_url":"https://api.github.com/users/BoltzmannBrain/followers","following_url":"https://api.github.com/users/BoltzmannBrain/following{/other_user}","gists_url":"https://api.github.com/users/BoltzmannBrain/gists{/gist_id}","starred_url":"https://api.github.com/users/BoltzmannBrain/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/BoltzmannBrain/subscriptions","organizations_url":"https://api.github.com/users/BoltzmannBrain/orgs","repos_url":"https://api.github.com/users/BoltzmannBrain/repos","events_url":"https://api.github.com/users/BoltzmannBrain/events{/privacy}","received_events_url":"https://api.github.com/users/BoltzmannBrain/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/BoltzmannBrain/nupic.fluent","description":"A platform for building language / NLP-based applications using NuPIC and Cortical.IO.","fork":true,"url":"https://api.github.com/repos/BoltzmannBrain/nupic.fluent","forks_url":"https://api.github.com/repos/BoltzmannBrain/nupic.fluent/forks","keys_url":"https://api.github.com/repos/BoltzmannBrain/nupic.fluent/keys{/key_id}","collaborators_url":"https://api.github.com/repos/BoltzmannBrain/nupic.fluent/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/BoltzmannBrain/nupic.fluent/teams","hooks_url":"https://api.github.com/repos/BoltzmannBrain/nupic.fluent/hooks","issue_events_url":"https://api.github.com/repos/BoltzmannBrain/nupic.fluent/issues/events{/number}","events_url":"https://api.github.com/repos/BoltzmannBrain/nupic.fluent/events","assignees_url":"https://api.github.com/repos/BoltzmannBrain/nupic.fluent/assignees{/user}","branches_url":"https://api.github.com/repos/BoltzmannBrain/nupic.fluent/branches{/branch}","tags_url":"https://api.github.com/repos/BoltzmannBrain/nupic.fluent/tags","blobs_url":"https://api.github.com/repos/BoltzmannBrain/nupic.fluent/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/BoltzmannBrain/nupic.fluent/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/BoltzmannBrain/nupic.fluent/git/refs{/sha}","trees_url":"https://api.github.com/repos/BoltzmannBrain/nupic.fluent/git/trees{/sha}","statuses_url":"https://api.github.com/repos/BoltzmannBrain/nupic.fluent/statuses/{sha}","languages_url":"https://api.github.com/repos/BoltzmannBrain/nupic.fluent/languages","stargazers_url":"https://api.github.com/repos/BoltzmannBrain/nupic.fluent/stargazers","contributors_url":"https://api.github.com/repos/BoltzmannBrain/nupic.fluent/contributors","subscribers_url":"https://api.github.com/repos/BoltzmannBrain/nupic.fluent/subscribers","subscription_url":"https://api.github.com/repos/BoltzmannBrain/nupic.fluent/subscription","commits_url":"https://api.github.com/repos/BoltzmannBrain/nupic.fluent/commits{/sha}","git_commits_url":"https://api.github.com/repos/BoltzmannBrain/nupic.fluent/git/commits{/sha}","comments_url":"https://api.github.com/repos/BoltzmannBrain/nupic.fluent/comments{/number}","issue_comment_url":"https://api.github.com/repos/BoltzmannBrain/nupic.fluent/issues/comments{/number}","contents_url":"https://api.github.com/repos/BoltzmannBrain/nupic.fluent/contents/{+path}","compare_url":"https://api.github.com/repos/BoltzmannBrain/nupic.fluent/compare/{base}...{head}","merges_url":"https://api.github.com/repos/BoltzmannBrain/nupic.fluent/merges","archive_url":"https://api.github.com/repos/BoltzmannBrain/nupic.fluent/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/BoltzmannBrain/nupic.fluent/downloads","issues_url":"https://api.github.com/repos/BoltzmannBrain/nupic.fluent/issues{/number}","pulls_url":"https://api.github.com/repos/BoltzmannBrain/nupic.fluent/pulls{/number}","milestones_url":"https://api.github.com/repos/BoltzmannBrain/nupic.fluent/milestones{/number}","notifications_url":"https://api.github.com/repos/BoltzmannBrain/nupic.fluent/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/BoltzmannBrain/nupic.fluent/labels{/name}","releases_url":"https://api.github.com/repos/BoltzmannBrain/nupic.fluent/releases{/id}","created_at":"2015-04-26T23:35:49Z","updated_at":"2015-05-04T18:15:31Z","pushed_at":"2015-08-04T15:35:52Z","git_url":"git://github.com/BoltzmannBrain/nupic.fluent.git","ssh_url":"git@github.com:BoltzmannBrain/nupic.fluent.git","clone_url":"https://github.com/BoltzmannBrain/nupic.fluent.git","svn_url":"https://github.com/BoltzmannBrain/nupic.fluent","homepage":"","size":3619,"stargazers_count":0,"watchers_count":0,"language":"Python","has_issues":false,"has_downloads":true,"has_wiki":true,"has_pages":false,"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":"90b78dd90895dea818b98ee92ecf623ff9429bf1","user":{"login":"numenta","id":1039191,"avatar_url":"https://avatars.githubusercontent.com/u/1039191?v=3","gravatar_id":"","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":17183816,"name":"nupic.fluent","full_name":"numenta/nupic.fluent","owner":{"login":"numenta","id":1039191,"avatar_url":"https://avatars.githubusercontent.com/u/1039191?v=3","gravatar_id":"","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/nupic.fluent","description":"A platform for building language / NLP-based applications using NuPIC and Cortical.io.","fork":false,"url":"https://api.github.com/repos/numenta/nupic.fluent","forks_url":"https://api.github.com/repos/numenta/nupic.fluent/forks","keys_url":"https://api.github.com/repos/numenta/nupic.fluent/keys{/key_id}","collaborators_url":"https://api.github.com/repos/numenta/nupic.fluent/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/numenta/nupic.fluent/teams","hooks_url":"https://api.github.com/repos/numenta/nupic.fluent/hooks","issue_events_url":"https://api.github.com/repos/numenta/nupic.fluent/issues/events{/number}","events_url":"https://api.github.com/repos/numenta/nupic.fluent/events","assignees_url":"https://api.github.com/repos/numenta/nupic.fluent/assignees{/user}","branches_url":"https://api.github.com/repos/numenta/nupic.fluent/branches{/branch}","tags_url":"https://api.github.com/repos/numenta/nupic.fluent/tags","blobs_url":"https://api.github.com/repos/numenta/nupic.fluent/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/numenta/nupic.fluent/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/numenta/nupic.fluent/git/refs{/sha}","trees_url":"https://api.github.com/repos/numenta/nupic.fluent/git/trees{/sha}","statuses_url":"https://api.github.com/repos/numenta/nupic.fluent/statuses/{sha}","languages_url":"https://api.github.com/repos/numenta/nupic.fluent/languages","stargazers_url":"https://api.github.com/repos/numenta/nupic.fluent/stargazers","contributors_url":"https://api.github.com/repos/numenta/nupic.fluent/contributors","subscribers_url":"https://api.github.com/repos/numenta/nupic.fluent/subscribers","subscription_url":"https://api.github.com/repos/numenta/nupic.fluent/subscription","commits_url":"https://api.github.com/repos/numenta/nupic.fluent/commits{/sha}","git_commits_url":"https://api.github.com/repos/numenta/nupic.fluent/git/commits{/sha}","comments_url":"https://api.github.com/repos/numenta/nupic.fluent/comments{/number}","issue_comment_url":"https://api.github.com/repos/numenta/nupic.fluent/issues/comments{/number}","contents_url":"https://api.github.com/repos/numenta/nupic.fluent/contents/{+path}","compare_url":"https://api.github.com/repos/numenta/nupic.fluent/compare/{base}...{head}","merges_url":"https://api.github.com/repos/numenta/nupic.fluent/merges","archive_url":"https://api.github.com/repos/numenta/nupic.fluent/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/numenta/nupic.fluent/downloads","issues_url":"https://api.github.com/repos/numenta/nupic.fluent/issues{/number}","pulls_url":"https://api.github.com/repos/numenta/nupic.fluent/pulls{/number}","milestones_url":"https://api.github.com/repos/numenta/nupic.fluent/milestones{/number}","notifications_url":"https://api.github.com/repos/numenta/nupic.fluent/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/numenta/nupic.fluent/labels{/name}","releases_url":"https://api.github.com/repos/numenta/nupic.fluent/releases{/id}","created_at":"2014-02-25T18:41:17Z","updated_at":"2015-08-02T02:56:24Z","pushed_at":"2015-08-04T15:35:52Z","git_url":"git://github.com/numenta/nupic.fluent.git","ssh_url":"git@github.com:numenta/nupic.fluent.git","clone_url":"https://github.com/numenta/nupic.fluent.git","svn_url":"https://github.com/numenta/nupic.fluent","homepage":"","size":6524,"stargazers_count":22,"watchers_count":22,"language":"Python","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":18,"mirror_url":null,"open_issues_count":20,"forks":18,"open_issues":20,"watchers":22,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/numenta/nupic.fluent/pulls/126"},"html":{"href":"https://github.com/numenta/nupic.fluent/pull/126"},"issue":{"href":"https://api.github.com/repos/numenta/nupic.fluent/issues/126"},"comments":{"href":"https://api.github.com/repos/numenta/nupic.fluent/issues/126/comments"},"review_comments":{"href":"https://api.github.com/repos/numenta/nupic.fluent/pulls/126/comments"},"review_comment":{"href":"https://api.github.com/repos/numenta/nupic.fluent/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/numenta/nupic.fluent/pulls/126/commits"},"statuses":{"href":"https://api.github.com/repos/numenta/nupic.fluent/statuses/28923a05d0080b337a58d17f9de251f627331a3b"}}}}