{"action":"created","comment":{"url":"https://api.github.com/repos/mne-tools/mne-python/pulls/comments/34476540","id":34476540,"diff_hunk":"@@ -48,53 +49,14 @@\n \n epochs_list = [epochs[k] for k in event_id]\n mne.epochs.equalize_epoch_counts(epochs_list)\n-\n-###############################################################################\n-# Decoding in sensor space using a linear SVM\n-n_times = len(epochs.times)\n-# Take only the data channels (here the gradiometers)\n data_picks = mne.pick_types(epochs.info, meg=True, exclude='bads')\n-# Make arrays X and y such that :\n-# X is 3d with X.shape[0] is the total number of epochs to classify\n-# y is filled with integers coding for the class to predict\n-# We must have X.shape[0] equal to y.shape[0]\n-X = [e.get_data()[:, data_picks, :] for e in epochs_list]\n-y = [k * np.ones(len(this_X)) for k, this_X in enumerate(X)]\n-X = np.concatenate(X)\n-y = np.concatenate(y)\n-\n-from sklearn.svm import SVC  # noqa\n-from sklearn.cross_validation import cross_val_score, ShuffleSplit  # noqa\n-\n-clf = SVC(C=1, kernel='linear')\n-# Define a monte-carlo cross-validation generator (reduce variance):\n-cv = ShuffleSplit(len(X), 10, test_size=0.2)\n \n-scores = np.empty(n_times)\n-std_scores = np.empty(n_times)\n-\n-for t in range(n_times):\n-    Xt = X[:, :, t]\n-    # Standardize features\n-    Xt -= Xt.mean(axis=0)\n-    Xt /= Xt.std(axis=0)\n-    # Run cross-validation\n-    # Note : for sklearn the Xt matrix should be 2d (n_samples x n_features)\n-    scores_t = cross_val_score(clf, Xt, y, cv=cv, n_jobs=1)\n-    scores[t] = scores_t.mean()\n-    std_scores[t] = scores_t.std()\n-\n-times = 1e3 * epochs.times\n-scores *= 100  # make it percentage\n-std_scores *= 100\n-plt.plot(times, scores, label=\"Classif. score\")\n-plt.axhline(50, color='k', linestyle='--', label=\"Chance level\")\n-plt.axvline(0, color='r', label='stim onset')\n-plt.legend()\n-hyp_limits = (scores - std_scores, scores + std_scores)\n-plt.fill_between(times, hyp_limits[0], y2=hyp_limits[1], color='b', alpha=0.5)\n-plt.xlabel('Times (ms)')\n-plt.ylabel('CV classification score (% correct)')\n-plt.ylim([30, 100])\n-plt.title('Sensor space decoding')\n-plt.show()\n+###############################################################################\n+# Setup decoding: default is linear SVC\n+tg = TimeDecoding(predict_mode='cross-validation', n_jobs=1)\n+# Fit\n+tg.fit(epochs)\n+# Compute accuracy\n+tg.score(epochs)","path":"examples/decoding/plot_decoding_sensors.py","position":78,"original_position":78,"commit_id":"63702732c88b8d570b5e82cc2a8ee8e890c3d683","original_commit_id":"63702732c88b8d570b5e82cc2a8ee8e890c3d683","user":{"login":"mainakjas","id":3817535,"avatar_url":"https://avatars.githubusercontent.com/u/3817535?v=3","gravatar_id":"","url":"https://api.github.com/users/mainakjas","html_url":"https://github.com/mainakjas","followers_url":"https://api.github.com/users/mainakjas/followers","following_url":"https://api.github.com/users/mainakjas/following{/other_user}","gists_url":"https://api.github.com/users/mainakjas/gists{/gist_id}","starred_url":"https://api.github.com/users/mainakjas/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mainakjas/subscriptions","organizations_url":"https://api.github.com/users/mainakjas/orgs","repos_url":"https://api.github.com/users/mainakjas/repos","events_url":"https://api.github.com/users/mainakjas/events{/privacy}","received_events_url":"https://api.github.com/users/mainakjas/received_events","type":"User","site_admin":false},"body":"@kingjr what happened to the confidence intervals? I don't see them on your branch when I run this example. ","created_at":"2015-07-13T15:42:22Z","updated_at":"2015-07-13T15:42:22Z","html_url":"https://github.com/mne-tools/mne-python/pull/2066#discussion_r34476540","pull_request_url":"https://api.github.com/repos/mne-tools/mne-python/pulls/2066","_links":{"self":{"href":"https://api.github.com/repos/mne-tools/mne-python/pulls/comments/34476540"},"html":{"href":"https://github.com/mne-tools/mne-python/pull/2066#discussion_r34476540"},"pull_request":{"href":"https://api.github.com/repos/mne-tools/mne-python/pulls/2066"}}},"pull_request":{"url":"https://api.github.com/repos/mne-tools/mne-python/pulls/2066","id":34873866,"html_url":"https://github.com/mne-tools/mne-python/pull/2066","diff_url":"https://github.com/mne-tools/mne-python/pull/2066.diff","patch_url":"https://github.com/mne-tools/mne-python/pull/2066.patch","issue_url":"https://api.github.com/repos/mne-tools/mne-python/issues/2066","number":2066,"state":"open","locked":false,"title":"EHN: add TimeDecoding class for simplification","user":{"login":"kingjr","id":4881164,"avatar_url":"https://avatars.githubusercontent.com/u/4881164?v=3","gravatar_id":"","url":"https://api.github.com/users/kingjr","html_url":"https://github.com/kingjr","followers_url":"https://api.github.com/users/kingjr/followers","following_url":"https://api.github.com/users/kingjr/following{/other_user}","gists_url":"https://api.github.com/users/kingjr/gists{/gist_id}","starred_url":"https://api.github.com/users/kingjr/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/kingjr/subscriptions","organizations_url":"https://api.github.com/users/kingjr/orgs","repos_url":"https://api.github.com/users/kingjr/repos","events_url":"https://api.github.com/users/kingjr/events{/privacy}","received_events_url":"https://api.github.com/users/kingjr/received_events","type":"User","site_admin":false},"body":"This creates a TimeDecoding class that deals with the specific case of diagonal decoding in the GAT analyses.\r\n\r\nAlso see https://github.com/mne-tools/mne-python/pull/2058","created_at":"2015-05-07T00:31:26Z","updated_at":"2015-07-13T15:42:22Z","closed_at":null,"merged_at":null,"merge_commit_sha":"d9352ceb6d88c103f9d7da442587a62e9ef67b89","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/mne-tools/mne-python/pulls/2066/commits","review_comments_url":"https://api.github.com/repos/mne-tools/mne-python/pulls/2066/comments","review_comment_url":"https://api.github.com/repos/mne-tools/mne-python/pulls/comments{/number}","comments_url":"https://api.github.com/repos/mne-tools/mne-python/issues/2066/comments","statuses_url":"https://api.github.com/repos/mne-tools/mne-python/statuses/63702732c88b8d570b5e82cc2a8ee8e890c3d683","head":{"label":"kingjr:TimeDecoding","ref":"TimeDecoding","sha":"63702732c88b8d570b5e82cc2a8ee8e890c3d683","user":{"login":"kingjr","id":4881164,"avatar_url":"https://avatars.githubusercontent.com/u/4881164?v=3","gravatar_id":"","url":"https://api.github.com/users/kingjr","html_url":"https://github.com/kingjr","followers_url":"https://api.github.com/users/kingjr/followers","following_url":"https://api.github.com/users/kingjr/following{/other_user}","gists_url":"https://api.github.com/users/kingjr/gists{/gist_id}","starred_url":"https://api.github.com/users/kingjr/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/kingjr/subscriptions","organizations_url":"https://api.github.com/users/kingjr/orgs","repos_url":"https://api.github.com/users/kingjr/repos","events_url":"https://api.github.com/users/kingjr/events{/privacy}","received_events_url":"https://api.github.com/users/kingjr/received_events","type":"User","site_admin":false},"repo":{"id":19731468,"name":"mne-python","full_name":"kingjr/mne-python","owner":{"login":"kingjr","id":4881164,"avatar_url":"https://avatars.githubusercontent.com/u/4881164?v=3","gravatar_id":"","url":"https://api.github.com/users/kingjr","html_url":"https://github.com/kingjr","followers_url":"https://api.github.com/users/kingjr/followers","following_url":"https://api.github.com/users/kingjr/following{/other_user}","gists_url":"https://api.github.com/users/kingjr/gists{/gist_id}","starred_url":"https://api.github.com/users/kingjr/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/kingjr/subscriptions","organizations_url":"https://api.github.com/users/kingjr/orgs","repos_url":"https://api.github.com/users/kingjr/repos","events_url":"https://api.github.com/users/kingjr/events{/privacy}","received_events_url":"https://api.github.com/users/kingjr/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/kingjr/mne-python","description":"MNE : Magnetoencephalography (MEG) and Electroencephalography (EEG) in Python","fork":true,"url":"https://api.github.com/repos/kingjr/mne-python","forks_url":"https://api.github.com/repos/kingjr/mne-python/forks","keys_url":"https://api.github.com/repos/kingjr/mne-python/keys{/key_id}","collaborators_url":"https://api.github.com/repos/kingjr/mne-python/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/kingjr/mne-python/teams","hooks_url":"https://api.github.com/repos/kingjr/mne-python/hooks","issue_events_url":"https://api.github.com/repos/kingjr/mne-python/issues/events{/number}","events_url":"https://api.github.com/repos/kingjr/mne-python/events","assignees_url":"https://api.github.com/repos/kingjr/mne-python/assignees{/user}","branches_url":"https://api.github.com/repos/kingjr/mne-python/branches{/branch}","tags_url":"https://api.github.com/repos/kingjr/mne-python/tags","blobs_url":"https://api.github.com/repos/kingjr/mne-python/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/kingjr/mne-python/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/kingjr/mne-python/git/refs{/sha}","trees_url":"https://api.github.com/repos/kingjr/mne-python/git/trees{/sha}","statuses_url":"https://api.github.com/repos/kingjr/mne-python/statuses/{sha}","languages_url":"https://api.github.com/repos/kingjr/mne-python/languages","stargazers_url":"https://api.github.com/repos/kingjr/mne-python/stargazers","contributors_url":"https://api.github.com/repos/kingjr/mne-python/contributors","subscribers_url":"https://api.github.com/repos/kingjr/mne-python/subscribers","subscription_url":"https://api.github.com/repos/kingjr/mne-python/subscription","commits_url":"https://api.github.com/repos/kingjr/mne-python/commits{/sha}","git_commits_url":"https://api.github.com/repos/kingjr/mne-python/git/commits{/sha}","comments_url":"https://api.github.com/repos/kingjr/mne-python/comments{/number}","issue_comment_url":"https://api.github.com/repos/kingjr/mne-python/issues/comments{/number}","contents_url":"https://api.github.com/repos/kingjr/mne-python/contents/{+path}","compare_url":"https://api.github.com/repos/kingjr/mne-python/compare/{base}...{head}","merges_url":"https://api.github.com/repos/kingjr/mne-python/merges","archive_url":"https://api.github.com/repos/kingjr/mne-python/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/kingjr/mne-python/downloads","issues_url":"https://api.github.com/repos/kingjr/mne-python/issues{/number}","pulls_url":"https://api.github.com/repos/kingjr/mne-python/pulls{/number}","milestones_url":"https://api.github.com/repos/kingjr/mne-python/milestones{/number}","notifications_url":"https://api.github.com/repos/kingjr/mne-python/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/kingjr/mne-python/labels{/name}","releases_url":"https://api.github.com/repos/kingjr/mne-python/releases{/id}","created_at":"2014-05-13T08:28:44Z","updated_at":"2014-06-02T12:58:51Z","pushed_at":"2015-07-13T14:41:14Z","git_url":"git://github.com/kingjr/mne-python.git","ssh_url":"git@github.com:kingjr/mne-python.git","clone_url":"https://github.com/kingjr/mne-python.git","svn_url":"https://github.com/kingjr/mne-python","homepage":"http://martinos.org/mne/","size":79184,"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":"mne-tools:master","ref":"master","sha":"f32436e9fb93f33f452f4138a11638de8b9c0df5","user":{"login":"mne-tools","id":583875,"avatar_url":"https://avatars.githubusercontent.com/u/583875?v=3","gravatar_id":"","url":"https://api.github.com/users/mne-tools","html_url":"https://github.com/mne-tools","followers_url":"https://api.github.com/users/mne-tools/followers","following_url":"https://api.github.com/users/mne-tools/following{/other_user}","gists_url":"https://api.github.com/users/mne-tools/gists{/gist_id}","starred_url":"https://api.github.com/users/mne-tools/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mne-tools/subscriptions","organizations_url":"https://api.github.com/users/mne-tools/orgs","repos_url":"https://api.github.com/users/mne-tools/repos","events_url":"https://api.github.com/users/mne-tools/events{/privacy}","received_events_url":"https://api.github.com/users/mne-tools/received_events","type":"Organization","site_admin":false},"repo":{"id":1301584,"name":"mne-python","full_name":"mne-tools/mne-python","owner":{"login":"mne-tools","id":583875,"avatar_url":"https://avatars.githubusercontent.com/u/583875?v=3","gravatar_id":"","url":"https://api.github.com/users/mne-tools","html_url":"https://github.com/mne-tools","followers_url":"https://api.github.com/users/mne-tools/followers","following_url":"https://api.github.com/users/mne-tools/following{/other_user}","gists_url":"https://api.github.com/users/mne-tools/gists{/gist_id}","starred_url":"https://api.github.com/users/mne-tools/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mne-tools/subscriptions","organizations_url":"https://api.github.com/users/mne-tools/orgs","repos_url":"https://api.github.com/users/mne-tools/repos","events_url":"https://api.github.com/users/mne-tools/events{/privacy}","received_events_url":"https://api.github.com/users/mne-tools/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/mne-tools/mne-python","description":"MNE : Magnetoencephalography (MEG) and Electroencephalography (EEG) in Python","fork":false,"url":"https://api.github.com/repos/mne-tools/mne-python","forks_url":"https://api.github.com/repos/mne-tools/mne-python/forks","keys_url":"https://api.github.com/repos/mne-tools/mne-python/keys{/key_id}","collaborators_url":"https://api.github.com/repos/mne-tools/mne-python/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/mne-tools/mne-python/teams","hooks_url":"https://api.github.com/repos/mne-tools/mne-python/hooks","issue_events_url":"https://api.github.com/repos/mne-tools/mne-python/issues/events{/number}","events_url":"https://api.github.com/repos/mne-tools/mne-python/events","assignees_url":"https://api.github.com/repos/mne-tools/mne-python/assignees{/user}","branches_url":"https://api.github.com/repos/mne-tools/mne-python/branches{/branch}","tags_url":"https://api.github.com/repos/mne-tools/mne-python/tags","blobs_url":"https://api.github.com/repos/mne-tools/mne-python/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/mne-tools/mne-python/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/mne-tools/mne-python/git/refs{/sha}","trees_url":"https://api.github.com/repos/mne-tools/mne-python/git/trees{/sha}","statuses_url":"https://api.github.com/repos/mne-tools/mne-python/statuses/{sha}","languages_url":"https://api.github.com/repos/mne-tools/mne-python/languages","stargazers_url":"https://api.github.com/repos/mne-tools/mne-python/stargazers","contributors_url":"https://api.github.com/repos/mne-tools/mne-python/contributors","subscribers_url":"https://api.github.com/repos/mne-tools/mne-python/subscribers","subscription_url":"https://api.github.com/repos/mne-tools/mne-python/subscription","commits_url":"https://api.github.com/repos/mne-tools/mne-python/commits{/sha}","git_commits_url":"https://api.github.com/repos/mne-tools/mne-python/git/commits{/sha}","comments_url":"https://api.github.com/repos/mne-tools/mne-python/comments{/number}","issue_comment_url":"https://api.github.com/repos/mne-tools/mne-python/issues/comments{/number}","contents_url":"https://api.github.com/repos/mne-tools/mne-python/contents/{+path}","compare_url":"https://api.github.com/repos/mne-tools/mne-python/compare/{base}...{head}","merges_url":"https://api.github.com/repos/mne-tools/mne-python/merges","archive_url":"https://api.github.com/repos/mne-tools/mne-python/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/mne-tools/mne-python/downloads","issues_url":"https://api.github.com/repos/mne-tools/mne-python/issues{/number}","pulls_url":"https://api.github.com/repos/mne-tools/mne-python/pulls{/number}","milestones_url":"https://api.github.com/repos/mne-tools/mne-python/milestones{/number}","notifications_url":"https://api.github.com/repos/mne-tools/mne-python/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/mne-tools/mne-python/labels{/name}","releases_url":"https://api.github.com/repos/mne-tools/mne-python/releases{/id}","created_at":"2011-01-28T03:31:13Z","updated_at":"2015-07-10T19:14:50Z","pushed_at":"2015-07-13T15:13:51Z","git_url":"git://github.com/mne-tools/mne-python.git","ssh_url":"git@github.com:mne-tools/mne-python.git","clone_url":"https://github.com/mne-tools/mne-python.git","svn_url":"https://github.com/mne-tools/mne-python","homepage":"http://martinos.org/mne/","size":179622,"stargazers_count":138,"watchers_count":138,"language":"Python","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":128,"mirror_url":null,"open_issues_count":179,"forks":128,"open_issues":179,"watchers":138,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/mne-tools/mne-python/pulls/2066"},"html":{"href":"https://github.com/mne-tools/mne-python/pull/2066"},"issue":{"href":"https://api.github.com/repos/mne-tools/mne-python/issues/2066"},"comments":{"href":"https://api.github.com/repos/mne-tools/mne-python/issues/2066/comments"},"review_comments":{"href":"https://api.github.com/repos/mne-tools/mne-python/pulls/2066/comments"},"review_comment":{"href":"https://api.github.com/repos/mne-tools/mne-python/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/mne-tools/mne-python/pulls/2066/commits"},"statuses":{"href":"https://api.github.com/repos/mne-tools/mne-python/statuses/63702732c88b8d570b5e82cc2a8ee8e890c3d683"}}}}