{"action":"created","comment":{"url":"https://api.github.com/repos/wso2/carbon-ml/pulls/comments/47479432","id":47479432,"diff_hunk":"@@ -159,7 +168,38 @@ private ModelSummary buildKMeansModel(long modelID, JavaRDD<Vector> trainingData\n //            if (testingData != null) {\n //                testingData.cache();\n //            }\n-            \n+\n+            // generating data for summary clusters\n+            double sampleSize = (double) MLCoreServiceValueHolder.getInstance().getSummaryStatSettings()\n+                    .getSampleSize();\n+            double sampleFraction = sampleSize / (trainingData.count() - 1);\n+            JavaRDD<Vector> sampleData = null;\n+            if (sampleFraction >= 1.0) {\n+                sampleData = trainingData;\n+            }\n+            // Use ramdomly selected sample fraction of rows if number of records is > sample fraction\n+            else {\n+                sampleData = trainingData.sample(false, sampleFraction);\n+            }\n+","path":"components/ml/org.wso2.carbon.ml.core/src/main/java/org/wso2/carbon/ml/core/spark/algorithms/UnsupervisedSparkModelBuilder.java","position":70,"original_position":70,"commit_id":"d7c4159cfaf3fc60a1e4aa89ad134ff7088a0e5c","original_commit_id":"d7c4159cfaf3fc60a1e4aa89ad134ff7088a0e5c","user":{"login":"nirmal070125","id":413016,"avatar_url":"https://avatars.githubusercontent.com/u/413016?v=3","gravatar_id":"","url":"https://api.github.com/users/nirmal070125","html_url":"https://github.com/nirmal070125","followers_url":"https://api.github.com/users/nirmal070125/followers","following_url":"https://api.github.com/users/nirmal070125/following{/other_user}","gists_url":"https://api.github.com/users/nirmal070125/gists{/gist_id}","starred_url":"https://api.github.com/users/nirmal070125/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/nirmal070125/subscriptions","organizations_url":"https://api.github.com/users/nirmal070125/orgs","repos_url":"https://api.github.com/users/nirmal070125/repos","events_url":"https://api.github.com/users/nirmal070125/events{/privacy}","received_events_url":"https://api.github.com/users/nirmal070125/received_events","type":"User","site_admin":false},"body":"At this point, please unpersist training data (as it is no more used) and cache sampleData.","created_at":"2015-12-14T10:08:14Z","updated_at":"2015-12-14T10:08:14Z","html_url":"https://github.com/wso2/carbon-ml/pull/172#discussion_r47479432","pull_request_url":"https://api.github.com/repos/wso2/carbon-ml/pulls/172","_links":{"self":{"href":"https://api.github.com/repos/wso2/carbon-ml/pulls/comments/47479432"},"html":{"href":"https://github.com/wso2/carbon-ml/pull/172#discussion_r47479432"},"pull_request":{"href":"https://api.github.com/repos/wso2/carbon-ml/pulls/172"}}},"pull_request":{"url":"https://api.github.com/repos/wso2/carbon-ml/pulls/172","id":53543423,"html_url":"https://github.com/wso2/carbon-ml/pull/172","diff_url":"https://github.com/wso2/carbon-ml/pull/172.diff","patch_url":"https://github.com/wso2/carbon-ml/pull/172.patch","issue_url":"https://api.github.com/repos/wso2/carbon-ml/issues/172","number":172,"state":"open","locked":false,"title":"Cluster diagram for K-Means model summary","user":{"login":"fazlan-nazeem","id":13759167,"avatar_url":"https://avatars.githubusercontent.com/u/13759167?v=3","gravatar_id":"","url":"https://api.github.com/users/fazlan-nazeem","html_url":"https://github.com/fazlan-nazeem","followers_url":"https://api.github.com/users/fazlan-nazeem/followers","following_url":"https://api.github.com/users/fazlan-nazeem/following{/other_user}","gists_url":"https://api.github.com/users/fazlan-nazeem/gists{/gist_id}","starred_url":"https://api.github.com/users/fazlan-nazeem/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/fazlan-nazeem/subscriptions","organizations_url":"https://api.github.com/users/fazlan-nazeem/orgs","repos_url":"https://api.github.com/users/fazlan-nazeem/repos","events_url":"https://api.github.com/users/fazlan-nazeem/events{/privacy}","received_events_url":"https://api.github.com/users/fazlan-nazeem/received_events","type":"User","site_admin":false},"body":"https://wso2.org/jira/browse/ML-52","created_at":"2015-12-14T09:54:32Z","updated_at":"2015-12-14T10:08:15Z","closed_at":null,"merged_at":null,"merge_commit_sha":"c60749c600da1a8f6d2b06a5a58a5a5fd37df10b","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/wso2/carbon-ml/pulls/172/commits","review_comments_url":"https://api.github.com/repos/wso2/carbon-ml/pulls/172/comments","review_comment_url":"https://api.github.com/repos/wso2/carbon-ml/pulls/comments{/number}","comments_url":"https://api.github.com/repos/wso2/carbon-ml/issues/172/comments","statuses_url":"https://api.github.com/repos/wso2/carbon-ml/statuses/d7c4159cfaf3fc60a1e4aa89ad134ff7088a0e5c","head":{"label":"fazlan-nazeem:master","ref":"master","sha":"d7c4159cfaf3fc60a1e4aa89ad134ff7088a0e5c","user":{"login":"fazlan-nazeem","id":13759167,"avatar_url":"https://avatars.githubusercontent.com/u/13759167?v=3","gravatar_id":"","url":"https://api.github.com/users/fazlan-nazeem","html_url":"https://github.com/fazlan-nazeem","followers_url":"https://api.github.com/users/fazlan-nazeem/followers","following_url":"https://api.github.com/users/fazlan-nazeem/following{/other_user}","gists_url":"https://api.github.com/users/fazlan-nazeem/gists{/gist_id}","starred_url":"https://api.github.com/users/fazlan-nazeem/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/fazlan-nazeem/subscriptions","organizations_url":"https://api.github.com/users/fazlan-nazeem/orgs","repos_url":"https://api.github.com/users/fazlan-nazeem/repos","events_url":"https://api.github.com/users/fazlan-nazeem/events{/privacy}","received_events_url":"https://api.github.com/users/fazlan-nazeem/received_events","type":"User","site_admin":false},"repo":{"id":43862174,"name":"carbon-ml","full_name":"fazlan-nazeem/carbon-ml","owner":{"login":"fazlan-nazeem","id":13759167,"avatar_url":"https://avatars.githubusercontent.com/u/13759167?v=3","gravatar_id":"","url":"https://api.github.com/users/fazlan-nazeem","html_url":"https://github.com/fazlan-nazeem","followers_url":"https://api.github.com/users/fazlan-nazeem/followers","following_url":"https://api.github.com/users/fazlan-nazeem/following{/other_user}","gists_url":"https://api.github.com/users/fazlan-nazeem/gists{/gist_id}","starred_url":"https://api.github.com/users/fazlan-nazeem/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/fazlan-nazeem/subscriptions","organizations_url":"https://api.github.com/users/fazlan-nazeem/orgs","repos_url":"https://api.github.com/users/fazlan-nazeem/repos","events_url":"https://api.github.com/users/fazlan-nazeem/events{/privacy}","received_events_url":"https://api.github.com/users/fazlan-nazeem/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/fazlan-nazeem/carbon-ml","description":"","fork":true,"url":"https://api.github.com/repos/fazlan-nazeem/carbon-ml","forks_url":"https://api.github.com/repos/fazlan-nazeem/carbon-ml/forks","keys_url":"https://api.github.com/repos/fazlan-nazeem/carbon-ml/keys{/key_id}","collaborators_url":"https://api.github.com/repos/fazlan-nazeem/carbon-ml/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/fazlan-nazeem/carbon-ml/teams","hooks_url":"https://api.github.com/repos/fazlan-nazeem/carbon-ml/hooks","issue_events_url":"https://api.github.com/repos/fazlan-nazeem/carbon-ml/issues/events{/number}","events_url":"https://api.github.com/repos/fazlan-nazeem/carbon-ml/events","assignees_url":"https://api.github.com/repos/fazlan-nazeem/carbon-ml/assignees{/user}","branches_url":"https://api.github.com/repos/fazlan-nazeem/carbon-ml/branches{/branch}","tags_url":"https://api.github.com/repos/fazlan-nazeem/carbon-ml/tags","blobs_url":"https://api.github.com/repos/fazlan-nazeem/carbon-ml/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/fazlan-nazeem/carbon-ml/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/fazlan-nazeem/carbon-ml/git/refs{/sha}","trees_url":"https://api.github.com/repos/fazlan-nazeem/carbon-ml/git/trees{/sha}","statuses_url":"https://api.github.com/repos/fazlan-nazeem/carbon-ml/statuses/{sha}","languages_url":"https://api.github.com/repos/fazlan-nazeem/carbon-ml/languages","stargazers_url":"https://api.github.com/repos/fazlan-nazeem/carbon-ml/stargazers","contributors_url":"https://api.github.com/repos/fazlan-nazeem/carbon-ml/contributors","subscribers_url":"https://api.github.com/repos/fazlan-nazeem/carbon-ml/subscribers","subscription_url":"https://api.github.com/repos/fazlan-nazeem/carbon-ml/subscription","commits_url":"https://api.github.com/repos/fazlan-nazeem/carbon-ml/commits{/sha}","git_commits_url":"https://api.github.com/repos/fazlan-nazeem/carbon-ml/git/commits{/sha}","comments_url":"https://api.github.com/repos/fazlan-nazeem/carbon-ml/comments{/number}","issue_comment_url":"https://api.github.com/repos/fazlan-nazeem/carbon-ml/issues/comments{/number}","contents_url":"https://api.github.com/repos/fazlan-nazeem/carbon-ml/contents/{+path}","compare_url":"https://api.github.com/repos/fazlan-nazeem/carbon-ml/compare/{base}...{head}","merges_url":"https://api.github.com/repos/fazlan-nazeem/carbon-ml/merges","archive_url":"https://api.github.com/repos/fazlan-nazeem/carbon-ml/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/fazlan-nazeem/carbon-ml/downloads","issues_url":"https://api.github.com/repos/fazlan-nazeem/carbon-ml/issues{/number}","pulls_url":"https://api.github.com/repos/fazlan-nazeem/carbon-ml/pulls{/number}","milestones_url":"https://api.github.com/repos/fazlan-nazeem/carbon-ml/milestones{/number}","notifications_url":"https://api.github.com/repos/fazlan-nazeem/carbon-ml/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/fazlan-nazeem/carbon-ml/labels{/name}","releases_url":"https://api.github.com/repos/fazlan-nazeem/carbon-ml/releases{/id}","created_at":"2015-10-08T04:08:55Z","updated_at":"2015-10-26T04:23:18Z","pushed_at":"2015-12-14T09:53:11Z","git_url":"git://github.com/fazlan-nazeem/carbon-ml.git","ssh_url":"git@github.com:fazlan-nazeem/carbon-ml.git","clone_url":"https://github.com/fazlan-nazeem/carbon-ml.git","svn_url":"https://github.com/fazlan-nazeem/carbon-ml","homepage":null,"size":8915,"stargazers_count":0,"watchers_count":0,"language":"Java","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":"wso2:master","ref":"master","sha":"79425a18040424026e5edb0f31b4ea9a8a8c0fe9","user":{"login":"wso2","id":533043,"avatar_url":"https://avatars.githubusercontent.com/u/533043?v=3","gravatar_id":"","url":"https://api.github.com/users/wso2","html_url":"https://github.com/wso2","followers_url":"https://api.github.com/users/wso2/followers","following_url":"https://api.github.com/users/wso2/following{/other_user}","gists_url":"https://api.github.com/users/wso2/gists{/gist_id}","starred_url":"https://api.github.com/users/wso2/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/wso2/subscriptions","organizations_url":"https://api.github.com/users/wso2/orgs","repos_url":"https://api.github.com/users/wso2/repos","events_url":"https://api.github.com/users/wso2/events{/privacy}","received_events_url":"https://api.github.com/users/wso2/received_events","type":"Organization","site_admin":false},"repo":{"id":35467512,"name":"carbon-ml","full_name":"wso2/carbon-ml","owner":{"login":"wso2","id":533043,"avatar_url":"https://avatars.githubusercontent.com/u/533043?v=3","gravatar_id":"","url":"https://api.github.com/users/wso2","html_url":"https://github.com/wso2","followers_url":"https://api.github.com/users/wso2/followers","following_url":"https://api.github.com/users/wso2/following{/other_user}","gists_url":"https://api.github.com/users/wso2/gists{/gist_id}","starred_url":"https://api.github.com/users/wso2/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/wso2/subscriptions","organizations_url":"https://api.github.com/users/wso2/orgs","repos_url":"https://api.github.com/users/wso2/repos","events_url":"https://api.github.com/users/wso2/events{/privacy}","received_events_url":"https://api.github.com/users/wso2/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/wso2/carbon-ml","description":"","fork":false,"url":"https://api.github.com/repos/wso2/carbon-ml","forks_url":"https://api.github.com/repos/wso2/carbon-ml/forks","keys_url":"https://api.github.com/repos/wso2/carbon-ml/keys{/key_id}","collaborators_url":"https://api.github.com/repos/wso2/carbon-ml/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/wso2/carbon-ml/teams","hooks_url":"https://api.github.com/repos/wso2/carbon-ml/hooks","issue_events_url":"https://api.github.com/repos/wso2/carbon-ml/issues/events{/number}","events_url":"https://api.github.com/repos/wso2/carbon-ml/events","assignees_url":"https://api.github.com/repos/wso2/carbon-ml/assignees{/user}","branches_url":"https://api.github.com/repos/wso2/carbon-ml/branches{/branch}","tags_url":"https://api.github.com/repos/wso2/carbon-ml/tags","blobs_url":"https://api.github.com/repos/wso2/carbon-ml/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/wso2/carbon-ml/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/wso2/carbon-ml/git/refs{/sha}","trees_url":"https://api.github.com/repos/wso2/carbon-ml/git/trees{/sha}","statuses_url":"https://api.github.com/repos/wso2/carbon-ml/statuses/{sha}","languages_url":"https://api.github.com/repos/wso2/carbon-ml/languages","stargazers_url":"https://api.github.com/repos/wso2/carbon-ml/stargazers","contributors_url":"https://api.github.com/repos/wso2/carbon-ml/contributors","subscribers_url":"https://api.github.com/repos/wso2/carbon-ml/subscribers","subscription_url":"https://api.github.com/repos/wso2/carbon-ml/subscription","commits_url":"https://api.github.com/repos/wso2/carbon-ml/commits{/sha}","git_commits_url":"https://api.github.com/repos/wso2/carbon-ml/git/commits{/sha}","comments_url":"https://api.github.com/repos/wso2/carbon-ml/comments{/number}","issue_comment_url":"https://api.github.com/repos/wso2/carbon-ml/issues/comments{/number}","contents_url":"https://api.github.com/repos/wso2/carbon-ml/contents/{+path}","compare_url":"https://api.github.com/repos/wso2/carbon-ml/compare/{base}...{head}","merges_url":"https://api.github.com/repos/wso2/carbon-ml/merges","archive_url":"https://api.github.com/repos/wso2/carbon-ml/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/wso2/carbon-ml/downloads","issues_url":"https://api.github.com/repos/wso2/carbon-ml/issues{/number}","pulls_url":"https://api.github.com/repos/wso2/carbon-ml/pulls{/number}","milestones_url":"https://api.github.com/repos/wso2/carbon-ml/milestones{/number}","notifications_url":"https://api.github.com/repos/wso2/carbon-ml/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/wso2/carbon-ml/labels{/name}","releases_url":"https://api.github.com/repos/wso2/carbon-ml/releases{/id}","created_at":"2015-05-12T04:50:29Z","updated_at":"2015-11-10T04:28:20Z","pushed_at":"2015-12-14T09:54:32Z","git_url":"git://github.com/wso2/carbon-ml.git","ssh_url":"git@github.com:wso2/carbon-ml.git","clone_url":"https://github.com/wso2/carbon-ml.git","svn_url":"https://github.com/wso2/carbon-ml","homepage":null,"size":11452,"stargazers_count":2,"watchers_count":2,"language":"Java","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":17,"mirror_url":null,"open_issues_count":2,"forks":17,"open_issues":2,"watchers":2,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/wso2/carbon-ml/pulls/172"},"html":{"href":"https://github.com/wso2/carbon-ml/pull/172"},"issue":{"href":"https://api.github.com/repos/wso2/carbon-ml/issues/172"},"comments":{"href":"https://api.github.com/repos/wso2/carbon-ml/issues/172/comments"},"review_comments":{"href":"https://api.github.com/repos/wso2/carbon-ml/pulls/172/comments"},"review_comment":{"href":"https://api.github.com/repos/wso2/carbon-ml/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/wso2/carbon-ml/pulls/172/commits"},"statuses":{"href":"https://api.github.com/repos/wso2/carbon-ml/statuses/d7c4159cfaf3fc60a1e4aa89ad134ff7088a0e5c"}}}}