{"action":"created","comment":{"url":"https://api.github.com/repos/mne-tools/mne-python/pulls/comments/73193553","id":73193553,"diff_hunk":"@@ -0,0 +1,115 @@\n+\"\"\"\n+=============================\n+Regression on continuous data\n+=============================\n+\n+This demonstrates how encoding models can be fit with multiple continuous\n+inputs. In this case, a encoding model is fit for one electrode, using the\n+values of all other electrodes as inputs. These inputs could also be stimulus\n+features, such as spectral features of sound.\n+\n+Estimation of receptive fields and modeling with continuous inputs\n+is described in:\n+\n+    Theunissen, F. E. et al. Estimating spatio-temporal receptive\n+    fields of auditory and visual neurons from their responses to\n+    natural stimuli. Network 12, 289-316 (2001).\n+\n+    Willmore, B. & Smyth, D. Methods for first-order kernel\n+    estimation: simple-cell receptive fields from responses to\n+    natural scenes. Network 14, 553-77 (2003).\n+\"\"\"\n+# Authors: Chris Holdgraf <choldgraf@gmail.com>\n+#\n+# License: BSD (3-clause)\n+\n+import matplotlib.pyplot as plt\n+\n+import mne\n+import numpy as np\n+from mne.datasets import sample\n+from mne.encoding import SampleMasker, get_coefs\n+from mne.channels.layout import _auto_topomap_coords\n+from sklearn.pipeline import make_pipeline\n+from sklearn.linear_model import Ridge\n+from sklearn.preprocessing import StandardScaler, scale\n+\n+# Load and preprocess data\n+data_path = sample.data_path()\n+raw_fname = data_path + '/MEG/sample/sample_audvis_filt-0-40_raw.fif'\n+raw = mne.io.read_raw_fif(raw_fname, preload=True).pick_types(\n+    meg=False, stim=False, eeg=True).filter(1, None, method='iir')\n+ix_y = 10\n+ixs_X = np.setdiff1d(range(len(raw.ch_names)), [ix_y])\n+\n+# Set up encoding model variables\n+X = raw[:][0][ixs_X]","path":"examples/encoding/plot_continuous_encoder.py","position":48,"original_position":46,"commit_id":"8cc39c50c11cba7a966542f24e0dbe3c48fded02","original_commit_id":"15a5bb641b7f7a9edf70f48f531590d992a366ab","user":{"login":"choldgraf","id":1839645,"avatar_url":"https://avatars.githubusercontent.com/u/1839645?v=3","gravatar_id":"","url":"https://api.github.com/users/choldgraf","html_url":"https://github.com/choldgraf","followers_url":"https://api.github.com/users/choldgraf/followers","following_url":"https://api.github.com/users/choldgraf/following{/other_user}","gists_url":"https://api.github.com/users/choldgraf/gists{/gist_id}","starred_url":"https://api.github.com/users/choldgraf/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/choldgraf/subscriptions","organizations_url":"https://api.github.com/users/choldgraf/orgs","repos_url":"https://api.github.com/users/choldgraf/repos","events_url":"https://api.github.com/users/choldgraf/events{/privacy}","received_events_url":"https://api.github.com/users/choldgraf/received_events","type":"User","site_admin":false},"body":"this is related to a comment I made on @agramfort 's TFR PR. I think it'd be nice to have a hidden function `_get_data` that would act to simply return the data for a given MNE object. To me, it'd make sense to have a `get_data` method for any MNE object, in order to standardize the way to do this for them all.","created_at":"2016-08-02T16:52:56Z","updated_at":"2016-08-02T16:52:56Z","html_url":"https://github.com/mne-tools/mne-python/pull/3310#discussion_r73193553","pull_request_url":"https://api.github.com/repos/mne-tools/mne-python/pulls/3310","_links":{"self":{"href":"https://api.github.com/repos/mne-tools/mne-python/pulls/comments/73193553"},"html":{"href":"https://github.com/mne-tools/mne-python/pull/3310#discussion_r73193553"},"pull_request":{"href":"https://api.github.com/repos/mne-tools/mne-python/pulls/3310"}}},"pull_request":{"url":"https://api.github.com/repos/mne-tools/mne-python/pulls/3310","id":74009397,"html_url":"https://github.com/mne-tools/mne-python/pull/3310","diff_url":"https://github.com/mne-tools/mne-python/pull/3310.diff","patch_url":"https://github.com/mne-tools/mne-python/pull/3310.patch","issue_url":"https://api.github.com/repos/mne-tools/mne-python/issues/3310","number":3310,"state":"open","locked":false,"title":"WIP: sklearn-style encoding / modularizing encoding pipelines","user":{"login":"choldgraf","id":1839645,"avatar_url":"https://avatars.githubusercontent.com/u/1839645?v=3","gravatar_id":"","url":"https://api.github.com/users/choldgraf","html_url":"https://github.com/choldgraf","followers_url":"https://api.github.com/users/choldgraf/followers","following_url":"https://api.github.com/users/choldgraf/following{/other_user}","gists_url":"https://api.github.com/users/choldgraf/gists{/gist_id}","starred_url":"https://api.github.com/users/choldgraf/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/choldgraf/subscriptions","organizations_url":"https://api.github.com/users/choldgraf/orgs","repos_url":"https://api.github.com/users/choldgraf/repos","events_url":"https://api.github.com/users/choldgraf/events{/privacy}","received_events_url":"https://api.github.com/users/choldgraf/received_events","type":"User","site_admin":false},"body":"Hey all - this is is a WIP change to port the `linear_regression_raw` code into a more scikit-learn friendly interface. The hope is that this will be more modular and easier to use with cross-validation routines. It also allows support for both continuous and events-based inputs for the regression.\r\n\r\nI haven't changed much of @jona-sassenhagen's code so we can make comparisons, but I can start to do this if the `EncodingModel` class is on the right track. I also wrote a simple example but this should also be improved as well.\r\n\r\nMy hope is that this can be a somewhat incremental PR, and not implement the full preprocessing pipelines / feature extractions / cross validation that people eventually want, so that this doesn't take forever. But agreeing on a general API and making this code function and useful would be a good first step.\r\n\r\n@jona-sassenhagen and @kingjr probably have lots of opinions :)","created_at":"2016-06-16T01:20:58Z","updated_at":"2016-08-02T16:52:56Z","closed_at":null,"merged_at":null,"merge_commit_sha":"dc1bce70fbb5c62a4faba2629992b7ba4cd52ac9","assignee":null,"assignees":[],"milestone":null,"commits_url":"https://api.github.com/repos/mne-tools/mne-python/pulls/3310/commits","review_comments_url":"https://api.github.com/repos/mne-tools/mne-python/pulls/3310/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/3310/comments","statuses_url":"https://api.github.com/repos/mne-tools/mne-python/statuses/8cc39c50c11cba7a966542f24e0dbe3c48fded02","head":{"label":"choldgraf:continuous_encoding","ref":"continuous_encoding","sha":"8cc39c50c11cba7a966542f24e0dbe3c48fded02","user":{"login":"choldgraf","id":1839645,"avatar_url":"https://avatars.githubusercontent.com/u/1839645?v=3","gravatar_id":"","url":"https://api.github.com/users/choldgraf","html_url":"https://github.com/choldgraf","followers_url":"https://api.github.com/users/choldgraf/followers","following_url":"https://api.github.com/users/choldgraf/following{/other_user}","gists_url":"https://api.github.com/users/choldgraf/gists{/gist_id}","starred_url":"https://api.github.com/users/choldgraf/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/choldgraf/subscriptions","organizations_url":"https://api.github.com/users/choldgraf/orgs","repos_url":"https://api.github.com/users/choldgraf/repos","events_url":"https://api.github.com/users/choldgraf/events{/privacy}","received_events_url":"https://api.github.com/users/choldgraf/received_events","type":"User","site_admin":false},"repo":{"id":29602471,"name":"mne-python","full_name":"choldgraf/mne-python","owner":{"login":"choldgraf","id":1839645,"avatar_url":"https://avatars.githubusercontent.com/u/1839645?v=3","gravatar_id":"","url":"https://api.github.com/users/choldgraf","html_url":"https://github.com/choldgraf","followers_url":"https://api.github.com/users/choldgraf/followers","following_url":"https://api.github.com/users/choldgraf/following{/other_user}","gists_url":"https://api.github.com/users/choldgraf/gists{/gist_id}","starred_url":"https://api.github.com/users/choldgraf/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/choldgraf/subscriptions","organizations_url":"https://api.github.com/users/choldgraf/orgs","repos_url":"https://api.github.com/users/choldgraf/repos","events_url":"https://api.github.com/users/choldgraf/events{/privacy}","received_events_url":"https://api.github.com/users/choldgraf/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/choldgraf/mne-python","description":"MNE : Magnetoencephalography (MEG) and Electroencephalography (EEG) in Python","fork":true,"url":"https://api.github.com/repos/choldgraf/mne-python","forks_url":"https://api.github.com/repos/choldgraf/mne-python/forks","keys_url":"https://api.github.com/repos/choldgraf/mne-python/keys{/key_id}","collaborators_url":"https://api.github.com/repos/choldgraf/mne-python/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/choldgraf/mne-python/teams","hooks_url":"https://api.github.com/repos/choldgraf/mne-python/hooks","issue_events_url":"https://api.github.com/repos/choldgraf/mne-python/issues/events{/number}","events_url":"https://api.github.com/repos/choldgraf/mne-python/events","assignees_url":"https://api.github.com/repos/choldgraf/mne-python/assignees{/user}","branches_url":"https://api.github.com/repos/choldgraf/mne-python/branches{/branch}","tags_url":"https://api.github.com/repos/choldgraf/mne-python/tags","blobs_url":"https://api.github.com/repos/choldgraf/mne-python/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/choldgraf/mne-python/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/choldgraf/mne-python/git/refs{/sha}","trees_url":"https://api.github.com/repos/choldgraf/mne-python/git/trees{/sha}","statuses_url":"https://api.github.com/repos/choldgraf/mne-python/statuses/{sha}","languages_url":"https://api.github.com/repos/choldgraf/mne-python/languages","stargazers_url":"https://api.github.com/repos/choldgraf/mne-python/stargazers","contributors_url":"https://api.github.com/repos/choldgraf/mne-python/contributors","subscribers_url":"https://api.github.com/repos/choldgraf/mne-python/subscribers","subscription_url":"https://api.github.com/repos/choldgraf/mne-python/subscription","commits_url":"https://api.github.com/repos/choldgraf/mne-python/commits{/sha}","git_commits_url":"https://api.github.com/repos/choldgraf/mne-python/git/commits{/sha}","comments_url":"https://api.github.com/repos/choldgraf/mne-python/comments{/number}","issue_comment_url":"https://api.github.com/repos/choldgraf/mne-python/issues/comments{/number}","contents_url":"https://api.github.com/repos/choldgraf/mne-python/contents/{+path}","compare_url":"https://api.github.com/repos/choldgraf/mne-python/compare/{base}...{head}","merges_url":"https://api.github.com/repos/choldgraf/mne-python/merges","archive_url":"https://api.github.com/repos/choldgraf/mne-python/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/choldgraf/mne-python/downloads","issues_url":"https://api.github.com/repos/choldgraf/mne-python/issues{/number}","pulls_url":"https://api.github.com/repos/choldgraf/mne-python/pulls{/number}","milestones_url":"https://api.github.com/repos/choldgraf/mne-python/milestones{/number}","notifications_url":"https://api.github.com/repos/choldgraf/mne-python/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/choldgraf/mne-python/labels{/name}","releases_url":"https://api.github.com/repos/choldgraf/mne-python/releases{/id}","deployments_url":"https://api.github.com/repos/choldgraf/mne-python/deployments","created_at":"2015-01-21T17:41:37Z","updated_at":"2016-07-26T20:46:29Z","pushed_at":"2016-08-02T03:11:41Z","git_url":"git://github.com/choldgraf/mne-python.git","ssh_url":"git@github.com:choldgraf/mne-python.git","clone_url":"https://github.com/choldgraf/mne-python.git","svn_url":"https://github.com/choldgraf/mne-python","homepage":"http://martinos.org/mne/","size":87935,"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":"e71529b88417d634330cb8a5249633fed63a59fc","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}","deployments_url":"https://api.github.com/repos/mne-tools/mne-python/deployments","created_at":"2011-01-28T03:31:13Z","updated_at":"2016-07-31T20:39:25Z","pushed_at":"2016-08-02T14:50:14Z","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":180469,"stargazers_count":218,"watchers_count":218,"language":"Python","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":206,"mirror_url":null,"open_issues_count":195,"forks":206,"open_issues":195,"watchers":218,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/mne-tools/mne-python/pulls/3310"},"html":{"href":"https://github.com/mne-tools/mne-python/pull/3310"},"issue":{"href":"https://api.github.com/repos/mne-tools/mne-python/issues/3310"},"comments":{"href":"https://api.github.com/repos/mne-tools/mne-python/issues/3310/comments"},"review_comments":{"href":"https://api.github.com/repos/mne-tools/mne-python/pulls/3310/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/3310/commits"},"statuses":{"href":"https://api.github.com/repos/mne-tools/mne-python/statuses/8cc39c50c11cba7a966542f24e0dbe3c48fded02"}}}}
{"actor":{"display_login":"choldgraf"}}