{"action":"created","comment":{"url":"https://api.github.com/repos/nilearn/nilearn/pulls/comments/38091438","id":38091438,"diff_hunk":"@@ -0,0 +1,76 @@\n+\"\"\"\n+Group analysis of resting-state fMRI with dictionary learning: DictLearning\n+=====================================================\n+\n+An example applying dictionary learning to resting-state data. This example applies it\n+to 20 subjects of the ADHD200 datasets.\n+\n+Dictionary learning is a sparsity based decomposition method for extracting spatial maps.\n+\n+    * Gael Varoquaux et al.\n+    Multi-subject dictionary learning to segment an atlas of brain spontaneous activity\n+    Information Processing in Medical Imaging, 2011, pp. 562-573, Lecture Notes in Computer Science\n+\n+Pre-prints for paper is available on hal\n+https://hal.inria.fr/inria-00588898/en/\n+\"\"\"\n+import time\n+from sklearn.externals.joblib import Memory\n+\n+### Load ADHD rest dataset ####################################################\n+from nilearn import datasets\n+# For linear assignment (should be moved in non user space...)\n+t0 = time.time()\n+adhd_dataset = datasets.fetch_adhd(n_subjects=40)\n+func_filenames = adhd_dataset.func  # list of 4D nifti files for each subject\n+\n+# print basic information on the dataset\n+print('First functional nifti image (4D) is at: %s' %\n+      adhd_dataset.func[0])  # 4D data\n+\n+### Apply DictLearning ########################################################\n+from nilearn.decomposition import DictLearning, CanICA\n+\n+n_components = 30\n+\n+dict_learning = DictLearning(n_components=n_components, smoothing_fwhm=6.,\n+                             memory=\"nilearn_cache\", memory_level=3,\n+                             verbose=2,\n+                             random_state=0, alpha=10, max_nbytes=0, n_epochs=2)\n+canica = CanICA(n_components=n_components, smoothing_fwhm=6.,\n+                memory=\"nilearn_cache\",  memory_level=3,\n+                verbose=1,\n+                n_init=1, threshold=3.)\n+\n+estimators = [dict_learning]\n+\n+components_imgs = []\n+\n+for estimator in estimators:\n+    print('[Example] Learning maps using %s model' % type(estimator).__name__)\n+    estimator.fit(func_filenames)\n+    print('[Example] Dumping results')\n+    components_img = estimator.masker_.inverse_transform(estimator.components_)","path":"examples/connectivity/plot_dict_learning_resting_state.py","position":53,"original_position":53,"commit_id":"318c0115b7cc2ca90a0a3f479b0965392b19386f","original_commit_id":"318c0115b7cc2ca90a0a3f479b0965392b19386f","user":{"login":"banilo","id":3907396,"avatar_url":"https://avatars.githubusercontent.com/u/3907396?v=3","gravatar_id":"","url":"https://api.github.com/users/banilo","html_url":"https://github.com/banilo","followers_url":"https://api.github.com/users/banilo/followers","following_url":"https://api.github.com/users/banilo/following{/other_user}","gists_url":"https://api.github.com/users/banilo/gists{/gist_id}","starred_url":"https://api.github.com/users/banilo/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/banilo/subscriptions","organizations_url":"https://api.github.com/users/banilo/orgs","repos_url":"https://api.github.com/users/banilo/repos","events_url":"https://api.github.com/users/banilo/events{/privacy}","received_events_url":"https://api.github.com/users/banilo/received_events","type":"User","site_admin":false},"body":"For a user who does not already know the ``NiftiMasker``family, it might be difficult to understand this line. Isn't there a way to expand this into multiple steps for didactic reasons?","created_at":"2015-08-27T12:56:15Z","updated_at":"2015-08-27T12:56:15Z","html_url":"https://github.com/nilearn/nilearn/pull/693#discussion_r38091438","pull_request_url":"https://api.github.com/repos/nilearn/nilearn/pulls/693","_links":{"self":{"href":"https://api.github.com/repos/nilearn/nilearn/pulls/comments/38091438"},"html":{"href":"https://github.com/nilearn/nilearn/pull/693#discussion_r38091438"},"pull_request":{"href":"https://api.github.com/repos/nilearn/nilearn/pulls/693"}}},"pull_request":{"url":"https://api.github.com/repos/nilearn/nilearn/pulls/693","id":40142833,"html_url":"https://github.com/nilearn/nilearn/pull/693","diff_url":"https://github.com/nilearn/nilearn/pull/693.diff","patch_url":"https://github.com/nilearn/nilearn/pull/693.patch","issue_url":"https://api.github.com/repos/nilearn/nilearn/issues/693","number":693,"state":"open","locked":false,"title":"[MRG] Dictionary learning + nilearn.decomposition refactoring","user":{"login":"arthurmensch","id":4078691,"avatar_url":"https://avatars.githubusercontent.com/u/4078691?v=3","gravatar_id":"","url":"https://api.github.com/users/arthurmensch","html_url":"https://github.com/arthurmensch","followers_url":"https://api.github.com/users/arthurmensch/followers","following_url":"https://api.github.com/users/arthurmensch/following{/other_user}","gists_url":"https://api.github.com/users/arthurmensch/gists{/gist_id}","starred_url":"https://api.github.com/users/arthurmensch/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/arthurmensch/subscriptions","organizations_url":"https://api.github.com/users/arthurmensch/orgs","repos_url":"https://api.github.com/users/arthurmensch/repos","events_url":"https://api.github.com/users/arthurmensch/events{/privacy}","received_events_url":"https://api.github.com/users/arthurmensch/received_events","type":"User","site_admin":false},"body":"Decomposition estimators (`DictLearning` / `MultiPCA`) now inherit a  `DecompositionEstimator`.\r\n\r\nLoading of data is made through a `PCAMultiNiftiMasker`, which loads data from files and compress it.\r\n\r\nPotentially, the function check_masker could solve issue #688, as it factorizes the input checking of estimator to which you provide either a masker or parameters for a mask. It is tuned to be able to use `PCAMultiNiftiMasker`","created_at":"2015-07-16T15:36:20Z","updated_at":"2015-08-27T12:56:15Z","closed_at":null,"merged_at":null,"merge_commit_sha":"60153897cd70d89361471caeb841d631b264205f","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/nilearn/nilearn/pulls/693/commits","review_comments_url":"https://api.github.com/repos/nilearn/nilearn/pulls/693/comments","review_comment_url":"https://api.github.com/repos/nilearn/nilearn/pulls/comments{/number}","comments_url":"https://api.github.com/repos/nilearn/nilearn/issues/693/comments","statuses_url":"https://api.github.com/repos/nilearn/nilearn/statuses/318c0115b7cc2ca90a0a3f479b0965392b19386f","head":{"label":"arthurmensch:l1_dict_learning_composition_mask","ref":"l1_dict_learning_composition_mask","sha":"318c0115b7cc2ca90a0a3f479b0965392b19386f","user":{"login":"arthurmensch","id":4078691,"avatar_url":"https://avatars.githubusercontent.com/u/4078691?v=3","gravatar_id":"","url":"https://api.github.com/users/arthurmensch","html_url":"https://github.com/arthurmensch","followers_url":"https://api.github.com/users/arthurmensch/followers","following_url":"https://api.github.com/users/arthurmensch/following{/other_user}","gists_url":"https://api.github.com/users/arthurmensch/gists{/gist_id}","starred_url":"https://api.github.com/users/arthurmensch/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/arthurmensch/subscriptions","organizations_url":"https://api.github.com/users/arthurmensch/orgs","repos_url":"https://api.github.com/users/arthurmensch/repos","events_url":"https://api.github.com/users/arthurmensch/events{/privacy}","received_events_url":"https://api.github.com/users/arthurmensch/received_events","type":"User","site_admin":false},"repo":{"id":37450678,"name":"nilearn","full_name":"arthurmensch/nilearn","owner":{"login":"arthurmensch","id":4078691,"avatar_url":"https://avatars.githubusercontent.com/u/4078691?v=3","gravatar_id":"","url":"https://api.github.com/users/arthurmensch","html_url":"https://github.com/arthurmensch","followers_url":"https://api.github.com/users/arthurmensch/followers","following_url":"https://api.github.com/users/arthurmensch/following{/other_user}","gists_url":"https://api.github.com/users/arthurmensch/gists{/gist_id}","starred_url":"https://api.github.com/users/arthurmensch/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/arthurmensch/subscriptions","organizations_url":"https://api.github.com/users/arthurmensch/orgs","repos_url":"https://api.github.com/users/arthurmensch/repos","events_url":"https://api.github.com/users/arthurmensch/events{/privacy}","received_events_url":"https://api.github.com/users/arthurmensch/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/arthurmensch/nilearn","description":"Machine learning for NeuroImaging in Python","fork":true,"url":"https://api.github.com/repos/arthurmensch/nilearn","forks_url":"https://api.github.com/repos/arthurmensch/nilearn/forks","keys_url":"https://api.github.com/repos/arthurmensch/nilearn/keys{/key_id}","collaborators_url":"https://api.github.com/repos/arthurmensch/nilearn/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/arthurmensch/nilearn/teams","hooks_url":"https://api.github.com/repos/arthurmensch/nilearn/hooks","issue_events_url":"https://api.github.com/repos/arthurmensch/nilearn/issues/events{/number}","events_url":"https://api.github.com/repos/arthurmensch/nilearn/events","assignees_url":"https://api.github.com/repos/arthurmensch/nilearn/assignees{/user}","branches_url":"https://api.github.com/repos/arthurmensch/nilearn/branches{/branch}","tags_url":"https://api.github.com/repos/arthurmensch/nilearn/tags","blobs_url":"https://api.github.com/repos/arthurmensch/nilearn/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/arthurmensch/nilearn/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/arthurmensch/nilearn/git/refs{/sha}","trees_url":"https://api.github.com/repos/arthurmensch/nilearn/git/trees{/sha}","statuses_url":"https://api.github.com/repos/arthurmensch/nilearn/statuses/{sha}","languages_url":"https://api.github.com/repos/arthurmensch/nilearn/languages","stargazers_url":"https://api.github.com/repos/arthurmensch/nilearn/stargazers","contributors_url":"https://api.github.com/repos/arthurmensch/nilearn/contributors","subscribers_url":"https://api.github.com/repos/arthurmensch/nilearn/subscribers","subscription_url":"https://api.github.com/repos/arthurmensch/nilearn/subscription","commits_url":"https://api.github.com/repos/arthurmensch/nilearn/commits{/sha}","git_commits_url":"https://api.github.com/repos/arthurmensch/nilearn/git/commits{/sha}","comments_url":"https://api.github.com/repos/arthurmensch/nilearn/comments{/number}","issue_comment_url":"https://api.github.com/repos/arthurmensch/nilearn/issues/comments{/number}","contents_url":"https://api.github.com/repos/arthurmensch/nilearn/contents/{+path}","compare_url":"https://api.github.com/repos/arthurmensch/nilearn/compare/{base}...{head}","merges_url":"https://api.github.com/repos/arthurmensch/nilearn/merges","archive_url":"https://api.github.com/repos/arthurmensch/nilearn/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/arthurmensch/nilearn/downloads","issues_url":"https://api.github.com/repos/arthurmensch/nilearn/issues{/number}","pulls_url":"https://api.github.com/repos/arthurmensch/nilearn/pulls{/number}","milestones_url":"https://api.github.com/repos/arthurmensch/nilearn/milestones{/number}","notifications_url":"https://api.github.com/repos/arthurmensch/nilearn/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/arthurmensch/nilearn/labels{/name}","releases_url":"https://api.github.com/repos/arthurmensch/nilearn/releases{/id}","created_at":"2015-06-15T07:39:54Z","updated_at":"2015-06-15T07:39:55Z","pushed_at":"2015-08-27T07:55:27Z","git_url":"git://github.com/arthurmensch/nilearn.git","ssh_url":"git@github.com:arthurmensch/nilearn.git","clone_url":"https://github.com/arthurmensch/nilearn.git","svn_url":"https://github.com/arthurmensch/nilearn","homepage":"http://nilearn.github.io","size":8657,"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":"nilearn:master","ref":"master","sha":"aebd2c5457632bc949065c494caa072948fb3424","user":{"login":"nilearn","id":4646912,"avatar_url":"https://avatars.githubusercontent.com/u/4646912?v=3","gravatar_id":"","url":"https://api.github.com/users/nilearn","html_url":"https://github.com/nilearn","followers_url":"https://api.github.com/users/nilearn/followers","following_url":"https://api.github.com/users/nilearn/following{/other_user}","gists_url":"https://api.github.com/users/nilearn/gists{/gist_id}","starred_url":"https://api.github.com/users/nilearn/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/nilearn/subscriptions","organizations_url":"https://api.github.com/users/nilearn/orgs","repos_url":"https://api.github.com/users/nilearn/repos","events_url":"https://api.github.com/users/nilearn/events{/privacy}","received_events_url":"https://api.github.com/users/nilearn/received_events","type":"Organization","site_admin":false},"repo":{"id":1235740,"name":"nilearn","full_name":"nilearn/nilearn","owner":{"login":"nilearn","id":4646912,"avatar_url":"https://avatars.githubusercontent.com/u/4646912?v=3","gravatar_id":"","url":"https://api.github.com/users/nilearn","html_url":"https://github.com/nilearn","followers_url":"https://api.github.com/users/nilearn/followers","following_url":"https://api.github.com/users/nilearn/following{/other_user}","gists_url":"https://api.github.com/users/nilearn/gists{/gist_id}","starred_url":"https://api.github.com/users/nilearn/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/nilearn/subscriptions","organizations_url":"https://api.github.com/users/nilearn/orgs","repos_url":"https://api.github.com/users/nilearn/repos","events_url":"https://api.github.com/users/nilearn/events{/privacy}","received_events_url":"https://api.github.com/users/nilearn/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/nilearn/nilearn","description":"Machine learning for NeuroImaging in Python","fork":false,"url":"https://api.github.com/repos/nilearn/nilearn","forks_url":"https://api.github.com/repos/nilearn/nilearn/forks","keys_url":"https://api.github.com/repos/nilearn/nilearn/keys{/key_id}","collaborators_url":"https://api.github.com/repos/nilearn/nilearn/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/nilearn/nilearn/teams","hooks_url":"https://api.github.com/repos/nilearn/nilearn/hooks","issue_events_url":"https://api.github.com/repos/nilearn/nilearn/issues/events{/number}","events_url":"https://api.github.com/repos/nilearn/nilearn/events","assignees_url":"https://api.github.com/repos/nilearn/nilearn/assignees{/user}","branches_url":"https://api.github.com/repos/nilearn/nilearn/branches{/branch}","tags_url":"https://api.github.com/repos/nilearn/nilearn/tags","blobs_url":"https://api.github.com/repos/nilearn/nilearn/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/nilearn/nilearn/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/nilearn/nilearn/git/refs{/sha}","trees_url":"https://api.github.com/repos/nilearn/nilearn/git/trees{/sha}","statuses_url":"https://api.github.com/repos/nilearn/nilearn/statuses/{sha}","languages_url":"https://api.github.com/repos/nilearn/nilearn/languages","stargazers_url":"https://api.github.com/repos/nilearn/nilearn/stargazers","contributors_url":"https://api.github.com/repos/nilearn/nilearn/contributors","subscribers_url":"https://api.github.com/repos/nilearn/nilearn/subscribers","subscription_url":"https://api.github.com/repos/nilearn/nilearn/subscription","commits_url":"https://api.github.com/repos/nilearn/nilearn/commits{/sha}","git_commits_url":"https://api.github.com/repos/nilearn/nilearn/git/commits{/sha}","comments_url":"https://api.github.com/repos/nilearn/nilearn/comments{/number}","issue_comment_url":"https://api.github.com/repos/nilearn/nilearn/issues/comments{/number}","contents_url":"https://api.github.com/repos/nilearn/nilearn/contents/{+path}","compare_url":"https://api.github.com/repos/nilearn/nilearn/compare/{base}...{head}","merges_url":"https://api.github.com/repos/nilearn/nilearn/merges","archive_url":"https://api.github.com/repos/nilearn/nilearn/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/nilearn/nilearn/downloads","issues_url":"https://api.github.com/repos/nilearn/nilearn/issues{/number}","pulls_url":"https://api.github.com/repos/nilearn/nilearn/pulls{/number}","milestones_url":"https://api.github.com/repos/nilearn/nilearn/milestones{/number}","notifications_url":"https://api.github.com/repos/nilearn/nilearn/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/nilearn/nilearn/labels{/name}","releases_url":"https://api.github.com/repos/nilearn/nilearn/releases{/id}","created_at":"2011-01-09T19:02:23Z","updated_at":"2015-08-26T20:02:47Z","pushed_at":"2015-08-25T13:42:45Z","git_url":"git://github.com/nilearn/nilearn.git","ssh_url":"git@github.com:nilearn/nilearn.git","clone_url":"https://github.com/nilearn/nilearn.git","svn_url":"https://github.com/nilearn/nilearn","homepage":"http://nilearn.github.io","size":14804,"stargazers_count":109,"watchers_count":109,"language":"Python","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":74,"mirror_url":null,"open_issues_count":81,"forks":74,"open_issues":81,"watchers":109,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/nilearn/nilearn/pulls/693"},"html":{"href":"https://github.com/nilearn/nilearn/pull/693"},"issue":{"href":"https://api.github.com/repos/nilearn/nilearn/issues/693"},"comments":{"href":"https://api.github.com/repos/nilearn/nilearn/issues/693/comments"},"review_comments":{"href":"https://api.github.com/repos/nilearn/nilearn/pulls/693/comments"},"review_comment":{"href":"https://api.github.com/repos/nilearn/nilearn/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/nilearn/nilearn/pulls/693/commits"},"statuses":{"href":"https://api.github.com/repos/nilearn/nilearn/statuses/318c0115b7cc2ca90a0a3f479b0965392b19386f"}}}}