{"action":"created","comment":{"url":"https://api.github.com/repos/nengo/nengo/pulls/comments/44804079","id":44804079,"diff_hunk":"@@ -0,0 +1,462 @@\n+{\n+ \"metadata\": {\n+  \"kernelspec\": {\n+   \"display_name\": \"Python 2\",\n+   \"language\": \"python\",\n+   \"name\": \"python2\"\n+  },\n+  \"language_info\": {\n+   \"codemirror_mode\": {\n+    \"name\": \"ipython\",\n+    \"version\": 2\n+   },\n+   \"file_extension\": \".py\",\n+   \"mimetype\": \"text/x-python\",\n+   \"name\": \"python\",\n+   \"nbconvert_exporter\": \"python\",\n+   \"pygments_lexer\": \"ipython2\",\n+   \"version\": \"2.7.3\"\n+  },\n+  \"name\": \"\"\n+ },\n+ \"nbformat\": 3,\n+ \"nbformat_minor\": 0,\n+ \"worksheets\": [\n+  {\n+   \"cells\": [\n+    {\n+     \"cell_type\": \"markdown\",\n+     \"metadata\": {},\n+     \"source\": [\n+      \"# Associative Memory\\n\",\n+      \"\\n\",\n+      \"This tutorial introduces the Associative Memory (AM) module in the SPA.\\n\",\n+      \"\\n\",\n+      \"Associative memory is a neural network used to store and recall patterns.\\n\",\n+      \"When the network receives a partial or noisy pattern at the input, it can either recover the same pattern or recall another stored pattern. \\n\",\n+      \"If the recovered pattern is same as the input pattern, the memory is said to be autoassociative or \\\"clean-up\\\" memory. Otherwise, if the recovered pattern is different from the presented one, the network is heteroassociative. \\n\",\n+      \"\\n\",\n+      \"Patterns stored by the AM module in the SPA are semantic pointers organised in a SPA vocabulary.\\n\",\n+      \"The examples in this tutorial demonstrate how to use the AM module, store and recall patterns.\\n\",\n+      \"Advanced functionality of the module such as the recall of multiple memories similar to the input are also presented.\"\n+     ]\n+    },\n+    {\n+     \"cell_type\": \"code\",\n+     \"collapsed\": false,\n+     \"input\": [\n+      \"# python libraries and plotting tools\\n\",\n+      \"import numpy as np\\n\",\n+      \"import matplotlib.pyplot as plt\\n\",\n+      \"%matplotlib inline\\n\",\n+      \"\\n\",\n+      \"import nengo\\n\",\n+      \"from nengo import spa\\n\",\n+      \"%load_ext nengo.ipynb\"\n+     ],\n+     \"language\": \"python\",\n+     \"metadata\": {},\n+     \"outputs\": []\n+    },\n+    {\n+     \"cell_type\": \"markdown\",\n+     \"metadata\": {},\n+     \"source\": [\n+      \"## Step 1: Creating an Associative Memory\\n\",\n+      \"\\n\",\n+      \"We start by creating a set of patterns the AM will store. \\n\",\n+      \"The vocabulary in this example contains five words: `ORANGE, APRICOT, CHERRY, STRAWBERRY` and `APPLE`.\\n\",\n+      \"Each word is represented as a semantic pointer, a $n$-dimensional vector.\\n\",\n+      \"When creating a vocabulary, we specify the number of dimensions for all semantic pointers.\\n\",\n+      \"Then, we add the words to a vocabulary with `parse`:\"\n+     ]\n+    },\n+    {\n+     \"cell_type\": \"code\",\n+     \"collapsed\": true,\n+     \"input\": [\n+      \"dim = 32\\n\",\n+      \"vocab = spa.Vocabulary(dimensions=dim)\\n\",\n+      \"\\n\",\n+      \"words = ['ORANGE', 'APRICOT', 'CHERRY', 'STRAWBERRY', 'APPLE']\\n\",\n+      \"\\n\",\n+      \"for word in words:\\n\",\n+      \"    vocab.parse(word)\"\n+     ],\n+     \"language\": \"python\",\n+     \"metadata\": {},\n+     \"outputs\": []\n+    },\n+    {\n+     \"cell_type\": \"markdown\",\n+     \"metadata\": {},\n+     \"source\": [\n+      \"Next, we create an autoassociative memory with a corresponding set of stored patterns.\\n\",\n+      \"The memory is created within a `nengo.Network` module.\"\n+     ]\n+    },\n+    {\n+     \"cell_type\": \"code\",\n+     \"collapsed\": false,\n+     \"input\": [\n+      \"with nengo.Network('AssociativeMemory', seed=1) as model1:\\n\",\n+      \"    assoc_mem = spa.AssociativeMemory(input_vocab=vocab)\"\n+     ],\n+     \"language\": \"python\",\n+     \"metadata\": {},\n+     \"outputs\": []\n+    },\n+    {\n+     \"cell_type\": \"markdown\",\n+     \"metadata\": {},\n+     \"source\": [\n+      \"After the network has been created, we can test its functionality by presenting a semantic pointer at the input and comparing it with a semantic pointer at the output after running a simulation. The comparison is done by calculating the dot product. If the similarity between the output vector and the input vector is close to one, we can say that the associative memory successfully retrieved the pattern.\\n\",","path":"examples/spa/associative_memory.ipynb","position":113,"original_position":113,"commit_id":"c25f80f57e3f0019a81d8fa788efdb36e56653e3","original_commit_id":"c25f80f57e3f0019a81d8fa788efdb36e56653e3","user":{"login":"Seanny123","id":1918825,"avatar_url":"https://avatars.githubusercontent.com/u/1918825?v=3","gravatar_id":"","url":"https://api.github.com/users/Seanny123","html_url":"https://github.com/Seanny123","followers_url":"https://api.github.com/users/Seanny123/followers","following_url":"https://api.github.com/users/Seanny123/following{/other_user}","gists_url":"https://api.github.com/users/Seanny123/gists{/gist_id}","starred_url":"https://api.github.com/users/Seanny123/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Seanny123/subscriptions","organizations_url":"https://api.github.com/users/Seanny123/orgs","repos_url":"https://api.github.com/users/Seanny123/repos","events_url":"https://api.github.com/users/Seanny123/events{/privacy}","received_events_url":"https://api.github.com/users/Seanny123/received_events","type":"User","site_admin":false},"body":"Maybe remove \"after running a simulation\". The user should be familiar with the idea of simulation at this point.","created_at":"2015-11-13T16:44:56Z","updated_at":"2015-11-13T16:44:56Z","html_url":"https://github.com/nengo/nengo/pull/895#discussion_r44804079","pull_request_url":"https://api.github.com/repos/nengo/nengo/pulls/895","_links":{"self":{"href":"https://api.github.com/repos/nengo/nengo/pulls/comments/44804079"},"html":{"href":"https://github.com/nengo/nengo/pull/895#discussion_r44804079"},"pull_request":{"href":"https://api.github.com/repos/nengo/nengo/pulls/895"}}},"pull_request":{"url":"https://api.github.com/repos/nengo/nengo/pulls/895","id":50322067,"html_url":"https://github.com/nengo/nengo/pull/895","diff_url":"https://github.com/nengo/nengo/pull/895.diff","patch_url":"https://github.com/nengo/nengo/pull/895.patch","issue_url":"https://api.github.com/repos/nengo/nengo/issues/895","number":895,"state":"open","locked":false,"title":"Added tutorial on spa.AssociativeMemory","user":{"login":"ikajic","id":2485670,"avatar_url":"https://avatars.githubusercontent.com/u/2485670?v=3","gravatar_id":"","url":"https://api.github.com/users/ikajic","html_url":"https://github.com/ikajic","followers_url":"https://api.github.com/users/ikajic/followers","following_url":"https://api.github.com/users/ikajic/following{/other_user}","gists_url":"https://api.github.com/users/ikajic/gists{/gist_id}","starred_url":"https://api.github.com/users/ikajic/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ikajic/subscriptions","organizations_url":"https://api.github.com/users/ikajic/orgs","repos_url":"https://api.github.com/users/ikajic/repos","events_url":"https://api.github.com/users/ikajic/events{/privacy}","received_events_url":"https://api.github.com/users/ikajic/received_events","type":"User","site_admin":false},"body":"Here are a few simple examples for the `spa.AssociativeMemory` module. \r\nThe basic idea was to show how to use it and to explain how different parameters influence memory behavior. Let me know what you think of the examples and/or if you'd like me to add something :)\r\n\r\nI was also thinking of adding a final section mentioning more advanced use-cases such as @arvoelke [Learning new associations](https://github.com/nengo/nengo/blob/voja2/examples/learning/learn_associations.ipynb), but wasn't sure how this would fit here.\r\n\r\nP.S: I'll do another PR for fixing the docstrings in `spa.AssociativeMemory`","created_at":"2015-11-10T22:37:37Z","updated_at":"2015-11-13T16:44:56Z","closed_at":null,"merged_at":null,"merge_commit_sha":"c911fdc575d7acc00591b8a7f6eda39bf69e1ec9","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/nengo/nengo/pulls/895/commits","review_comments_url":"https://api.github.com/repos/nengo/nengo/pulls/895/comments","review_comment_url":"https://api.github.com/repos/nengo/nengo/pulls/comments{/number}","comments_url":"https://api.github.com/repos/nengo/nengo/issues/895/comments","statuses_url":"https://api.github.com/repos/nengo/nengo/statuses/c25f80f57e3f0019a81d8fa788efdb36e56653e3","head":{"label":"nengo:tutorial-assocmem","ref":"tutorial-assocmem","sha":"c25f80f57e3f0019a81d8fa788efdb36e56653e3","user":{"login":"nengo","id":9197486,"avatar_url":"https://avatars.githubusercontent.com/u/9197486?v=3","gravatar_id":"","url":"https://api.github.com/users/nengo","html_url":"https://github.com/nengo","followers_url":"https://api.github.com/users/nengo/followers","following_url":"https://api.github.com/users/nengo/following{/other_user}","gists_url":"https://api.github.com/users/nengo/gists{/gist_id}","starred_url":"https://api.github.com/users/nengo/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/nengo/subscriptions","organizations_url":"https://api.github.com/users/nengo/orgs","repos_url":"https://api.github.com/users/nengo/repos","events_url":"https://api.github.com/users/nengo/events{/privacy}","received_events_url":"https://api.github.com/users/nengo/received_events","type":"Organization","site_admin":false},"repo":{"id":9568894,"name":"nengo","full_name":"nengo/nengo","owner":{"login":"nengo","id":9197486,"avatar_url":"https://avatars.githubusercontent.com/u/9197486?v=3","gravatar_id":"","url":"https://api.github.com/users/nengo","html_url":"https://github.com/nengo","followers_url":"https://api.github.com/users/nengo/followers","following_url":"https://api.github.com/users/nengo/following{/other_user}","gists_url":"https://api.github.com/users/nengo/gists{/gist_id}","starred_url":"https://api.github.com/users/nengo/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/nengo/subscriptions","organizations_url":"https://api.github.com/users/nengo/orgs","repos_url":"https://api.github.com/users/nengo/repos","events_url":"https://api.github.com/users/nengo/events{/privacy}","received_events_url":"https://api.github.com/users/nengo/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/nengo/nengo","description":"A Python library for creating and simulating large-scale brain models","fork":false,"url":"https://api.github.com/repos/nengo/nengo","forks_url":"https://api.github.com/repos/nengo/nengo/forks","keys_url":"https://api.github.com/repos/nengo/nengo/keys{/key_id}","collaborators_url":"https://api.github.com/repos/nengo/nengo/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/nengo/nengo/teams","hooks_url":"https://api.github.com/repos/nengo/nengo/hooks","issue_events_url":"https://api.github.com/repos/nengo/nengo/issues/events{/number}","events_url":"https://api.github.com/repos/nengo/nengo/events","assignees_url":"https://api.github.com/repos/nengo/nengo/assignees{/user}","branches_url":"https://api.github.com/repos/nengo/nengo/branches{/branch}","tags_url":"https://api.github.com/repos/nengo/nengo/tags","blobs_url":"https://api.github.com/repos/nengo/nengo/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/nengo/nengo/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/nengo/nengo/git/refs{/sha}","trees_url":"https://api.github.com/repos/nengo/nengo/git/trees{/sha}","statuses_url":"https://api.github.com/repos/nengo/nengo/statuses/{sha}","languages_url":"https://api.github.com/repos/nengo/nengo/languages","stargazers_url":"https://api.github.com/repos/nengo/nengo/stargazers","contributors_url":"https://api.github.com/repos/nengo/nengo/contributors","subscribers_url":"https://api.github.com/repos/nengo/nengo/subscribers","subscription_url":"https://api.github.com/repos/nengo/nengo/subscription","commits_url":"https://api.github.com/repos/nengo/nengo/commits{/sha}","git_commits_url":"https://api.github.com/repos/nengo/nengo/git/commits{/sha}","comments_url":"https://api.github.com/repos/nengo/nengo/comments{/number}","issue_comment_url":"https://api.github.com/repos/nengo/nengo/issues/comments{/number}","contents_url":"https://api.github.com/repos/nengo/nengo/contents/{+path}","compare_url":"https://api.github.com/repos/nengo/nengo/compare/{base}...{head}","merges_url":"https://api.github.com/repos/nengo/nengo/merges","archive_url":"https://api.github.com/repos/nengo/nengo/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/nengo/nengo/downloads","issues_url":"https://api.github.com/repos/nengo/nengo/issues{/number}","pulls_url":"https://api.github.com/repos/nengo/nengo/pulls{/number}","milestones_url":"https://api.github.com/repos/nengo/nengo/milestones{/number}","notifications_url":"https://api.github.com/repos/nengo/nengo/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/nengo/nengo/labels{/name}","releases_url":"https://api.github.com/repos/nengo/nengo/releases{/id}","created_at":"2013-04-20T18:46:06Z","updated_at":"2015-11-12T10:51:37Z","pushed_at":"2015-11-11T14:47:50Z","git_url":"git://github.com/nengo/nengo.git","ssh_url":"git@github.com:nengo/nengo.git","clone_url":"https://github.com/nengo/nengo.git","svn_url":"https://github.com/nengo/nengo","homepage":"","size":29738,"stargazers_count":75,"watchers_count":75,"language":"Python","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":33,"mirror_url":null,"open_issues_count":218,"forks":33,"open_issues":218,"watchers":75,"default_branch":"master"}},"base":{"label":"nengo:master","ref":"master","sha":"a3200de140c26c5eb5d5a7003b98a4cf59f02051","user":{"login":"nengo","id":9197486,"avatar_url":"https://avatars.githubusercontent.com/u/9197486?v=3","gravatar_id":"","url":"https://api.github.com/users/nengo","html_url":"https://github.com/nengo","followers_url":"https://api.github.com/users/nengo/followers","following_url":"https://api.github.com/users/nengo/following{/other_user}","gists_url":"https://api.github.com/users/nengo/gists{/gist_id}","starred_url":"https://api.github.com/users/nengo/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/nengo/subscriptions","organizations_url":"https://api.github.com/users/nengo/orgs","repos_url":"https://api.github.com/users/nengo/repos","events_url":"https://api.github.com/users/nengo/events{/privacy}","received_events_url":"https://api.github.com/users/nengo/received_events","type":"Organization","site_admin":false},"repo":{"id":9568894,"name":"nengo","full_name":"nengo/nengo","owner":{"login":"nengo","id":9197486,"avatar_url":"https://avatars.githubusercontent.com/u/9197486?v=3","gravatar_id":"","url":"https://api.github.com/users/nengo","html_url":"https://github.com/nengo","followers_url":"https://api.github.com/users/nengo/followers","following_url":"https://api.github.com/users/nengo/following{/other_user}","gists_url":"https://api.github.com/users/nengo/gists{/gist_id}","starred_url":"https://api.github.com/users/nengo/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/nengo/subscriptions","organizations_url":"https://api.github.com/users/nengo/orgs","repos_url":"https://api.github.com/users/nengo/repos","events_url":"https://api.github.com/users/nengo/events{/privacy}","received_events_url":"https://api.github.com/users/nengo/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/nengo/nengo","description":"A Python library for creating and simulating large-scale brain models","fork":false,"url":"https://api.github.com/repos/nengo/nengo","forks_url":"https://api.github.com/repos/nengo/nengo/forks","keys_url":"https://api.github.com/repos/nengo/nengo/keys{/key_id}","collaborators_url":"https://api.github.com/repos/nengo/nengo/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/nengo/nengo/teams","hooks_url":"https://api.github.com/repos/nengo/nengo/hooks","issue_events_url":"https://api.github.com/repos/nengo/nengo/issues/events{/number}","events_url":"https://api.github.com/repos/nengo/nengo/events","assignees_url":"https://api.github.com/repos/nengo/nengo/assignees{/user}","branches_url":"https://api.github.com/repos/nengo/nengo/branches{/branch}","tags_url":"https://api.github.com/repos/nengo/nengo/tags","blobs_url":"https://api.github.com/repos/nengo/nengo/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/nengo/nengo/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/nengo/nengo/git/refs{/sha}","trees_url":"https://api.github.com/repos/nengo/nengo/git/trees{/sha}","statuses_url":"https://api.github.com/repos/nengo/nengo/statuses/{sha}","languages_url":"https://api.github.com/repos/nengo/nengo/languages","stargazers_url":"https://api.github.com/repos/nengo/nengo/stargazers","contributors_url":"https://api.github.com/repos/nengo/nengo/contributors","subscribers_url":"https://api.github.com/repos/nengo/nengo/subscribers","subscription_url":"https://api.github.com/repos/nengo/nengo/subscription","commits_url":"https://api.github.com/repos/nengo/nengo/commits{/sha}","git_commits_url":"https://api.github.com/repos/nengo/nengo/git/commits{/sha}","comments_url":"https://api.github.com/repos/nengo/nengo/comments{/number}","issue_comment_url":"https://api.github.com/repos/nengo/nengo/issues/comments{/number}","contents_url":"https://api.github.com/repos/nengo/nengo/contents/{+path}","compare_url":"https://api.github.com/repos/nengo/nengo/compare/{base}...{head}","merges_url":"https://api.github.com/repos/nengo/nengo/merges","archive_url":"https://api.github.com/repos/nengo/nengo/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/nengo/nengo/downloads","issues_url":"https://api.github.com/repos/nengo/nengo/issues{/number}","pulls_url":"https://api.github.com/repos/nengo/nengo/pulls{/number}","milestones_url":"https://api.github.com/repos/nengo/nengo/milestones{/number}","notifications_url":"https://api.github.com/repos/nengo/nengo/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/nengo/nengo/labels{/name}","releases_url":"https://api.github.com/repos/nengo/nengo/releases{/id}","created_at":"2013-04-20T18:46:06Z","updated_at":"2015-11-12T10:51:37Z","pushed_at":"2015-11-11T14:47:50Z","git_url":"git://github.com/nengo/nengo.git","ssh_url":"git@github.com:nengo/nengo.git","clone_url":"https://github.com/nengo/nengo.git","svn_url":"https://github.com/nengo/nengo","homepage":"","size":29738,"stargazers_count":75,"watchers_count":75,"language":"Python","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":33,"mirror_url":null,"open_issues_count":218,"forks":33,"open_issues":218,"watchers":75,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/nengo/nengo/pulls/895"},"html":{"href":"https://github.com/nengo/nengo/pull/895"},"issue":{"href":"https://api.github.com/repos/nengo/nengo/issues/895"},"comments":{"href":"https://api.github.com/repos/nengo/nengo/issues/895/comments"},"review_comments":{"href":"https://api.github.com/repos/nengo/nengo/pulls/895/comments"},"review_comment":{"href":"https://api.github.com/repos/nengo/nengo/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/nengo/nengo/pulls/895/commits"},"statuses":{"href":"https://api.github.com/repos/nengo/nengo/statuses/c25f80f57e3f0019a81d8fa788efdb36e56653e3"}}}}