GitHub PullRequestReviewCommentEvent at 2014-08-15 10:01:04
Repository: scikit-learn
Actor: vene
Payload: {"action":"created","comment":{"url":"https://api.github.com/repos/scikit-learn/scikit-learn/pulls/comments/16286396","id":16286396,"diff_hunk":"@@ -0,0 +1,241 @@\n+.. _neural_network:\n+\n+==================================\n+Neural network models (supervised)\n+==================================\n+\n+.. currentmodule:: sklearn.neural_network\n+\n+\n+.. _elm:\n+\n+Extreme Learning Machines\n+=========================\n+**Extreme Learning Machine (ELM)** is a supervised nonlinear learning \n+algorithm that takes the following consecutive steps for training:\n+\n+  *  it applies a random projection on the input space to a possibly larger \n+     dimensional space;\n+  *  the result passes through an element-wise non-linear activation function,\n+     typically a sigmoid such as the tanh, and logistic functions; and\n+  *  last, it trains a linear one vs. rest classifier or a multi-output ridge \n+     regression model.\n+\n+ELM can be considered as a single-hidden layer feedforward neural network \n+(see figure 1) where:\n+\n+  *  it trains only the hidden-to-output connection weights;\n+  *  assigns random values, as constants, to the input-to-hidden connection \n+     weights; and\n+  *  minimizes the loss function using least squares.\n+\n+In several empirical studies, ELM was found to have a generalization performance \n+similar to that of 1 hidden layer multi-layer perceptron (MLP) or radial\n+basis function (RBF) kernel support vector machines while being significantly \n+faster to train.\n+\n+\n+.. figure:: ../images/neural_network.png\n+     :align: center\n+     :scale: 60%\n+\n+     Figure 1 : Single-hidden layer feedforward network.\n+\n+\n+ELM has three main hyper-parameters,\n+\n+  *  `weight_scale`: controls the variance of the random projection weights;\n+  *  `n_hidden`: controls the number of hidden layer nodes; and\n+  *  `C`: controls the regularization strength of the output linear model.\n+\n+`weight_scale` and `C` are similar in that they regularize weight parameters\n+such that a higher value means less regularization hence less underfitting (or bias) but \n+potentially more overfitting (or variance). However, in terms of their effect \n+on the single-hidden layer feedforward network, `weight_scale` regularizes \n+the input-to-hidden connection weights, whereas `C` regularizes the hidden-to-output \n+connection weights. Some examples demonstrating the effect of these two parameters are listed\n+below::\n+\n+.. figure:: ../auto_examples/neural_networks/images/plot_elm_scale_C_and_weight_scale_001.png\n+   :target: ../auto_examples/neural_networks/plot_elm_scale_C_and_weight_scale.html\n+   :align: center\n+   :scale: 100%\n+\n+.. topic:: Examples:\n+\n+   * :ref:`example_neural_networks_plot_elm_scale_C_and_weight_scale.py`\n+\n+\n+.. figure:: ../auto_examples/neural_networks/images/plot_elm_hyperparameters_001.png\n+   :target: ../auto_examples/neural_networks/plot_elm_hyperparameters.html\n+   :align: center\n+   :scale: 100%\n+\n+.. topic:: Examples:\n+\n+   * :ref:`example_neural_networks_plot_elm_hyperparameters.py`\n+\n+\n+Higher `n_hidden` provides ELM with a higher capacity to learn complex \n+functions. It allows ELM to have more feature detectors in the hidden \n+layer that characterize the training dataset. \n+\n+\n+This implements :ref:`classification <elm_classification>` for classification \n+and :ref:`regression <elm_regression>` for regression. They support both dense\n+(``numpy.ndarray`` and convertible to that by ``numpy.asarray``) and\n+sparse (any ``scipy.sparse``) sample vectors as input. They also support\n+on-line and batch-based training.\n+\n+\n+.. _elm_classification:\n+\n+Classification\n+==============\n+\n+:class:`ELMClassifier` supports binary-class, multi-class, and\n+multi-label classification on datasets.\n+\n+Like other classifiers, :class:`ELMClassifier` trains on a dataset using the\n+fit method that accepts two input parameters: an array X of size \n+``(n_samples, n_features)``, which represents the training samples, and an array y \n+of integer values of size ``(n_samples)``, which holdis the class labels respective\n+to the training samples::\n+\n+\n+    >>> from sklearn.neural_network import ELMClassifier\n+    >>> X = [[0, 0], [1, 1]]\n+    >>> y = [0, 1]\n+    >>> clf = ELMClassifier(random_state=1)\n+    >>> clf.fit(X, y)\n+    ELMClassifier(C=1, activation='tanh', batch_size=None, class_weight=None,\n+           n_hidden=500, random_state=1, verbose=False, warm_start=False,\n+           weight_scale=0.1)\n+\n+After training, the model can predict the class of a new sample::\n+\n+    >>> clf.predict([[2., 2.]])\n+    array([1])\n+\n+\n+Weighted classification\n+-----------------------\n+\n+For datasets containing an imbalanced ratio of class frequencies, it is\n+important to consider adding more weight to classes having less samples than\n+others. \n+\n+:class:`ELMClassifier` has the parameter ``class_weight`` in\n+its ``fit`` method that can be set either to ``None`` - where all samples\n+are treated the same; ``auto`` - where weight is given to a sample based\n+on its class distribution in the dataset; and a dictionary of the form\n+``{class_label : value}`` - which assigns each sample a weight ``value``","path":"doc/modules/neural_networks_supervised.rst","position":132,"original_position":132,"commit_id":"1c549293116c7a50375d4a30dbec5d2f20a2f979","original_commit_id":"1c549293116c7a50375d4a30dbec5d2f20a2f979","user":{"login":"vene","id":241745,"avatar_url":"https://avatars.githubusercontent.com/u/241745?v=2","gravatar_id":"b75596821d60780897218679101cf28f","url":"https://api.github.com/users/vene","html_url":"https://github.com/vene","followers_url":"https://api.github.com/users/vene/followers","following_url":"https://api.github.com/users/vene/following{/other_user}","gists_url":"https://api.github.com/users/vene/gists{/gist_id}","starred_url":"https://api.github.com/users/vene/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/vene/subscriptions","organizations_url":"https://api.github.com/users/vene/orgs","repos_url":"https://api.github.com/users/vene/repos","events_url":"https://api.github.com/users/vene/events{/privacy}","received_events_url":"https://api.github.com/users/vene/received_events","type":"User","site_admin":false},"body":"you could just say ``{class_label: class_weight}`` and there wouldn't be any need for an explanation IMO.","created_at":"2014-08-15T10:01:04Z","updated_at":"2014-08-15T10:01:04Z","html_url":"https://github.com/scikit-learn/scikit-learn/pull/3306#discussion_r16286396","pull_request_url":"https://api.github.com/repos/scikit-learn/scikit-learn/pulls/3306","_links":{"self":{"href":"https://api.github.com/repos/scikit-learn/scikit-learn/pulls/comments/16286396"},"html":{"href":"https://github.com/scikit-learn/scikit-learn/pull/3306#discussion_r16286396"},"pull_request":{"href":"https://api.github.com/repos/scikit-learn/scikit-learn/pulls/3306"}}},"pull_request":{"url":"https://api.github.com/repos/scikit-learn/scikit-learn/pulls/3306","id":17446637,"html_url":"https://github.com/scikit-learn/scikit-learn/pull/3306","diff_url":"https://github.com/scikit-learn/scikit-learn/pull/3306.diff","patch_url":"https://github.com/scikit-learn/scikit-learn/pull/3306.patch","issue_url":"https://api.github.com/repos/scikit-learn/scikit-learn/issues/3306","number":3306,"state":"open","locked":false,"title":"GSoC 2014: Standard Extreme Learning Machines","user":{"login":"IssamLaradji","id":3382128,"avatar_url":"https://avatars.githubusercontent.com/u/3382128?v=2","gravatar_id":"e35d22a037b8b35422d3ee982f133076","url":"https://api.github.com/users/IssamLaradji","html_url":"https://github.com/IssamLaradji","followers_url":"https://api.github.com/users/IssamLaradji/followers","following_url":"https://api.github.com/users/IssamLaradji/following{/other_user}","gists_url":"https://api.github.com/users/IssamLaradji/gists{/gist_id}","starred_url":"https://api.github.com/users/IssamLaradji/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/IssamLaradji/subscriptions","organizations_url":"https://api.github.com/users/IssamLaradji/orgs","repos_url":"https://api.github.com/users/IssamLaradji/repos","events_url":"https://api.github.com/users/IssamLaradji/events{/privacy}","received_events_url":"https://api.github.com/users/IssamLaradji/received_events","type":"User","site_admin":false},"body":"Finished implementing the standard extreme learning machines (ELMs). I am getting the following results with 550 hidden neurons against the digits datasets,\r\n\r\nTraining accuracy using the logistic activation function: 0.999444\r\nTraining accuracy using the tanh activation function: 1.000000\r\n\r\nFortunately, this algorithm is much easier to implement and debug than multi-layer perceptron :).\r\nI will push a test file soon.\r\n\r\n@ogrisel , @larsmans","created_at":"2014-06-22T08:34:21Z","updated_at":"2014-08-15T10:01:04Z","closed_at":null,"merged_at":null,"merge_commit_sha":"0c204bdae183529341f918f9fc7a60be4eef69a8","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/scikit-learn/scikit-learn/pulls/3306/commits","review_comments_url":"https://api.github.com/repos/scikit-learn/scikit-learn/pulls/3306/comments","review_comment_url":"https://api.github.com/repos/scikit-learn/scikit-learn/pulls/comments/{number}","comments_url":"https://api.github.com/repos/scikit-learn/scikit-learn/issues/3306/comments","statuses_url":"https://api.github.com/repos/scikit-learn/scikit-learn/statuses/1c549293116c7a50375d4a30dbec5d2f20a2f979","head":{"label":"IssamLaradji:Extreme-Learning-Machines","ref":"Extreme-Learning-Machines","sha":"1c549293116c7a50375d4a30dbec5d2f20a2f979","user":{"login":"IssamLaradji","id":3382128,"avatar_url":"https://avatars.githubusercontent.com/u/3382128?v=2","gravatar_id":"e35d22a037b8b35422d3ee982f133076","url":"https://api.github.com/users/IssamLaradji","html_url":"https://github.com/IssamLaradji","followers_url":"https://api.github.com/users/IssamLaradji/followers","following_url":"https://api.github.com/users/IssamLaradji/following{/other_user}","gists_url":"https://api.github.com/users/IssamLaradji/gists{/gist_id}","starred_url":"https://api.github.com/users/IssamLaradji/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/IssamLaradji/subscriptions","organizations_url":"https://api.github.com/users/IssamLaradji/orgs","repos_url":"https://api.github.com/users/IssamLaradji/repos","events_url":"https://api.github.com/users/IssamLaradji/events{/privacy}","received_events_url":"https://api.github.com/users/IssamLaradji/received_events","type":"User","site_admin":false},"repo":{"id":10518207,"name":"scikit-learn","full_name":"IssamLaradji/scikit-learn","owner":{"login":"IssamLaradji","id":3382128,"avatar_url":"https://avatars.githubusercontent.com/u/3382128?v=2","gravatar_id":"e35d22a037b8b35422d3ee982f133076","url":"https://api.github.com/users/IssamLaradji","html_url":"https://github.com/IssamLaradji","followers_url":"https://api.github.com/users/IssamLaradji/followers","following_url":"https://api.github.com/users/IssamLaradji/following{/other_user}","gists_url":"https://api.github.com/users/IssamLaradji/gists{/gist_id}","starred_url":"https://api.github.com/users/IssamLaradji/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/IssamLaradji/subscriptions","organizations_url":"https://api.github.com/users/IssamLaradji/orgs","repos_url":"https://api.github.com/users/IssamLaradji/repos","events_url":"https://api.github.com/users/IssamLaradji/events{/privacy}","received_events_url":"https://api.github.com/users/IssamLaradji/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/IssamLaradji/scikit-learn","description":"scikit-learn: machine learning in Python","fork":true,"url":"https://api.github.com/repos/IssamLaradji/scikit-learn","forks_url":"https://api.github.com/repos/IssamLaradji/scikit-learn/forks","keys_url":"https://api.github.com/repos/IssamLaradji/scikit-learn/keys{/key_id}","collaborators_url":"https://api.github.com/repos/IssamLaradji/scikit-learn/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/IssamLaradji/scikit-learn/teams","hooks_url":"https://api.github.com/repos/IssamLaradji/scikit-learn/hooks","issue_events_url":"https://api.github.com/repos/IssamLaradji/scikit-learn/issues/events{/number}","events_url":"https://api.github.com/repos/IssamLaradji/scikit-learn/events","assignees_url":"https://api.github.com/repos/IssamLaradji/scikit-learn/assignees{/user}","branches_url":"https://api.github.com/repos/IssamLaradji/scikit-learn/branches{/branch}","tags_url":"https://api.github.com/repos/IssamLaradji/scikit-learn/tags","blobs_url":"https://api.github.com/repos/IssamLaradji/scikit-learn/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/IssamLaradji/scikit-learn/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/IssamLaradji/scikit-learn/git/refs{/sha}","trees_url":"https://api.github.com/repos/IssamLaradji/scikit-learn/git/trees{/sha}","statuses_url":"https://api.github.com/repos/IssamLaradji/scikit-learn/statuses/{sha}","languages_url":"https://api.github.com/repos/IssamLaradji/scikit-learn/languages","stargazers_url":"https://api.github.com/repos/IssamLaradji/scikit-learn/stargazers","contributors_url":"https://api.github.com/repos/IssamLaradji/scikit-learn/contributors","subscribers_url":"https://api.github.com/repos/IssamLaradji/scikit-learn/subscribers","subscription_url":"https://api.github.com/repos/IssamLaradji/scikit-learn/subscription","commits_url":"https://api.github.com/repos/IssamLaradji/scikit-learn/commits{/sha}","git_commits_url":"https://api.github.com/repos/IssamLaradji/scikit-learn/git/commits{/sha}","comments_url":"https://api.github.com/repos/IssamLaradji/scikit-learn/comments{/number}","issue_comment_url":"https://api.github.com/repos/IssamLaradji/scikit-learn/issues/comments/{number}","contents_url":"https://api.github.com/repos/IssamLaradji/scikit-learn/contents/{+path}","compare_url":"https://api.github.com/repos/IssamLaradji/scikit-learn/compare/{base}...{head}","merges_url":"https://api.github.com/repos/IssamLaradji/scikit-learn/merges","archive_url":"https://api.github.com/repos/IssamLaradji/scikit-learn/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/IssamLaradji/scikit-learn/downloads","issues_url":"https://api.github.com/repos/IssamLaradji/scikit-learn/issues{/number}","pulls_url":"https://api.github.com/repos/IssamLaradji/scikit-learn/pulls{/number}","milestones_url":"https://api.github.com/repos/IssamLaradji/scikit-learn/milestones{/number}","notifications_url":"https://api.github.com/repos/IssamLaradji/scikit-learn/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/IssamLaradji/scikit-learn/labels{/name}","releases_url":"https://api.github.com/repos/IssamLaradji/scikit-learn/releases{/id}","created_at":"2013-06-06T03:31:53Z","updated_at":"2014-06-24T12:42:31Z","pushed_at":"2014-08-14T23:52:15Z","git_url":"git://github.com/IssamLaradji/scikit-learn.git","ssh_url":"git@github.com:IssamLaradji/scikit-learn.git","clone_url":"https://github.com/IssamLaradji/scikit-learn.git","svn_url":"https://github.com/IssamLaradji/scikit-learn","homepage":"http://scikit-learn.org","size":58501,"stargazers_count":0,"watchers_count":0,"language":"C","has_issues":false,"has_downloads":true,"has_wiki":true,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"scikit-learn:master","ref":"master","sha":"52023128fed1102f0863697d1406e8b4e5273884","user":{"login":"scikit-learn","id":365630,"avatar_url":"https://avatars.githubusercontent.com/u/365630?v=2","gravatar_id":"8a6ecb57b119c5a5b3d882d08a909278","url":"https://api.github.com/users/scikit-learn","html_url":"https://github.com/scikit-learn","followers_url":"https://api.github.com/users/scikit-learn/followers","following_url":"https://api.github.com/users/scikit-learn/following{/other_user}","gists_url":"https://api.github.com/users/scikit-learn/gists{/gist_id}","starred_url":"https://api.github.com/users/scikit-learn/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/scikit-learn/subscriptions","organizations_url":"https://api.github.com/users/scikit-learn/orgs","repos_url":"https://api.github.com/users/scikit-learn/repos","events_url":"https://api.github.com/users/scikit-learn/events{/privacy}","received_events_url":"https://api.github.com/users/scikit-learn/received_events","type":"Organization","site_admin":false},"repo":{"id":843222,"name":"scikit-learn","full_name":"scikit-learn/scikit-learn","owner":{"login":"scikit-learn","id":365630,"avatar_url":"https://avatars.githubusercontent.com/u/365630?v=2","gravatar_id":"8a6ecb57b119c5a5b3d882d08a909278","url":"https://api.github.com/users/scikit-learn","html_url":"https://github.com/scikit-learn","followers_url":"https://api.github.com/users/scikit-learn/followers","following_url":"https://api.github.com/users/scikit-learn/following{/other_user}","gists_url":"https://api.github.com/users/scikit-learn/gists{/gist_id}","starred_url":"https://api.github.com/users/scikit-learn/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/scikit-learn/subscriptions","organizations_url":"https://api.github.com/users/scikit-learn/orgs","repos_url":"https://api.github.com/users/scikit-learn/repos","events_url":"https://api.github.com/users/scikit-learn/events{/privacy}","received_events_url":"https://api.github.com/users/scikit-learn/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/scikit-learn/scikit-learn","description":"scikit-learn: machine learning in Python","fork":false,"url":"https://api.github.com/repos/scikit-learn/scikit-learn","forks_url":"https://api.github.com/repos/scikit-learn/scikit-learn/forks","keys_url":"https://api.github.com/repos/scikit-learn/scikit-learn/keys{/key_id}","collaborators_url":"https://api.github.com/repos/scikit-learn/scikit-learn/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/scikit-learn/scikit-learn/teams","hooks_url":"https://api.github.com/repos/scikit-learn/scikit-learn/hooks","issue_events_url":"https://api.github.com/repos/scikit-learn/scikit-learn/issues/events{/number}","events_url":"https://api.github.com/repos/scikit-learn/scikit-learn/events","assignees_url":"https://api.github.com/repos/scikit-learn/scikit-learn/assignees{/user}","branches_url":"https://api.github.com/repos/scikit-learn/scikit-learn/branches{/branch}","tags_url":"https://api.github.com/repos/scikit-learn/scikit-learn/tags","blobs_url":"https://api.github.com/repos/scikit-learn/scikit-learn/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/scikit-learn/scikit-learn/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/scikit-learn/scikit-learn/git/refs{/sha}","trees_url":"https://api.github.com/repos/scikit-learn/scikit-learn/git/trees{/sha}","statuses_url":"https://api.github.com/repos/scikit-learn/scikit-learn/statuses/{sha}","languages_url":"https://api.github.com/repos/scikit-learn/scikit-learn/languages","stargazers_url":"https://api.github.com/repos/scikit-learn/scikit-learn/stargazers","contributors_url":"https://api.github.com/repos/scikit-learn/scikit-learn/contributors","subscribers_url":"https://api.github.com/repos/scikit-learn/scikit-learn/subscribers","subscription_url":"https://api.github.com/repos/scikit-learn/scikit-learn/subscription","commits_url":"https://api.github.com/repos/scikit-learn/scikit-learn/commits{/sha}","git_commits_url":"https://api.github.com/repos/scikit-learn/scikit-learn/git/commits{/sha}","comments_url":"https://api.github.com/repos/scikit-learn/scikit-learn/comments{/number}","issue_comment_url":"https://api.github.com/repos/scikit-learn/scikit-learn/issues/comments/{number}","contents_url":"https://api.github.com/repos/scikit-learn/scikit-learn/contents/{+path}","compare_url":"https://api.github.com/repos/scikit-learn/scikit-learn/compare/{base}...{head}","merges_url":"https://api.github.com/repos/scikit-learn/scikit-learn/merges","archive_url":"https://api.github.com/repos/scikit-learn/scikit-learn/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/scikit-learn/scikit-learn/downloads","issues_url":"https://api.github.com/repos/scikit-learn/scikit-learn/issues{/number}","pulls_url":"https://api.github.com/repos/scikit-learn/scikit-learn/pulls{/number}","milestones_url":"https://api.github.com/repos/scikit-learn/scikit-learn/milestones{/number}","notifications_url":"https://api.github.com/repos/scikit-learn/scikit-learn/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/scikit-learn/scikit-learn/labels{/name}","releases_url":"https://api.github.com/repos/scikit-learn/scikit-learn/releases{/id}","created_at":"2010-08-17T09:43:38Z","updated_at":"2014-08-15T08:22:46Z","pushed_at":"2014-08-14T09:09:22Z","git_url":"git://github.com/scikit-learn/scikit-learn.git","ssh_url":"git@github.com:scikit-learn/scikit-learn.git","clone_url":"https://github.com/scikit-learn/scikit-learn.git","svn_url":"https://github.com/scikit-learn/scikit-learn","homepage":"http://scikit-learn.org","size":115384,"stargazers_count":3833,"watchers_count":3833,"language":"C","has_issues":true,"has_downloads":true,"has_wiki":true,"forks_count":2034,"mirror_url":null,"open_issues_count":470,"forks":2034,"open_issues":470,"watchers":3833,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/scikit-learn/scikit-learn/pulls/3306"},"html":{"href":"https://github.com/scikit-learn/scikit-learn/pull/3306"},"issue":{"href":"https://api.github.com/repos/scikit-learn/scikit-learn/issues/3306"},"comments":{"href":"https://api.github.com/repos/scikit-learn/scikit-learn/issues/3306/comments"},"review_comments":{"href":"https://api.github.com/repos/scikit-learn/scikit-learn/pulls/3306/comments"},"review_comment":{"href":"https://api.github.com/repos/scikit-learn/scikit-learn/pulls/comments/{number}"},"commits":{"href":"https://api.github.com/repos/scikit-learn/scikit-learn/pulls/3306/commits"},"statuses":{"href":"https://api.github.com/repos/scikit-learn/scikit-learn/statuses/1c549293116c7a50375d4a30dbec5d2f20a2f979"}}}}