{"action":"created","comment":{"url":"https://api.github.com/repos/Itseez/opencv/pulls/comments/38631349","id":38631349,"diff_hunk":"@@ -0,0 +1,202 @@\n+/*M///////////////////////////////////////////////////////////////////////////////////////\n+//\n+//  IMPORTANT: READ BEFORE DOWNLOADING, COPYING, INSTALLING OR USING.\n+//\n+//  By downloading, copying, installing or using the software you agree to this license.\n+//  If you do not agree to this license, do not download, install,\n+//  copy or use the software.\n+//\n+//\n+//                           License Agreement\n+//                For Open Source Computer Vision Library\n+//\n+// Copyright (C) 2000, Intel Corporation, all rights reserved.\n+// Copyright (C) 2014, Itseez Inc, all rights reserved.\n+// Third party copyrights are property of their respective owners.\n+//\n+// Redistribution and use in source and binary forms, with or without modification,\n+// are permitted provided that the following conditions are met:\n+//\n+//   * Redistribution's of source code must retain the above copyright notice,\n+//     this list of conditions and the following disclaimer.\n+//\n+//   * Redistribution's in binary form must reproduce the above copyright notice,\n+//     this list of conditions and the following disclaimer in the documentation\n+//     and/or other materials provided with the distribution.\n+//\n+//   * The name of the copyright holders may not be used to endorse or promote products\n+//     derived from this software without specific prior written permission.\n+//\n+// This software is provided by the copyright holders and contributors \"as is\" and\n+// any express or implied warranties, including, but not limited to, the implied\n+// warranties of merchantability and fitness for a particular purpose are disclaimed.\n+// In no event shall the Intel Corporation or contributors be liable for any direct,\n+// indirect, incidental, special, exemplary, or consequential damages\n+// (including, but not limited to, procurement of substitute goods or services;\n+// loss of use, data, or profits; or business interruption) however caused\n+// and on any theory of liability, whether in contract, strict liability,\n+// or tort (including negligence or otherwise) arising in any way out of\n+// the use of this software, even if advised of the possibility of such damage.\n+//\n+//M*/\n+\n+#include \"precomp.hpp\"\n+#include \"svmsgd.hpp\"\n+\n+/****************************************************************************************\\\n+*                        Stochastic Gradient Descent SVM Classifier                      *\n+\\****************************************************************************************/\n+\n+namespace cv {\n+namespace ml {\n+\n+SVMSGD::SVMSGD(float lambda, float learnRate, uint nIterations){\n+\n+    // Initialize with random seed\n+    _randomNumber = 1;\n+\n+    // Initialize constants\n+    _slidingWindowSize = 0;\n+    _nFeatures = 0;\n+    _predictSlidingWindowSize = 1;\n+\n+    // Initialize sliderCounter at index 0\n+    _sliderCounter = 0;\n+\n+    // Parameters for learning\n+    _lambda = lambda;  // regularization\n+    _learnRate = learnRate;  // learning rate (ideally should be large at beginning and decay each iteration)\n+    _nIterations = nIterations;  // number of training iterations\n+\n+    // True only in the first predict iteration\n+    _initPredict = true;\n+\n+    // Online update flag\n+    _onlineUpdate = false;\n+}\n+\n+SVMSGD::SVMSGD(uint updateFrequency, float lambda, float learnRate, uint nIterations){\n+\n+    // Initialize with random seed\n+    _randomNumber = 1;\n+\n+    // Initialize constants\n+    _slidingWindowSize = 0;\n+    _nFeatures = 0;\n+    _predictSlidingWindowSize = updateFrequency;\n+\n+    // Initialize sliderCounter at index 0\n+    _sliderCounter = 0;\n+\n+    // Parameters for learning\n+    _lambda = lambda;  // regularization\n+    _learnRate = learnRate;  // learning rate (ideally should be large at beginning and decay each iteration)\n+    _nIterations = nIterations;  // number of training iterations\n+\n+    // True only in the first predict iteration\n+    _initPredict = true;\n+\n+    // Online update flag\n+    _onlineUpdate = true;\n+\n+    // Learn rate decay: _learnRate = _learnRate * _learnDecay\n+    _learnRateDecay = 0.1;","path":"modules/ml/src/svmsgd.cpp","position":103,"original_position":103,"commit_id":"19b096d9663c338479e2b6b0939ea4bd8c0b9b50","original_commit_id":"19b096d9663c338479e2b6b0939ea4bd8c0b9b50","user":{"login":"joaofaro","id":8546032,"avatar_url":"https://avatars.githubusercontent.com/u/8546032?v=3","gravatar_id":"","url":"https://api.github.com/users/joaofaro","html_url":"https://github.com/joaofaro","followers_url":"https://api.github.com/users/joaofaro/followers","following_url":"https://api.github.com/users/joaofaro/following{/other_user}","gists_url":"https://api.github.com/users/joaofaro/gists{/gist_id}","starred_url":"https://api.github.com/users/joaofaro/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/joaofaro/subscriptions","organizations_url":"https://api.github.com/users/joaofaro/orgs","repos_url":"https://api.github.com/users/joaofaro/repos","events_url":"https://api.github.com/users/joaofaro/events{/privacy}","received_events_url":"https://api.github.com/users/joaofaro/received_events","type":"User","site_admin":false},"body":"_learnRateDecay will be defined by an input variable, like _predictSlidingWindowSize","created_at":"2015-09-03T10:21:57Z","updated_at":"2015-09-03T10:21:57Z","html_url":"https://github.com/Itseez/opencv/pull/5291#discussion_r38631349","pull_request_url":"https://api.github.com/repos/Itseez/opencv/pulls/5291","_links":{"self":{"href":"https://api.github.com/repos/Itseez/opencv/pulls/comments/38631349"},"html":{"href":"https://github.com/Itseez/opencv/pull/5291#discussion_r38631349"},"pull_request":{"href":"https://api.github.com/repos/Itseez/opencv/pulls/5291"}}},"pull_request":{"url":"https://api.github.com/repos/Itseez/opencv/pulls/5291","id":44011969,"html_url":"https://github.com/Itseez/opencv/pull/5291","diff_url":"https://github.com/Itseez/opencv/pull/5291.diff","patch_url":"https://github.com/Itseez/opencv/pull/5291.patch","issue_url":"https://api.github.com/repos/Itseez/opencv/issues/5291","number":5291,"state":"open","locked":false,"title":"SVMSGD class added","user":{"login":"joaofaro","id":8546032,"avatar_url":"https://avatars.githubusercontent.com/u/8546032?v=3","gravatar_id":"","url":"https://api.github.com/users/joaofaro","html_url":"https://github.com/joaofaro","followers_url":"https://api.github.com/users/joaofaro/followers","following_url":"https://api.github.com/users/joaofaro/following{/other_user}","gists_url":"https://api.github.com/users/joaofaro/gists{/gist_id}","starred_url":"https://api.github.com/users/joaofaro/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/joaofaro/subscriptions","organizations_url":"https://api.github.com/users/joaofaro/orgs","repos_url":"https://api.github.com/users/joaofaro/repos","events_url":"https://api.github.com/users/joaofaro/events{/privacy}","received_events_url":"https://api.github.com/users/joaofaro/received_events","type":"User","site_admin":false},"body":"Function description added to svmsgd.hpp. Needs a header and the reference","created_at":"2015-09-02T16:18:49Z","updated_at":"2015-09-03T10:21:57Z","closed_at":null,"merged_at":null,"merge_commit_sha":"762f6d9c114e22590410522ddf6f8b85205c3fe5","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/Itseez/opencv/pulls/5291/commits","review_comments_url":"https://api.github.com/repos/Itseez/opencv/pulls/5291/comments","review_comment_url":"https://api.github.com/repos/Itseez/opencv/pulls/comments{/number}","comments_url":"https://api.github.com/repos/Itseez/opencv/issues/5291/comments","statuses_url":"https://api.github.com/repos/Itseez/opencv/statuses/19b096d9663c338479e2b6b0939ea4bd8c0b9b50","head":{"label":"joaofaro:SVMSGD","ref":"SVMSGD","sha":"19b096d9663c338479e2b6b0939ea4bd8c0b9b50","user":{"login":"joaofaro","id":8546032,"avatar_url":"https://avatars.githubusercontent.com/u/8546032?v=3","gravatar_id":"","url":"https://api.github.com/users/joaofaro","html_url":"https://github.com/joaofaro","followers_url":"https://api.github.com/users/joaofaro/followers","following_url":"https://api.github.com/users/joaofaro/following{/other_user}","gists_url":"https://api.github.com/users/joaofaro/gists{/gist_id}","starred_url":"https://api.github.com/users/joaofaro/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/joaofaro/subscriptions","organizations_url":"https://api.github.com/users/joaofaro/orgs","repos_url":"https://api.github.com/users/joaofaro/repos","events_url":"https://api.github.com/users/joaofaro/events{/privacy}","received_events_url":"https://api.github.com/users/joaofaro/received_events","type":"User","site_admin":false},"repo":{"id":23316093,"name":"opencv","full_name":"joaofaro/opencv","owner":{"login":"joaofaro","id":8546032,"avatar_url":"https://avatars.githubusercontent.com/u/8546032?v=3","gravatar_id":"","url":"https://api.github.com/users/joaofaro","html_url":"https://github.com/joaofaro","followers_url":"https://api.github.com/users/joaofaro/followers","following_url":"https://api.github.com/users/joaofaro/following{/other_user}","gists_url":"https://api.github.com/users/joaofaro/gists{/gist_id}","starred_url":"https://api.github.com/users/joaofaro/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/joaofaro/subscriptions","organizations_url":"https://api.github.com/users/joaofaro/orgs","repos_url":"https://api.github.com/users/joaofaro/repos","events_url":"https://api.github.com/users/joaofaro/events{/privacy}","received_events_url":"https://api.github.com/users/joaofaro/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/joaofaro/opencv","description":"Open Source Computer Vision Library","fork":true,"url":"https://api.github.com/repos/joaofaro/opencv","forks_url":"https://api.github.com/repos/joaofaro/opencv/forks","keys_url":"https://api.github.com/repos/joaofaro/opencv/keys{/key_id}","collaborators_url":"https://api.github.com/repos/joaofaro/opencv/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/joaofaro/opencv/teams","hooks_url":"https://api.github.com/repos/joaofaro/opencv/hooks","issue_events_url":"https://api.github.com/repos/joaofaro/opencv/issues/events{/number}","events_url":"https://api.github.com/repos/joaofaro/opencv/events","assignees_url":"https://api.github.com/repos/joaofaro/opencv/assignees{/user}","branches_url":"https://api.github.com/repos/joaofaro/opencv/branches{/branch}","tags_url":"https://api.github.com/repos/joaofaro/opencv/tags","blobs_url":"https://api.github.com/repos/joaofaro/opencv/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/joaofaro/opencv/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/joaofaro/opencv/git/refs{/sha}","trees_url":"https://api.github.com/repos/joaofaro/opencv/git/trees{/sha}","statuses_url":"https://api.github.com/repos/joaofaro/opencv/statuses/{sha}","languages_url":"https://api.github.com/repos/joaofaro/opencv/languages","stargazers_url":"https://api.github.com/repos/joaofaro/opencv/stargazers","contributors_url":"https://api.github.com/repos/joaofaro/opencv/contributors","subscribers_url":"https://api.github.com/repos/joaofaro/opencv/subscribers","subscription_url":"https://api.github.com/repos/joaofaro/opencv/subscription","commits_url":"https://api.github.com/repos/joaofaro/opencv/commits{/sha}","git_commits_url":"https://api.github.com/repos/joaofaro/opencv/git/commits{/sha}","comments_url":"https://api.github.com/repos/joaofaro/opencv/comments{/number}","issue_comment_url":"https://api.github.com/repos/joaofaro/opencv/issues/comments{/number}","contents_url":"https://api.github.com/repos/joaofaro/opencv/contents/{+path}","compare_url":"https://api.github.com/repos/joaofaro/opencv/compare/{base}...{head}","merges_url":"https://api.github.com/repos/joaofaro/opencv/merges","archive_url":"https://api.github.com/repos/joaofaro/opencv/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/joaofaro/opencv/downloads","issues_url":"https://api.github.com/repos/joaofaro/opencv/issues{/number}","pulls_url":"https://api.github.com/repos/joaofaro/opencv/pulls{/number}","milestones_url":"https://api.github.com/repos/joaofaro/opencv/milestones{/number}","notifications_url":"https://api.github.com/repos/joaofaro/opencv/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/joaofaro/opencv/labels{/name}","releases_url":"https://api.github.com/repos/joaofaro/opencv/releases{/id}","created_at":"2014-08-25T14:16:49Z","updated_at":"2015-05-06T13:06:05Z","pushed_at":"2015-09-02T18:21:20Z","git_url":"git://github.com/joaofaro/opencv.git","ssh_url":"git@github.com:joaofaro/opencv.git","clone_url":"https://github.com/joaofaro/opencv.git","svn_url":"https://github.com/joaofaro/opencv","homepage":"opencv.org","size":442147,"stargazers_count":0,"watchers_count":0,"language":"C++","has_issues":false,"has_downloads":true,"has_wiki":false,"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":"Itseez:master","ref":"master","sha":"9c3f95782d095931c13c5dc48455ea2780524691","user":{"login":"Itseez","id":1786446,"avatar_url":"https://avatars.githubusercontent.com/u/1786446?v=3","gravatar_id":"","url":"https://api.github.com/users/Itseez","html_url":"https://github.com/Itseez","followers_url":"https://api.github.com/users/Itseez/followers","following_url":"https://api.github.com/users/Itseez/following{/other_user}","gists_url":"https://api.github.com/users/Itseez/gists{/gist_id}","starred_url":"https://api.github.com/users/Itseez/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Itseez/subscriptions","organizations_url":"https://api.github.com/users/Itseez/orgs","repos_url":"https://api.github.com/users/Itseez/repos","events_url":"https://api.github.com/users/Itseez/events{/privacy}","received_events_url":"https://api.github.com/users/Itseez/received_events","type":"Organization","site_admin":false},"repo":{"id":5108051,"name":"opencv","full_name":"Itseez/opencv","owner":{"login":"Itseez","id":1786446,"avatar_url":"https://avatars.githubusercontent.com/u/1786446?v=3","gravatar_id":"","url":"https://api.github.com/users/Itseez","html_url":"https://github.com/Itseez","followers_url":"https://api.github.com/users/Itseez/followers","following_url":"https://api.github.com/users/Itseez/following{/other_user}","gists_url":"https://api.github.com/users/Itseez/gists{/gist_id}","starred_url":"https://api.github.com/users/Itseez/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Itseez/subscriptions","organizations_url":"https://api.github.com/users/Itseez/orgs","repos_url":"https://api.github.com/users/Itseez/repos","events_url":"https://api.github.com/users/Itseez/events{/privacy}","received_events_url":"https://api.github.com/users/Itseez/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/Itseez/opencv","description":"Open Source Computer Vision Library","fork":false,"url":"https://api.github.com/repos/Itseez/opencv","forks_url":"https://api.github.com/repos/Itseez/opencv/forks","keys_url":"https://api.github.com/repos/Itseez/opencv/keys{/key_id}","collaborators_url":"https://api.github.com/repos/Itseez/opencv/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/Itseez/opencv/teams","hooks_url":"https://api.github.com/repos/Itseez/opencv/hooks","issue_events_url":"https://api.github.com/repos/Itseez/opencv/issues/events{/number}","events_url":"https://api.github.com/repos/Itseez/opencv/events","assignees_url":"https://api.github.com/repos/Itseez/opencv/assignees{/user}","branches_url":"https://api.github.com/repos/Itseez/opencv/branches{/branch}","tags_url":"https://api.github.com/repos/Itseez/opencv/tags","blobs_url":"https://api.github.com/repos/Itseez/opencv/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/Itseez/opencv/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/Itseez/opencv/git/refs{/sha}","trees_url":"https://api.github.com/repos/Itseez/opencv/git/trees{/sha}","statuses_url":"https://api.github.com/repos/Itseez/opencv/statuses/{sha}","languages_url":"https://api.github.com/repos/Itseez/opencv/languages","stargazers_url":"https://api.github.com/repos/Itseez/opencv/stargazers","contributors_url":"https://api.github.com/repos/Itseez/opencv/contributors","subscribers_url":"https://api.github.com/repos/Itseez/opencv/subscribers","subscription_url":"https://api.github.com/repos/Itseez/opencv/subscription","commits_url":"https://api.github.com/repos/Itseez/opencv/commits{/sha}","git_commits_url":"https://api.github.com/repos/Itseez/opencv/git/commits{/sha}","comments_url":"https://api.github.com/repos/Itseez/opencv/comments{/number}","issue_comment_url":"https://api.github.com/repos/Itseez/opencv/issues/comments{/number}","contents_url":"https://api.github.com/repos/Itseez/opencv/contents/{+path}","compare_url":"https://api.github.com/repos/Itseez/opencv/compare/{base}...{head}","merges_url":"https://api.github.com/repos/Itseez/opencv/merges","archive_url":"https://api.github.com/repos/Itseez/opencv/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/Itseez/opencv/downloads","issues_url":"https://api.github.com/repos/Itseez/opencv/issues{/number}","pulls_url":"https://api.github.com/repos/Itseez/opencv/pulls{/number}","milestones_url":"https://api.github.com/repos/Itseez/opencv/milestones{/number}","notifications_url":"https://api.github.com/repos/Itseez/opencv/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/Itseez/opencv/labels{/name}","releases_url":"https://api.github.com/repos/Itseez/opencv/releases{/id}","created_at":"2012-07-19T09:40:17Z","updated_at":"2015-09-03T10:18:51Z","pushed_at":"2015-09-03T07:48:22Z","git_url":"git://github.com/Itseez/opencv.git","ssh_url":"git@github.com:Itseez/opencv.git","clone_url":"https://github.com/Itseez/opencv.git","svn_url":"https://github.com/Itseez/opencv","homepage":"opencv.org","size":1158096,"stargazers_count":6455,"watchers_count":6455,"language":"C++","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":5737,"mirror_url":null,"open_issues_count":898,"forks":5737,"open_issues":898,"watchers":6455,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/Itseez/opencv/pulls/5291"},"html":{"href":"https://github.com/Itseez/opencv/pull/5291"},"issue":{"href":"https://api.github.com/repos/Itseez/opencv/issues/5291"},"comments":{"href":"https://api.github.com/repos/Itseez/opencv/issues/5291/comments"},"review_comments":{"href":"https://api.github.com/repos/Itseez/opencv/pulls/5291/comments"},"review_comment":{"href":"https://api.github.com/repos/Itseez/opencv/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/Itseez/opencv/pulls/5291/commits"},"statuses":{"href":"https://api.github.com/repos/Itseez/opencv/statuses/19b096d9663c338479e2b6b0939ea4bd8c0b9b50"}}}}