{"action":"created","issue":{"url":"https://api.github.com/repos/apache/spark/issues/15721","repository_url":"https://api.github.com/repos/apache/spark","labels_url":"https://api.github.com/repos/apache/spark/issues/15721/labels{/name}","comments_url":"https://api.github.com/repos/apache/spark/issues/15721/comments","events_url":"https://api.github.com/repos/apache/spark/issues/15721/events","html_url":"https://github.com/apache/spark/pull/15721","id":186644681,"number":15721,"title":"[SPARK-17772][ML][TEST] Add test functions for ML sample weights","user":{"login":"sethah","id":7275795,"avatar_url":"https://avatars.githubusercontent.com/u/7275795?v=3","gravatar_id":"","url":"https://api.github.com/users/sethah","html_url":"https://github.com/sethah","followers_url":"https://api.github.com/users/sethah/followers","following_url":"https://api.github.com/users/sethah/following{/other_user}","gists_url":"https://api.github.com/users/sethah/gists{/gist_id}","starred_url":"https://api.github.com/users/sethah/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/sethah/subscriptions","organizations_url":"https://api.github.com/users/sethah/orgs","repos_url":"https://api.github.com/users/sethah/repos","events_url":"https://api.github.com/users/sethah/events{/privacy}","received_events_url":"https://api.github.com/users/sethah/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":8,"created_at":"2016-11-01T20:55:49Z","updated_at":"2016-12-21T18:17:33Z","closed_at":null,"pull_request":{"url":"https://api.github.com/repos/apache/spark/pulls/15721","html_url":"https://github.com/apache/spark/pull/15721","diff_url":"https://github.com/apache/spark/pull/15721.diff","patch_url":"https://github.com/apache/spark/pull/15721.patch"},"body":"## What changes were proposed in this pull request?\r\n\r\nMore and more ML algos are accepting sample weights, and they have been tested rather heterogeneously and with code duplication. This patch adds extensible helper methods to `MLTestingUtils` that can be reused by various algorithms accepting sample weights. Up to now, there seems to be a few tests that have been implemented commonly:\r\n\r\n* Check that oversampling is the same as giving the instances sample weights proportional to the number of samples\r\n* Check that outliers with tiny sample weights do not affect the algorithm's performance\r\n\r\nThis patch adds an additional test:\r\n\r\n* Check that algorithms are invariant to constant scaling of the sample weights. i.e. uniform sample weights with `w_i = 1.0` is effectively the same as uniform sample weights with `w_i = 10000` or `w_i = 0.0001`\r\n\r\nThe instances of these tests occurred in LinearRegression, NaiveBayes, and LogisticRegression. Those tests have been removed/modified to use the new helper methods. These helper functions will be of use when [SPARK-9478](https://issues.apache.org/jira/browse/SPARK-9478) is implemented. \r\n\r\n## How was this patch tested?\r\n\r\nThis patch only involves modifying test suites.\r\n\r\n## Other notes\r\n\r\nBoth IsotonicRegression and GeneralizedLinearRegression also extend `HasWeightCol`. I did not modify these test suites because it will make this patch easier to review, and because they did not duplicate the same tests as the three suites that were modified. If we want to change them later, we can create a JIRA for it now, but it's open for debate.\r\n\r\n"},"comment":{"url":"https://api.github.com/repos/apache/spark/issues/comments/268599246","html_url":"https://github.com/apache/spark/pull/15721#issuecomment-268599246","issue_url":"https://api.github.com/repos/apache/spark/issues/15721","id":268599246,"user":{"login":"AmplabJenkins","id":4031291,"avatar_url":"https://avatars.githubusercontent.com/u/4031291?v=3","gravatar_id":"","url":"https://api.github.com/users/AmplabJenkins","html_url":"https://github.com/AmplabJenkins","followers_url":"https://api.github.com/users/AmplabJenkins/followers","following_url":"https://api.github.com/users/AmplabJenkins/following{/other_user}","gists_url":"https://api.github.com/users/AmplabJenkins/gists{/gist_id}","starred_url":"https://api.github.com/users/AmplabJenkins/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/AmplabJenkins/subscriptions","organizations_url":"https://api.github.com/users/AmplabJenkins/orgs","repos_url":"https://api.github.com/users/AmplabJenkins/repos","events_url":"https://api.github.com/users/AmplabJenkins/events{/privacy}","received_events_url":"https://api.github.com/users/AmplabJenkins/received_events","type":"User","site_admin":false},"created_at":"2016-12-21T18:17:33Z","updated_at":"2016-12-21T18:17:33Z","body":"Merged build finished. Test PASSed."}}
{"actor":{"display_login":"AmplabJenkins"}}