{"action":"created","comment":{"url":"https://api.github.com/repos/mlpack/mlpack/pulls/comments/165744153","pull_request_review_id":93738173,"id":165744153,"diff_hunk":"@@ -0,0 +1,378 @@\n+/**\n+  * @file logistic_regression_test.cpp\n+  * @author B Kartheek Reddy\n+  *\n+  * Test mlpackMain() of logistic_regression_main.cpp.\n+ **/\n+\n+#define BINDING_TYPE BINDING_TYPE_TEST\n+\n+static const std::string testName = \"LogisticRegression\";\n+\n+\n+#include <mlpack/core.hpp>\n+#include <mlpack/methods/logistic_regression/logistic_regression_main.cpp>\n+#include <mlpack/core/util/mlpack_main.hpp>\n+#include \"test_helper.hpp\"\n+\n+#include <boost/test/unit_test.hpp>\n+\n+using namespace mlpack;\n+\n+\n+struct LogisticRegressionTestFixture\n+{\n+ public:\n+  LogisticRegressionTestFixture()\n+  {\n+  \ttry { \n+    \t// Cache in the options for this program.\n+    \tCLI::RestoreSettings(testName);\n+    } catch (std::invalid_argument e) {\n+    \tLog::Fatal << \"Invalid Test Name : \" << e.what() << std::endl;\n+    }\n+  \n+  }\n+\n+  ~LogisticRegressionTestFixture()\n+  {\n+    // Clear the settings.\n+    CLI::ClearSettings();\n+  }\n+\n+};\n+\n+BOOST_FIXTURE_TEST_SUITE(LogisticRegressionMainTest, LogisticRegressionTestFixture);\n+\n+/** \n+  * Ensuring that absence of training data is checked.\n+ **/\n+BOOST_AUTO_TEST_CASE(LRNoTrainingData) \n+{\n+  arma::Row<size_t> trainY;\n+  trainY << 0 << 1 << 0 << 1 << 1 << 1 << 0 << 1 << 0 << 0 << arma::endr; // 10 responses\n+  \n+  SetInputParam(\"labels\", std::move(trainY));\n+\n+  Log::Fatal.ignoreInput = true;\n+  BOOST_REQUIRE_THROW(mlpackMain(), std::runtime_error);\n+  Log::Fatal.ignoreInput = false;\n+\n+}\n+\n+/**\n+ * Ensuring that absence of responses is checked.\n+ */\n+BOOST_AUTO_TEST_CASE(LRNoResponses)\n+{\n+  constexpr int N = 10;\n+  constexpr int D = 1;\n+\n+  arma::mat trainX = arma::randu<arma::mat>(D, N);\n+  SetInputParam(\"training\", std::move(trainX));\n+\n+  Log::Fatal.ignoreInput = true;\n+  BOOST_REQUIRE_THROW(mlpackMain(), std::runtime_error);\n+  Log::Fatal.ignoreInput = false;\n+}\n+\n+/**\n+ * Checking that that size and dimensionality of prediction is correct.\n+ */\n+BOOST_AUTO_TEST_CASE(LRPridictionSizeCheck)\n+{\n+  constexpr int N = 10;\n+  constexpr int D = 3;\n+  constexpr int M = 15;\n+\n+  arma::mat trainX = arma::randu<arma::mat>(D, N);\n+  arma::Row<size_t> trainY;\n+  trainY << 0 << 1 << 0 << 1 << 1 << 1 << 0 << 1 << 0 << 0 << arma::endr; // 10 responses\n+  arma::mat testX = arma::randu<arma::mat>(D, M);\n+\n+  SetInputParam(\"training\", std::move(trainX));\n+  SetInputParam(\"labels\", std::move(trainY));\n+  SetInputParam(\"test\", std::move(testX));\n+\n+  mlpackMain();\n+\n+  const arma::Row<size_t> testY = CLI::GetParam<arma::Row<size_t>>(\"output\");\n+\n+  BOOST_REQUIRE_EQUAL(testY.n_rows, 1);\n+  BOOST_REQUIRE_EQUAL(testY.n_cols, M);\n+}\n+\n+/**\n+  * Ensuring that the response size is checked\n+ **/\n+BOOST_AUTO_TEST_CASE(LRWrongResponseSizeTest) \n+{\n+  constexpr int D = 3;\n+  constexpr int N = 10;\n+  \n+  arma::mat trainX = arma::randu<arma::mat>(D,N);\n+  arma::Row<size_t> trainY; // response vector with wrong size\n+\n+  trainY << 0 << 0 << 1 << 0 << 1 << 1 << 1 << 0 << arma::endr; // 8 responses - incorrect size\n+\n+  SetInputParam(\"training\", std::move(trainX));\n+  SetInputParam(\"labels\", std::move(trainY));\n+\n+  Log::Fatal.ignoreInput = true;\n+  BOOST_REQUIRE_THROW(mlpackMain(),std::runtime_error);\n+  Log::Fatal.ignoreInput = false;\n+}\n+\n+/**\n+ * Checking two options of specifying responses (extra row in train matrix and\n+ * extra parameter) and ensuring that predictions are the same.\n+ */\n+BOOST_AUTO_TEST_CASE(LRResponsesRepresentationTest)\n+{\n+  arma::mat trainX1({{1.0, 2.0, 3.0}, {1.0, 4.0, 9.0}, {0,1,1}});\n+  arma::mat testX({{4.0,5.0},{1.0,6.0}});\n+\n+  SetInputParam(\"training\",std::move(trainX1));\n+  SetInputParam(\"test\", testX);\n+\n+  // The first solution.\n+  mlpackMain();\n+\n+  const arma::Row<size_t> testY1 = CLI::GetParam<arma::Row<size_t>>(\"output\");","path":"src/mlpack/tests/main_tests/logistic_regression_test.cpp","position":null,"original_position":141,"commit_id":"c330581996885e425f78782a8a4443e59bdc0db2","original_commit_id":"d9c6bb9cf38ecc28801f2ad57ddd2a1591a2fb39","user":{"login":"KARTHEEKCIC","id":22465396,"avatar_url":"https://avatars3.githubusercontent.com/u/22465396?v=4","gravatar_id":"","url":"https://api.github.com/users/KARTHEEKCIC","html_url":"https://github.com/KARTHEEKCIC","followers_url":"https://api.github.com/users/KARTHEEKCIC/followers","following_url":"https://api.github.com/users/KARTHEEKCIC/following{/other_user}","gists_url":"https://api.github.com/users/KARTHEEKCIC/gists{/gist_id}","starred_url":"https://api.github.com/users/KARTHEEKCIC/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/KARTHEEKCIC/subscriptions","organizations_url":"https://api.github.com/users/KARTHEEKCIC/orgs","repos_url":"https://api.github.com/users/KARTHEEKCIC/repos","events_url":"https://api.github.com/users/KARTHEEKCIC/events{/privacy}","received_events_url":"https://api.github.com/users/KARTHEEKCIC/received_events","type":"User","site_admin":false},"body":"Done. I made the changes accordingly. Thanks for your suggestion. I will remember that next time.","created_at":"2018-02-02T19:55:45Z","updated_at":"2018-02-02T19:55:45Z","html_url":"https://github.com/mlpack/mlpack/pull/1199#discussion_r165744153","pull_request_url":"https://api.github.com/repos/mlpack/mlpack/pulls/1199","author_association":"NONE","_links":{"self":{"href":"https://api.github.com/repos/mlpack/mlpack/pulls/comments/165744153"},"html":{"href":"https://github.com/mlpack/mlpack/pull/1199#discussion_r165744153"},"pull_request":{"href":"https://api.github.com/repos/mlpack/mlpack/pulls/1199"}},"in_reply_to_id":165053167},"pull_request":{"url":"https://api.github.com/repos/mlpack/mlpack/pulls/1199","id":163286597,"html_url":"https://github.com/mlpack/mlpack/pull/1199","diff_url":"https://github.com/mlpack/mlpack/pull/1199.diff","patch_url":"https://github.com/mlpack/mlpack/pull/1199.patch","issue_url":"https://api.github.com/repos/mlpack/mlpack/issues/1199","number":1199,"state":"open","locked":false,"title":"Binding Tests ","user":{"login":"KARTHEEKCIC","id":22465396,"avatar_url":"https://avatars3.githubusercontent.com/u/22465396?v=4","gravatar_id":"","url":"https://api.github.com/users/KARTHEEKCIC","html_url":"https://github.com/KARTHEEKCIC","followers_url":"https://api.github.com/users/KARTHEEKCIC/followers","following_url":"https://api.github.com/users/KARTHEEKCIC/following{/other_user}","gists_url":"https://api.github.com/users/KARTHEEKCIC/gists{/gist_id}","starred_url":"https://api.github.com/users/KARTHEEKCIC/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/KARTHEEKCIC/subscriptions","organizations_url":"https://api.github.com/users/KARTHEEKCIC/orgs","repos_url":"https://api.github.com/users/KARTHEEKCIC/repos","events_url":"https://api.github.com/users/KARTHEEKCIC/events{/privacy}","received_events_url":"https://api.github.com/users/KARTHEEKCIC/received_events","type":"User","site_admin":false},"body":"Adding Bindings tests for perceptron_main.cpp w.r.t. the issue #1152","created_at":"2018-01-16T21:02:43Z","updated_at":"2018-02-02T19:55:45Z","closed_at":null,"merged_at":null,"merge_commit_sha":"2c030fb737a7402a4d5ab441f8d720511f2cc3a9","assignee":null,"assignees":[],"requested_reviewers":[],"requested_teams":[],"milestone":null,"commits_url":"https://api.github.com/repos/mlpack/mlpack/pulls/1199/commits","review_comments_url":"https://api.github.com/repos/mlpack/mlpack/pulls/1199/comments","review_comment_url":"https://api.github.com/repos/mlpack/mlpack/pulls/comments{/number}","comments_url":"https://api.github.com/repos/mlpack/mlpack/issues/1199/comments","statuses_url":"https://api.github.com/repos/mlpack/mlpack/statuses/c330581996885e425f78782a8a4443e59bdc0db2","head":{"label":"KARTHEEKCIC:master","ref":"master","sha":"c330581996885e425f78782a8a4443e59bdc0db2","user":{"login":"KARTHEEKCIC","id":22465396,"avatar_url":"https://avatars3.githubusercontent.com/u/22465396?v=4","gravatar_id":"","url":"https://api.github.com/users/KARTHEEKCIC","html_url":"https://github.com/KARTHEEKCIC","followers_url":"https://api.github.com/users/KARTHEEKCIC/followers","following_url":"https://api.github.com/users/KARTHEEKCIC/following{/other_user}","gists_url":"https://api.github.com/users/KARTHEEKCIC/gists{/gist_id}","starred_url":"https://api.github.com/users/KARTHEEKCIC/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/KARTHEEKCIC/subscriptions","organizations_url":"https://api.github.com/users/KARTHEEKCIC/orgs","repos_url":"https://api.github.com/users/KARTHEEKCIC/repos","events_url":"https://api.github.com/users/KARTHEEKCIC/events{/privacy}","received_events_url":"https://api.github.com/users/KARTHEEKCIC/received_events","type":"User","site_admin":false},"repo":{"id":117735058,"name":"mlpack","full_name":"KARTHEEKCIC/mlpack","owner":{"login":"KARTHEEKCIC","id":22465396,"avatar_url":"https://avatars3.githubusercontent.com/u/22465396?v=4","gravatar_id":"","url":"https://api.github.com/users/KARTHEEKCIC","html_url":"https://github.com/KARTHEEKCIC","followers_url":"https://api.github.com/users/KARTHEEKCIC/followers","following_url":"https://api.github.com/users/KARTHEEKCIC/following{/other_user}","gists_url":"https://api.github.com/users/KARTHEEKCIC/gists{/gist_id}","starred_url":"https://api.github.com/users/KARTHEEKCIC/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/KARTHEEKCIC/subscriptions","organizations_url":"https://api.github.com/users/KARTHEEKCIC/orgs","repos_url":"https://api.github.com/users/KARTHEEKCIC/repos","events_url":"https://api.github.com/users/KARTHEEKCIC/events{/privacy}","received_events_url":"https://api.github.com/users/KARTHEEKCIC/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/KARTHEEKCIC/mlpack","description":"mlpack: a scalable C++ machine learning library -- ","fork":true,"url":"https://api.github.com/repos/KARTHEEKCIC/mlpack","forks_url":"https://api.github.com/repos/KARTHEEKCIC/mlpack/forks","keys_url":"https://api.github.com/repos/KARTHEEKCIC/mlpack/keys{/key_id}","collaborators_url":"https://api.github.com/repos/KARTHEEKCIC/mlpack/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/KARTHEEKCIC/mlpack/teams","hooks_url":"https://api.github.com/repos/KARTHEEKCIC/mlpack/hooks","issue_events_url":"https://api.github.com/repos/KARTHEEKCIC/mlpack/issues/events{/number}","events_url":"https://api.github.com/repos/KARTHEEKCIC/mlpack/events","assignees_url":"https://api.github.com/repos/KARTHEEKCIC/mlpack/assignees{/user}","branches_url":"https://api.github.com/repos/KARTHEEKCIC/mlpack/branches{/branch}","tags_url":"https://api.github.com/repos/KARTHEEKCIC/mlpack/tags","blobs_url":"https://api.github.com/repos/KARTHEEKCIC/mlpack/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/KARTHEEKCIC/mlpack/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/KARTHEEKCIC/mlpack/git/refs{/sha}","trees_url":"https://api.github.com/repos/KARTHEEKCIC/mlpack/git/trees{/sha}","statuses_url":"https://api.github.com/repos/KARTHEEKCIC/mlpack/statuses/{sha}","languages_url":"https://api.github.com/repos/KARTHEEKCIC/mlpack/languages","stargazers_url":"https://api.github.com/repos/KARTHEEKCIC/mlpack/stargazers","contributors_url":"https://api.github.com/repos/KARTHEEKCIC/mlpack/contributors","subscribers_url":"https://api.github.com/repos/KARTHEEKCIC/mlpack/subscribers","subscription_url":"https://api.github.com/repos/KARTHEEKCIC/mlpack/subscription","commits_url":"https://api.github.com/repos/KARTHEEKCIC/mlpack/commits{/sha}","git_commits_url":"https://api.github.com/repos/KARTHEEKCIC/mlpack/git/commits{/sha}","comments_url":"https://api.github.com/repos/KARTHEEKCIC/mlpack/comments{/number}","issue_comment_url":"https://api.github.com/repos/KARTHEEKCIC/mlpack/issues/comments{/number}","contents_url":"https://api.github.com/repos/KARTHEEKCIC/mlpack/contents/{+path}","compare_url":"https://api.github.com/repos/KARTHEEKCIC/mlpack/compare/{base}...{head}","merges_url":"https://api.github.com/repos/KARTHEEKCIC/mlpack/merges","archive_url":"https://api.github.com/repos/KARTHEEKCIC/mlpack/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/KARTHEEKCIC/mlpack/downloads","issues_url":"https://api.github.com/repos/KARTHEEKCIC/mlpack/issues{/number}","pulls_url":"https://api.github.com/repos/KARTHEEKCIC/mlpack/pulls{/number}","milestones_url":"https://api.github.com/repos/KARTHEEKCIC/mlpack/milestones{/number}","notifications_url":"https://api.github.com/repos/KARTHEEKCIC/mlpack/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/KARTHEEKCIC/mlpack/labels{/name}","releases_url":"https://api.github.com/repos/KARTHEEKCIC/mlpack/releases{/id}","deployments_url":"https://api.github.com/repos/KARTHEEKCIC/mlpack/deployments","created_at":"2018-01-16T20:03:09Z","updated_at":"2018-01-16T20:03:14Z","pushed_at":"2018-02-02T19:51:18Z","git_url":"git://github.com/KARTHEEKCIC/mlpack.git","ssh_url":"git@github.com:KARTHEEKCIC/mlpack.git","clone_url":"https://github.com/KARTHEEKCIC/mlpack.git","svn_url":"https://github.com/KARTHEEKCIC/mlpack","homepage":"http://www.mlpack.org/","size":241966,"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":null,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"mlpack:master","ref":"master","sha":"73c576e20821267a284b48e4bdac61b119411c48","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-02-02T18:24:06Z","pushed_at":"2018-02-02T19:51:21Z","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":242026,"stargazers_count":1907,"watchers_count":1907,"language":"C++","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":692,"mirror_url":null,"archived":false,"open_issues_count":110,"license":null,"forks":692,"open_issues":110,"watchers":1907,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/mlpack/mlpack/pulls/1199"},"html":{"href":"https://github.com/mlpack/mlpack/pull/1199"},"issue":{"href":"https://api.github.com/repos/mlpack/mlpack/issues/1199"},"comments":{"href":"https://api.github.com/repos/mlpack/mlpack/issues/1199/comments"},"review_comments":{"href":"https://api.github.com/repos/mlpack/mlpack/pulls/1199/comments"},"review_comment":{"href":"https://api.github.com/repos/mlpack/mlpack/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/mlpack/mlpack/pulls/1199/commits"},"statuses":{"href":"https://api.github.com/repos/mlpack/mlpack/statuses/c330581996885e425f78782a8a4443e59bdc0db2"}},"author_association":"NONE"}}
{"actor":{"display_login":"KARTHEEKCIC"}}