{"action":"created","comment":{"url":"https://api.github.com/repos/mne-tools/mne-python/pulls/comments/93813982","pull_request_review_id":14350633,"id":93813982,"diff_hunk":"@@ -61,29 +93,60 @@ def fit(self, epochs_data, y):\n         self : instance of Scaler\n             Returns the modified instance.\n         \"\"\"\n+        from sklearn.base import clone\n         if not isinstance(epochs_data, np.ndarray):\n             raise ValueError(\"epochs_data should be of type ndarray (got %s).\"\n                              % type(epochs_data))\n \n         X = np.atleast_3d(epochs_data)\n+        n_epochs, n_channels, n_times = X.shape\n+        X = X.transpose(1, 0, 2)\n+        self.ch_mean_ = np.zeros(n_channels)\n+        self.scale_ = np.zeros(n_channels)\n+        self.ch_median_ = np.zeros(n_channels)\n+\n+        if self.scalings == 'standard':\n+            from sklearn.preprocessing import StandardScaler\n+            std_scaler = StandardScaler(self.with_mean, self.with_std)\n+            self.scalers_ = list()\n+            X = X.reshape(n_channels, -1)\n+            for _, pick in self._pick_types:\n+                scaler = clone(std_scaler)\n+                scaler.fit(X[pick].T)\n+                self.scalers_.append(scaler)\n+\n+                # StandardScaler scale_ attribute introduced in version 0.18\n+                if hasattr(scaler, \"scale_\"):\n+                    self.ch_mean_[pick], self.scale_[pick] = (\n+                        scaler.mean_, scaler.scale_)\n+                else:\n+                    self.ch_mean_[pick], self.scale_[pick] = (","path":"mne/decoding/transformer.py","position":119,"original_position":119,"commit_id":"448f8e36af862528c994ebaa5bdebf2a64593782","original_commit_id":"448f8e36af862528c994ebaa5bdebf2a64593782","user":{"login":"kaichogami","id":6412770,"avatar_url":"https://avatars.githubusercontent.com/u/6412770?v=3","gravatar_id":"","url":"https://api.github.com/users/kaichogami","html_url":"https://github.com/kaichogami","followers_url":"https://api.github.com/users/kaichogami/followers","following_url":"https://api.github.com/users/kaichogami/following{/other_user}","gists_url":"https://api.github.com/users/kaichogami/gists{/gist_id}","starred_url":"https://api.github.com/users/kaichogami/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/kaichogami/subscriptions","organizations_url":"https://api.github.com/users/kaichogami/orgs","repos_url":"https://api.github.com/users/kaichogami/repos","events_url":"https://api.github.com/users/kaichogami/events{/privacy}","received_events_url":"https://api.github.com/users/kaichogami/received_events","type":"User","site_admin":false},"body":"Again, the same reason as above, usage for the users after scaling.. If not required I will remove all the three attributes.","created_at":"2016-12-24T07:29:40Z","updated_at":"2016-12-24T07:29:40Z","html_url":"https://github.com/mne-tools/mne-python/pull/3672#discussion_r93813982","pull_request_url":"https://api.github.com/repos/mne-tools/mne-python/pulls/3672","_links":{"self":{"href":"https://api.github.com/repos/mne-tools/mne-python/pulls/comments/93813982"},"html":{"href":"https://github.com/mne-tools/mne-python/pull/3672#discussion_r93813982"},"pull_request":{"href":"https://api.github.com/repos/mne-tools/mne-python/pulls/3672"}}},"pull_request":{"url":"https://api.github.com/repos/mne-tools/mne-python/pulls/3672","id":89824752,"html_url":"https://github.com/mne-tools/mne-python/pull/3672","diff_url":"https://github.com/mne-tools/mne-python/pull/3672.diff","patch_url":"https://github.com/mne-tools/mne-python/pull/3672.patch","issue_url":"https://api.github.com/repos/mne-tools/mne-python/issues/3672","number":3672,"state":"open","locked":false,"title":"Added scaler parameter to change scaling method","user":{"login":"kaichogami","id":6412770,"avatar_url":"https://avatars.githubusercontent.com/u/6412770?v=3","gravatar_id":"","url":"https://api.github.com/users/kaichogami","html_url":"https://github.com/kaichogami","followers_url":"https://api.github.com/users/kaichogami/followers","following_url":"https://api.github.com/users/kaichogami/following{/other_user}","gists_url":"https://api.github.com/users/kaichogami/gists{/gist_id}","starred_url":"https://api.github.com/users/kaichogami/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/kaichogami/subscriptions","organizations_url":"https://api.github.com/users/kaichogami/orgs","repos_url":"https://api.github.com/users/kaichogami/repos","events_url":"https://api.github.com/users/kaichogami/events{/privacy}","received_events_url":"https://api.github.com/users/kaichogami/received_events","type":"User","site_admin":false},"body":"Solves issue #3665 \n@kingjr @agramfort \n","created_at":"2016-10-18T14:16:58Z","updated_at":"2016-12-24T07:29:40Z","closed_at":null,"merged_at":null,"merge_commit_sha":"cc1d407d959f7d140e2076db4ec3f725ff261f28","assignee":null,"assignees":[],"milestone":null,"commits_url":"https://api.github.com/repos/mne-tools/mne-python/pulls/3672/commits","review_comments_url":"https://api.github.com/repos/mne-tools/mne-python/pulls/3672/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/3672/comments","statuses_url":"https://api.github.com/repos/mne-tools/mne-python/statuses/448f8e36af862528c994ebaa5bdebf2a64593782","head":{"label":"kaichogami:scaler","ref":"scaler","sha":"448f8e36af862528c994ebaa5bdebf2a64593782","user":{"login":"kaichogami","id":6412770,"avatar_url":"https://avatars.githubusercontent.com/u/6412770?v=3","gravatar_id":"","url":"https://api.github.com/users/kaichogami","html_url":"https://github.com/kaichogami","followers_url":"https://api.github.com/users/kaichogami/followers","following_url":"https://api.github.com/users/kaichogami/following{/other_user}","gists_url":"https://api.github.com/users/kaichogami/gists{/gist_id}","starred_url":"https://api.github.com/users/kaichogami/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/kaichogami/subscriptions","organizations_url":"https://api.github.com/users/kaichogami/orgs","repos_url":"https://api.github.com/users/kaichogami/repos","events_url":"https://api.github.com/users/kaichogami/events{/privacy}","received_events_url":"https://api.github.com/users/kaichogami/received_events","type":"User","site_admin":false},"repo":{"id":52144716,"name":"mne-python","full_name":"kaichogami/mne-python","owner":{"login":"kaichogami","id":6412770,"avatar_url":"https://avatars.githubusercontent.com/u/6412770?v=3","gravatar_id":"","url":"https://api.github.com/users/kaichogami","html_url":"https://github.com/kaichogami","followers_url":"https://api.github.com/users/kaichogami/followers","following_url":"https://api.github.com/users/kaichogami/following{/other_user}","gists_url":"https://api.github.com/users/kaichogami/gists{/gist_id}","starred_url":"https://api.github.com/users/kaichogami/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/kaichogami/subscriptions","organizations_url":"https://api.github.com/users/kaichogami/orgs","repos_url":"https://api.github.com/users/kaichogami/repos","events_url":"https://api.github.com/users/kaichogami/events{/privacy}","received_events_url":"https://api.github.com/users/kaichogami/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/kaichogami/mne-python","description":"MNE : Magnetoencephalography (MEG) and Electroencephalography (EEG) in Python","fork":true,"url":"https://api.github.com/repos/kaichogami/mne-python","forks_url":"https://api.github.com/repos/kaichogami/mne-python/forks","keys_url":"https://api.github.com/repos/kaichogami/mne-python/keys{/key_id}","collaborators_url":"https://api.github.com/repos/kaichogami/mne-python/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/kaichogami/mne-python/teams","hooks_url":"https://api.github.com/repos/kaichogami/mne-python/hooks","issue_events_url":"https://api.github.com/repos/kaichogami/mne-python/issues/events{/number}","events_url":"https://api.github.com/repos/kaichogami/mne-python/events","assignees_url":"https://api.github.com/repos/kaichogami/mne-python/assignees{/user}","branches_url":"https://api.github.com/repos/kaichogami/mne-python/branches{/branch}","tags_url":"https://api.github.com/repos/kaichogami/mne-python/tags","blobs_url":"https://api.github.com/repos/kaichogami/mne-python/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/kaichogami/mne-python/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/kaichogami/mne-python/git/refs{/sha}","trees_url":"https://api.github.com/repos/kaichogami/mne-python/git/trees{/sha}","statuses_url":"https://api.github.com/repos/kaichogami/mne-python/statuses/{sha}","languages_url":"https://api.github.com/repos/kaichogami/mne-python/languages","stargazers_url":"https://api.github.com/repos/kaichogami/mne-python/stargazers","contributors_url":"https://api.github.com/repos/kaichogami/mne-python/contributors","subscribers_url":"https://api.github.com/repos/kaichogami/mne-python/subscribers","subscription_url":"https://api.github.com/repos/kaichogami/mne-python/subscription","commits_url":"https://api.github.com/repos/kaichogami/mne-python/commits{/sha}","git_commits_url":"https://api.github.com/repos/kaichogami/mne-python/git/commits{/sha}","comments_url":"https://api.github.com/repos/kaichogami/mne-python/comments{/number}","issue_comment_url":"https://api.github.com/repos/kaichogami/mne-python/issues/comments{/number}","contents_url":"https://api.github.com/repos/kaichogami/mne-python/contents/{+path}","compare_url":"https://api.github.com/repos/kaichogami/mne-python/compare/{base}...{head}","merges_url":"https://api.github.com/repos/kaichogami/mne-python/merges","archive_url":"https://api.github.com/repos/kaichogami/mne-python/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/kaichogami/mne-python/downloads","issues_url":"https://api.github.com/repos/kaichogami/mne-python/issues{/number}","pulls_url":"https://api.github.com/repos/kaichogami/mne-python/pulls{/number}","milestones_url":"https://api.github.com/repos/kaichogami/mne-python/milestones{/number}","notifications_url":"https://api.github.com/repos/kaichogami/mne-python/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/kaichogami/mne-python/labels{/name}","releases_url":"https://api.github.com/repos/kaichogami/mne-python/releases{/id}","deployments_url":"https://api.github.com/repos/kaichogami/mne-python/deployments","created_at":"2016-02-20T08:49:13Z","updated_at":"2016-02-20T08:49:17Z","pushed_at":"2016-12-22T14:20:19Z","git_url":"git://github.com/kaichogami/mne-python.git","ssh_url":"git@github.com:kaichogami/mne-python.git","clone_url":"https://github.com/kaichogami/mne-python.git","svn_url":"https://github.com/kaichogami/mne-python","homepage":"http://martinos.org/mne/","size":91003,"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":"5355095401dea28687d5158ddf8a2ec3bcef3451","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-12-24T06:01:25Z","pushed_at":"2016-12-23T03:15:55Z","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":90784,"stargazers_count":257,"watchers_count":257,"language":"Python","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":230,"mirror_url":null,"open_issues_count":216,"forks":230,"open_issues":216,"watchers":257,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/mne-tools/mne-python/pulls/3672"},"html":{"href":"https://github.com/mne-tools/mne-python/pull/3672"},"issue":{"href":"https://api.github.com/repos/mne-tools/mne-python/issues/3672"},"comments":{"href":"https://api.github.com/repos/mne-tools/mne-python/issues/3672/comments"},"review_comments":{"href":"https://api.github.com/repos/mne-tools/mne-python/pulls/3672/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/3672/commits"},"statuses":{"href":"https://api.github.com/repos/mne-tools/mne-python/statuses/448f8e36af862528c994ebaa5bdebf2a64593782"}}}}
{"actor":{"display_login":"kaichogami"}}