{"action":"created","comment":{"url":"https://api.github.com/repos/mlpack/mlpack/pulls/comments/171879906","pull_request_review_id":100813838,"id":171879906,"diff_hunk":"@@ -0,0 +1,87 @@\n+/**\n+ * @file alpha_dropout_impl.hpp\n+ * @author Dakshit Agrawal\n+ *\n+ * Definition of the Alpha-Dropout class, which implements a regularizer that\n+ * randomly sets units to alpha-dash to prevent them from co-adapting and\n+ * makes an affine transformation so as to keep the mean and variance of\n+ * outputs at their original values.\n+ *\n+ * mlpack is free software; you may redistribute it and/or modify it under the\n+ * terms of the 3-clause BSD license.  You should have received a copy of the\n+ * 3-clause BSD license along with mlpack.  If not, see\n+ * http://www.opensource.org/licenses/BSD-3-Clause for more information.\n+ */\n+\n+#ifndef MLPACK_METHODS_ANN_LAYER_ALPHA_DROPOUT_IMPL_HPP\n+#define MLPACK_METHODS_ANN_LAYER_ALPHA_DROPOUT_IMPL_HPP\n+\n+// In case it hasn't yet been included.\n+#include \"alpha_dropout.hpp\"\n+\n+namespace mlpack {\n+namespace ann /** Artificial Neural Network. */ {\n+\n+template<typename InputDataType, typename OutputDataType>\n+Alpha_Dropout<InputDataType, OutputDataType>::Alpha_Dropout(\n+        const double ratio) :\n+        ratio(ratio),\n+        deterministic(true)\n+{\n+    // Nothing to do here.\n+}\n+\n+template<typename InputDataType, typename OutputDataType>\n+template<typename eT>\n+void Alpha_Dropout<InputDataType, OutputDataType>::Forward(\n+        const arma::Mat<eT>&& input,\n+        arma::Mat<eT>&& output)\n+{\n+    // The dropout mask will not be multiplied in the deterministic mode\n+    // (during testing).\n+    if (deterministic)\n+    {\n+       output = input;\n+    }\n+    else\n+    {\n+        // Set values to alpha_dash with probability ratio.  Then apply affine\n+        // transformation so as to keep mean and variance of outputs to their\n+        // original values.\n+\n+        mask = arma::randu< arma::Mat<eT> >(input.n_rows, input.n_cols);\n+        mask.transform( [&](double val) { return (val > ratio); } );\n+        output = input % mask + alpha_dash * (1 - mask);","path":"src/mlpack/methods/ann/layer/alpha_dropout_impl.hpp","position":54,"original_position":54,"commit_id":"ac7e8128e8d40164704b18766098db7a5a575211","original_commit_id":"ac7e8128e8d40164704b18766098db7a5a575211","user":{"login":"zoq","id":4209744,"avatar_url":"https://avatars3.githubusercontent.com/u/4209744?v=4","gravatar_id":"","url":"https://api.github.com/users/zoq","html_url":"https://github.com/zoq","followers_url":"https://api.github.com/users/zoq/followers","following_url":"https://api.github.com/users/zoq/following{/other_user}","gists_url":"https://api.github.com/users/zoq/gists{/gist_id}","starred_url":"https://api.github.com/users/zoq/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/zoq/subscriptions","organizations_url":"https://api.github.com/users/zoq/orgs","repos_url":"https://api.github.com/users/zoq/repos","events_url":"https://api.github.com/users/zoq/events{/privacy}","received_events_url":"https://api.github.com/users/zoq/received_events","type":"User","site_admin":false},"body":"What about adding ``* a + b`` here.","created_at":"2018-03-02T15:39:27Z","updated_at":"2018-03-02T15:42:02Z","html_url":"https://github.com/mlpack/mlpack/pull/1278#discussion_r171879906","pull_request_url":"https://api.github.com/repos/mlpack/mlpack/pulls/1278","author_association":"OWNER","_links":{"self":{"href":"https://api.github.com/repos/mlpack/mlpack/pulls/comments/171879906"},"html":{"href":"https://github.com/mlpack/mlpack/pull/1278#discussion_r171879906"},"pull_request":{"href":"https://api.github.com/repos/mlpack/mlpack/pulls/1278"}}},"pull_request":{"url":"https://api.github.com/repos/mlpack/mlpack/pulls/1278","id":171380981,"html_url":"https://github.com/mlpack/mlpack/pull/1278","diff_url":"https://github.com/mlpack/mlpack/pull/1278.diff","patch_url":"https://github.com/mlpack/mlpack/pull/1278.patch","issue_url":"https://api.github.com/repos/mlpack/mlpack/issues/1278","number":1278,"state":"open","locked":false,"title":"Add Alpha Dropout Layer","user":{"login":"dakshitagrawal97","id":21274296,"avatar_url":"https://avatars0.githubusercontent.com/u/21274296?v=4","gravatar_id":"","url":"https://api.github.com/users/dakshitagrawal97","html_url":"https://github.com/dakshitagrawal97","followers_url":"https://api.github.com/users/dakshitagrawal97/followers","following_url":"https://api.github.com/users/dakshitagrawal97/following{/other_user}","gists_url":"https://api.github.com/users/dakshitagrawal97/gists{/gist_id}","starred_url":"https://api.github.com/users/dakshitagrawal97/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dakshitagrawal97/subscriptions","organizations_url":"https://api.github.com/users/dakshitagrawal97/orgs","repos_url":"https://api.github.com/users/dakshitagrawal97/repos","events_url":"https://api.github.com/users/dakshitagrawal97/events{/privacy}","received_events_url":"https://api.github.com/users/dakshitagrawal97/received_events","type":"User","site_admin":false},"body":"This PR adds a variant of dropout - alpha_dropout - as proposed in this [NIPS Paper](https://arxiv.org/pdf/1706.02515.pdf).  \r\nI will add the tests once the implementation is approved.","created_at":"2018-02-26T13:56:07Z","updated_at":"2018-03-02T15:42:03Z","closed_at":null,"merged_at":null,"merge_commit_sha":"95e99afc7633b9074489bb17b3e8ed3b84e8d197","assignee":null,"assignees":[],"requested_reviewers":[],"requested_teams":[],"labels":[],"milestone":null,"commits_url":"https://api.github.com/repos/mlpack/mlpack/pulls/1278/commits","review_comments_url":"https://api.github.com/repos/mlpack/mlpack/pulls/1278/comments","review_comment_url":"https://api.github.com/repos/mlpack/mlpack/pulls/comments{/number}","comments_url":"https://api.github.com/repos/mlpack/mlpack/issues/1278/comments","statuses_url":"https://api.github.com/repos/mlpack/mlpack/statuses/ac7e8128e8d40164704b18766098db7a5a575211","head":{"label":"dakshitagrawal97:alpha_dropout","ref":"alpha_dropout","sha":"ac7e8128e8d40164704b18766098db7a5a575211","user":{"login":"dakshitagrawal97","id":21274296,"avatar_url":"https://avatars0.githubusercontent.com/u/21274296?v=4","gravatar_id":"","url":"https://api.github.com/users/dakshitagrawal97","html_url":"https://github.com/dakshitagrawal97","followers_url":"https://api.github.com/users/dakshitagrawal97/followers","following_url":"https://api.github.com/users/dakshitagrawal97/following{/other_user}","gists_url":"https://api.github.com/users/dakshitagrawal97/gists{/gist_id}","starred_url":"https://api.github.com/users/dakshitagrawal97/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dakshitagrawal97/subscriptions","organizations_url":"https://api.github.com/users/dakshitagrawal97/orgs","repos_url":"https://api.github.com/users/dakshitagrawal97/repos","events_url":"https://api.github.com/users/dakshitagrawal97/events{/privacy}","received_events_url":"https://api.github.com/users/dakshitagrawal97/received_events","type":"User","site_admin":false},"repo":{"id":122610677,"name":"mlpack","full_name":"dakshitagrawal97/mlpack","owner":{"login":"dakshitagrawal97","id":21274296,"avatar_url":"https://avatars0.githubusercontent.com/u/21274296?v=4","gravatar_id":"","url":"https://api.github.com/users/dakshitagrawal97","html_url":"https://github.com/dakshitagrawal97","followers_url":"https://api.github.com/users/dakshitagrawal97/followers","following_url":"https://api.github.com/users/dakshitagrawal97/following{/other_user}","gists_url":"https://api.github.com/users/dakshitagrawal97/gists{/gist_id}","starred_url":"https://api.github.com/users/dakshitagrawal97/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dakshitagrawal97/subscriptions","organizations_url":"https://api.github.com/users/dakshitagrawal97/orgs","repos_url":"https://api.github.com/users/dakshitagrawal97/repos","events_url":"https://api.github.com/users/dakshitagrawal97/events{/privacy}","received_events_url":"https://api.github.com/users/dakshitagrawal97/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/dakshitagrawal97/mlpack","description":"mlpack: a scalable C++ machine learning library -- ","fork":true,"url":"https://api.github.com/repos/dakshitagrawal97/mlpack","forks_url":"https://api.github.com/repos/dakshitagrawal97/mlpack/forks","keys_url":"https://api.github.com/repos/dakshitagrawal97/mlpack/keys{/key_id}","collaborators_url":"https://api.github.com/repos/dakshitagrawal97/mlpack/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/dakshitagrawal97/mlpack/teams","hooks_url":"https://api.github.com/repos/dakshitagrawal97/mlpack/hooks","issue_events_url":"https://api.github.com/repos/dakshitagrawal97/mlpack/issues/events{/number}","events_url":"https://api.github.com/repos/dakshitagrawal97/mlpack/events","assignees_url":"https://api.github.com/repos/dakshitagrawal97/mlpack/assignees{/user}","branches_url":"https://api.github.com/repos/dakshitagrawal97/mlpack/branches{/branch}","tags_url":"https://api.github.com/repos/dakshitagrawal97/mlpack/tags","blobs_url":"https://api.github.com/repos/dakshitagrawal97/mlpack/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/dakshitagrawal97/mlpack/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/dakshitagrawal97/mlpack/git/refs{/sha}","trees_url":"https://api.github.com/repos/dakshitagrawal97/mlpack/git/trees{/sha}","statuses_url":"https://api.github.com/repos/dakshitagrawal97/mlpack/statuses/{sha}","languages_url":"https://api.github.com/repos/dakshitagrawal97/mlpack/languages","stargazers_url":"https://api.github.com/repos/dakshitagrawal97/mlpack/stargazers","contributors_url":"https://api.github.com/repos/dakshitagrawal97/mlpack/contributors","subscribers_url":"https://api.github.com/repos/dakshitagrawal97/mlpack/subscribers","subscription_url":"https://api.github.com/repos/dakshitagrawal97/mlpack/subscription","commits_url":"https://api.github.com/repos/dakshitagrawal97/mlpack/commits{/sha}","git_commits_url":"https://api.github.com/repos/dakshitagrawal97/mlpack/git/commits{/sha}","comments_url":"https://api.github.com/repos/dakshitagrawal97/mlpack/comments{/number}","issue_comment_url":"https://api.github.com/repos/dakshitagrawal97/mlpack/issues/comments{/number}","contents_url":"https://api.github.com/repos/dakshitagrawal97/mlpack/contents/{+path}","compare_url":"https://api.github.com/repos/dakshitagrawal97/mlpack/compare/{base}...{head}","merges_url":"https://api.github.com/repos/dakshitagrawal97/mlpack/merges","archive_url":"https://api.github.com/repos/dakshitagrawal97/mlpack/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/dakshitagrawal97/mlpack/downloads","issues_url":"https://api.github.com/repos/dakshitagrawal97/mlpack/issues{/number}","pulls_url":"https://api.github.com/repos/dakshitagrawal97/mlpack/pulls{/number}","milestones_url":"https://api.github.com/repos/dakshitagrawal97/mlpack/milestones{/number}","notifications_url":"https://api.github.com/repos/dakshitagrawal97/mlpack/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/dakshitagrawal97/mlpack/labels{/name}","releases_url":"https://api.github.com/repos/dakshitagrawal97/mlpack/releases{/id}","deployments_url":"https://api.github.com/repos/dakshitagrawal97/mlpack/deployments","created_at":"2018-02-23T11:03:53Z","updated_at":"2018-02-23T11:03:59Z","pushed_at":"2018-03-01T13:58:46Z","git_url":"git://github.com/dakshitagrawal97/mlpack.git","ssh_url":"git@github.com:dakshitagrawal97/mlpack.git","clone_url":"https://github.com/dakshitagrawal97/mlpack.git","svn_url":"https://github.com/dakshitagrawal97/mlpack","homepage":"http://www.mlpack.org/","size":242388,"stargazers_count":0,"watchers_count":0,"language":"C++","has_issues":false,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"archived":false,"open_issues_count":0,"license":{"key":"other","name":"Other","spdx_id":null,"url":null},"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"mlpack:master","ref":"master","sha":"16d2c106f65ea36c30a5d72515c2cabb25898096","user":{"login":"mlpack","id":10216045,"avatar_url":"https://avatars0.githubusercontent.com/u/10216045?v=4","gravatar_id":"","url":"https://api.github.com/users/mlpack","html_url":"https://github.com/mlpack","followers_url":"https://api.github.com/users/mlpack/followers","following_url":"https://api.github.com/users/mlpack/following{/other_user}","gists_url":"https://api.github.com/users/mlpack/gists{/gist_id}","starred_url":"https://api.github.com/users/mlpack/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mlpack/subscriptions","organizations_url":"https://api.github.com/users/mlpack/orgs","repos_url":"https://api.github.com/users/mlpack/repos","events_url":"https://api.github.com/users/mlpack/events{/privacy}","received_events_url":"https://api.github.com/users/mlpack/received_events","type":"Organization","site_admin":false},"repo":{"id":28149409,"name":"mlpack","full_name":"mlpack/mlpack","owner":{"login":"mlpack","id":10216045,"avatar_url":"https://avatars0.githubusercontent.com/u/10216045?v=4","gravatar_id":"","url":"https://api.github.com/users/mlpack","html_url":"https://github.com/mlpack","followers_url":"https://api.github.com/users/mlpack/followers","following_url":"https://api.github.com/users/mlpack/following{/other_user}","gists_url":"https://api.github.com/users/mlpack/gists{/gist_id}","starred_url":"https://api.github.com/users/mlpack/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mlpack/subscriptions","organizations_url":"https://api.github.com/users/mlpack/orgs","repos_url":"https://api.github.com/users/mlpack/repos","events_url":"https://api.github.com/users/mlpack/events{/privacy}","received_events_url":"https://api.github.com/users/mlpack/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/mlpack/mlpack","description":"mlpack: a scalable C++ machine learning library -- ","fork":false,"url":"https://api.github.com/repos/mlpack/mlpack","forks_url":"https://api.github.com/repos/mlpack/mlpack/forks","keys_url":"https://api.github.com/repos/mlpack/mlpack/keys{/key_id}","collaborators_url":"https://api.github.com/repos/mlpack/mlpack/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/mlpack/mlpack/teams","hooks_url":"https://api.github.com/repos/mlpack/mlpack/hooks","issue_events_url":"https://api.github.com/repos/mlpack/mlpack/issues/events{/number}","events_url":"https://api.github.com/repos/mlpack/mlpack/events","assignees_url":"https://api.github.com/repos/mlpack/mlpack/assignees{/user}","branches_url":"https://api.github.com/repos/mlpack/mlpack/branches{/branch}","tags_url":"https://api.github.com/repos/mlpack/mlpack/tags","blobs_url":"https://api.github.com/repos/mlpack/mlpack/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/mlpack/mlpack/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/mlpack/mlpack/git/refs{/sha}","trees_url":"https://api.github.com/repos/mlpack/mlpack/git/trees{/sha}","statuses_url":"https://api.github.com/repos/mlpack/mlpack/statuses/{sha}","languages_url":"https://api.github.com/repos/mlpack/mlpack/languages","stargazers_url":"https://api.github.com/repos/mlpack/mlpack/stargazers","contributors_url":"https://api.github.com/repos/mlpack/mlpack/contributors","subscribers_url":"https://api.github.com/repos/mlpack/mlpack/subscribers","subscription_url":"https://api.github.com/repos/mlpack/mlpack/subscription","commits_url":"https://api.github.com/repos/mlpack/mlpack/commits{/sha}","git_commits_url":"https://api.github.com/repos/mlpack/mlpack/git/commits{/sha}","comments_url":"https://api.github.com/repos/mlpack/mlpack/comments{/number}","issue_comment_url":"https://api.github.com/repos/mlpack/mlpack/issues/comments{/number}","contents_url":"https://api.github.com/repos/mlpack/mlpack/contents/{+path}","compare_url":"https://api.github.com/repos/mlpack/mlpack/compare/{base}...{head}","merges_url":"https://api.github.com/repos/mlpack/mlpack/merges","archive_url":"https://api.github.com/repos/mlpack/mlpack/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/mlpack/mlpack/downloads","issues_url":"https://api.github.com/repos/mlpack/mlpack/issues{/number}","pulls_url":"https://api.github.com/repos/mlpack/mlpack/pulls{/number}","milestones_url":"https://api.github.com/repos/mlpack/mlpack/milestones{/number}","notifications_url":"https://api.github.com/repos/mlpack/mlpack/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/mlpack/mlpack/labels{/name}","releases_url":"https://api.github.com/repos/mlpack/mlpack/releases{/id}","deployments_url":"https://api.github.com/repos/mlpack/mlpack/deployments","created_at":"2014-12-17T18:16:59Z","updated_at":"2018-03-02T15:30:08Z","pushed_at":"2018-03-02T12:41:24Z","git_url":"git://github.com/mlpack/mlpack.git","ssh_url":"git@github.com:mlpack/mlpack.git","clone_url":"https://github.com/mlpack/mlpack.git","svn_url":"https://github.com/mlpack/mlpack","homepage":"http://www.mlpack.org/","size":242471,"stargazers_count":2003,"watchers_count":2003,"language":"C++","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":758,"mirror_url":null,"archived":false,"open_issues_count":117,"license":{"key":"other","name":"Other","spdx_id":null,"url":null},"forks":758,"open_issues":117,"watchers":2003,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/mlpack/mlpack/pulls/1278"},"html":{"href":"https://github.com/mlpack/mlpack/pull/1278"},"issue":{"href":"https://api.github.com/repos/mlpack/mlpack/issues/1278"},"comments":{"href":"https://api.github.com/repos/mlpack/mlpack/issues/1278/comments"},"review_comments":{"href":"https://api.github.com/repos/mlpack/mlpack/pulls/1278/comments"},"review_comment":{"href":"https://api.github.com/repos/mlpack/mlpack/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/mlpack/mlpack/pulls/1278/commits"},"statuses":{"href":"https://api.github.com/repos/mlpack/mlpack/statuses/ac7e8128e8d40164704b18766098db7a5a575211"}},"author_association":"NONE"}}
{"actor":{"display_login":"zoq"}}