{"action":"created","comment":{"url":"https://api.github.com/repos/apache/spark/pulls/comments/75689943","id":75689943,"diff_hunk":"@@ -171,14 +180,47 @@ object ChiSqSelectorModel extends Loader[ChiSqSelectorModel] {\n \n /**\n  * Creates a ChiSquared feature selector.\n- * @param numTopFeatures number of features that selector will select\n- *                       (ordered by statistic value descending)\n- *                       Note that if the number of features is less than numTopFeatures,\n- *                       then this will select all features.\n  */\n-@Since(\"1.3.0\")\n-class ChiSqSelector @Since(\"1.3.0\") (\n-  @Since(\"1.3.0\") val numTopFeatures: Int) extends Serializable {\n+@Since(\"2.1.0\")\n+class ChiSqSelector @Since(\"2.1.0\") () extends Serializable {\n+  private var numTopFeatures: Int = 50\n+  private var percentile: Double = 0.1\n+  private var alpha: Double = 0.05\n+  private var selectorType = ChiSqSelectorType.KBest\n+\n+  @Since(\"1.3.0\")\n+  def this(numTopFeatures: Int) {\n+    this()\n+    this.numTopFeatures = numTopFeatures\n+  }\n+\n+  @Since(\"2.1.0\")\n+  def setNumTopFeatures(value: Int): this.type = {\n+    numTopFeatures = value\n+    selectorType = ChiSqSelectorType.KBest\n+    this\n+  }\n+\n+  @Since(\"2.1.0\")\n+  def setPercentile(value: Double): this.type = {\n+    require(value <= 1 && value >= 0, \"Percentile should be larger than 0 and less than 100\")\n+    percentile = value\n+    selectorType = ChiSqSelectorType.Percentile\n+    this\n+  }\n+\n+  @Since(\"2.1.0\")\n+  def setAlpha(value: Double): this.type = {","path":"mllib/src/main/scala/org/apache/spark/mllib/feature/ChiSqSelector.scala","position":106,"original_position":106,"commit_id":"61b71c81a75f88f8f9144e325e1a58f271e1aba0","original_commit_id":"61b71c81a75f88f8f9144e325e1a58f271e1aba0","user":{"login":"hqzizania","id":9315372,"avatar_url":"https://avatars.githubusercontent.com/u/9315372?v=3","gravatar_id":"","url":"https://api.github.com/users/hqzizania","html_url":"https://github.com/hqzizania","followers_url":"https://api.github.com/users/hqzizania/followers","following_url":"https://api.github.com/users/hqzizania/following{/other_user}","gists_url":"https://api.github.com/users/hqzizania/gists{/gist_id}","starred_url":"https://api.github.com/users/hqzizania/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/hqzizania/subscriptions","organizations_url":"https://api.github.com/users/hqzizania/orgs","repos_url":"https://api.github.com/users/hqzizania/repos","events_url":"https://api.github.com/users/hqzizania/events{/privacy}","received_events_url":"https://api.github.com/users/hqzizania/received_events","type":"User","site_admin":false},"body":"Does it need a `require` for alpha here?","created_at":"2016-08-22T14:41:02Z","updated_at":"2016-08-22T14:41:02Z","html_url":"https://github.com/apache/spark/pull/14597#discussion_r75689943","pull_request_url":"https://api.github.com/repos/apache/spark/pulls/14597","_links":{"self":{"href":"https://api.github.com/repos/apache/spark/pulls/comments/75689943"},"html":{"href":"https://github.com/apache/spark/pull/14597#discussion_r75689943"},"pull_request":{"href":"https://api.github.com/repos/apache/spark/pulls/14597"}}},"pull_request":{"url":"https://api.github.com/repos/apache/spark/pulls/14597","id":80913258,"html_url":"https://github.com/apache/spark/pull/14597","diff_url":"https://github.com/apache/spark/pull/14597.diff","patch_url":"https://github.com/apache/spark/pull/14597.patch","issue_url":"https://api.github.com/repos/apache/spark/issues/14597","number":14597,"state":"open","locked":false,"title":"[SPARK-17017][MLLIB][ML] add a chiSquare Selector based on False Positive Rate (FPR) test","user":{"login":"mpjlu","id":13826327,"avatar_url":"https://avatars.githubusercontent.com/u/13826327?v=3","gravatar_id":"","url":"https://api.github.com/users/mpjlu","html_url":"https://github.com/mpjlu","followers_url":"https://api.github.com/users/mpjlu/followers","following_url":"https://api.github.com/users/mpjlu/following{/other_user}","gists_url":"https://api.github.com/users/mpjlu/gists{/gist_id}","starred_url":"https://api.github.com/users/mpjlu/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mpjlu/subscriptions","organizations_url":"https://api.github.com/users/mpjlu/orgs","repos_url":"https://api.github.com/users/mpjlu/repos","events_url":"https://api.github.com/users/mpjlu/events{/privacy}","received_events_url":"https://api.github.com/users/mpjlu/received_events","type":"User","site_admin":false},"body":"## What changes were proposed in this pull request?\r\n\r\nUnivariate feature selection works by selecting the best features based on univariate statistical tests. False Positive Rate (FPR) is a popular univariate statistical test for feature selection. We add a chiSquare Selector based on False Positive Rate (FPR) test in this PR, like it is implemented in scikit-learn. \r\nhttp://scikit-learn.org/stable/modules/feature_selection.html#univariate-feature-selection\r\n\r\n\r\n## How was this patch tested?\r\n\r\nAdd Scala ut\r\n\r\n","created_at":"2016-08-11T07:21:14Z","updated_at":"2016-08-22T14:41:02Z","closed_at":null,"merged_at":null,"merge_commit_sha":"1537f9d7905fc15cc50a25d99211adf00b9fdceb","assignee":null,"assignees":[],"milestone":null,"commits_url":"https://api.github.com/repos/apache/spark/pulls/14597/commits","review_comments_url":"https://api.github.com/repos/apache/spark/pulls/14597/comments","review_comment_url":"https://api.github.com/repos/apache/spark/pulls/comments{/number}","comments_url":"https://api.github.com/repos/apache/spark/issues/14597/comments","statuses_url":"https://api.github.com/repos/apache/spark/statuses/61b71c81a75f88f8f9144e325e1a58f271e1aba0","head":{"label":"mpjlu:fprChiSquare","ref":"fprChiSquare","sha":"61b71c81a75f88f8f9144e325e1a58f271e1aba0","user":{"login":"mpjlu","id":13826327,"avatar_url":"https://avatars.githubusercontent.com/u/13826327?v=3","gravatar_id":"","url":"https://api.github.com/users/mpjlu","html_url":"https://github.com/mpjlu","followers_url":"https://api.github.com/users/mpjlu/followers","following_url":"https://api.github.com/users/mpjlu/following{/other_user}","gists_url":"https://api.github.com/users/mpjlu/gists{/gist_id}","starred_url":"https://api.github.com/users/mpjlu/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mpjlu/subscriptions","organizations_url":"https://api.github.com/users/mpjlu/orgs","repos_url":"https://api.github.com/users/mpjlu/repos","events_url":"https://api.github.com/users/mpjlu/events{/privacy}","received_events_url":"https://api.github.com/users/mpjlu/received_events","type":"User","site_admin":false},"repo":{"id":64218821,"name":"spark","full_name":"mpjlu/spark","owner":{"login":"mpjlu","id":13826327,"avatar_url":"https://avatars.githubusercontent.com/u/13826327?v=3","gravatar_id":"","url":"https://api.github.com/users/mpjlu","html_url":"https://github.com/mpjlu","followers_url":"https://api.github.com/users/mpjlu/followers","following_url":"https://api.github.com/users/mpjlu/following{/other_user}","gists_url":"https://api.github.com/users/mpjlu/gists{/gist_id}","starred_url":"https://api.github.com/users/mpjlu/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mpjlu/subscriptions","organizations_url":"https://api.github.com/users/mpjlu/orgs","repos_url":"https://api.github.com/users/mpjlu/repos","events_url":"https://api.github.com/users/mpjlu/events{/privacy}","received_events_url":"https://api.github.com/users/mpjlu/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/mpjlu/spark","description":"Mirror of Apache Spark","fork":true,"url":"https://api.github.com/repos/mpjlu/spark","forks_url":"https://api.github.com/repos/mpjlu/spark/forks","keys_url":"https://api.github.com/repos/mpjlu/spark/keys{/key_id}","collaborators_url":"https://api.github.com/repos/mpjlu/spark/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/mpjlu/spark/teams","hooks_url":"https://api.github.com/repos/mpjlu/spark/hooks","issue_events_url":"https://api.github.com/repos/mpjlu/spark/issues/events{/number}","events_url":"https://api.github.com/repos/mpjlu/spark/events","assignees_url":"https://api.github.com/repos/mpjlu/spark/assignees{/user}","branches_url":"https://api.github.com/repos/mpjlu/spark/branches{/branch}","tags_url":"https://api.github.com/repos/mpjlu/spark/tags","blobs_url":"https://api.github.com/repos/mpjlu/spark/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/mpjlu/spark/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/mpjlu/spark/git/refs{/sha}","trees_url":"https://api.github.com/repos/mpjlu/spark/git/trees{/sha}","statuses_url":"https://api.github.com/repos/mpjlu/spark/statuses/{sha}","languages_url":"https://api.github.com/repos/mpjlu/spark/languages","stargazers_url":"https://api.github.com/repos/mpjlu/spark/stargazers","contributors_url":"https://api.github.com/repos/mpjlu/spark/contributors","subscribers_url":"https://api.github.com/repos/mpjlu/spark/subscribers","subscription_url":"https://api.github.com/repos/mpjlu/spark/subscription","commits_url":"https://api.github.com/repos/mpjlu/spark/commits{/sha}","git_commits_url":"https://api.github.com/repos/mpjlu/spark/git/commits{/sha}","comments_url":"https://api.github.com/repos/mpjlu/spark/comments{/number}","issue_comment_url":"https://api.github.com/repos/mpjlu/spark/issues/comments{/number}","contents_url":"https://api.github.com/repos/mpjlu/spark/contents/{+path}","compare_url":"https://api.github.com/repos/mpjlu/spark/compare/{base}...{head}","merges_url":"https://api.github.com/repos/mpjlu/spark/merges","archive_url":"https://api.github.com/repos/mpjlu/spark/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/mpjlu/spark/downloads","issues_url":"https://api.github.com/repos/mpjlu/spark/issues{/number}","pulls_url":"https://api.github.com/repos/mpjlu/spark/pulls{/number}","milestones_url":"https://api.github.com/repos/mpjlu/spark/milestones{/number}","notifications_url":"https://api.github.com/repos/mpjlu/spark/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/mpjlu/spark/labels{/name}","releases_url":"https://api.github.com/repos/mpjlu/spark/releases{/id}","deployments_url":"https://api.github.com/repos/mpjlu/spark/deployments","created_at":"2016-07-26T12:17:42Z","updated_at":"2016-07-26T12:18:08Z","pushed_at":"2016-08-22T11:34:56Z","git_url":"git://github.com/mpjlu/spark.git","ssh_url":"git@github.com:mpjlu/spark.git","clone_url":"https://github.com/mpjlu/spark.git","svn_url":"https://github.com/mpjlu/spark","homepage":null,"size":176244,"stargazers_count":0,"watchers_count":0,"language":"Scala","has_issues":false,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":2,"forks":0,"open_issues":2,"watchers":0,"default_branch":"master"}},"base":{"label":"apache:master","ref":"master","sha":"e28a8c5899c48ff065e2fd3bb6b10c82b4d39c2c","user":{"login":"apache","id":47359,"avatar_url":"https://avatars.githubusercontent.com/u/47359?v=3","gravatar_id":"","url":"https://api.github.com/users/apache","html_url":"https://github.com/apache","followers_url":"https://api.github.com/users/apache/followers","following_url":"https://api.github.com/users/apache/following{/other_user}","gists_url":"https://api.github.com/users/apache/gists{/gist_id}","starred_url":"https://api.github.com/users/apache/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/apache/subscriptions","organizations_url":"https://api.github.com/users/apache/orgs","repos_url":"https://api.github.com/users/apache/repos","events_url":"https://api.github.com/users/apache/events{/privacy}","received_events_url":"https://api.github.com/users/apache/received_events","type":"Organization","site_admin":false},"repo":{"id":17165658,"name":"spark","full_name":"apache/spark","owner":{"login":"apache","id":47359,"avatar_url":"https://avatars.githubusercontent.com/u/47359?v=3","gravatar_id":"","url":"https://api.github.com/users/apache","html_url":"https://github.com/apache","followers_url":"https://api.github.com/users/apache/followers","following_url":"https://api.github.com/users/apache/following{/other_user}","gists_url":"https://api.github.com/users/apache/gists{/gist_id}","starred_url":"https://api.github.com/users/apache/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/apache/subscriptions","organizations_url":"https://api.github.com/users/apache/orgs","repos_url":"https://api.github.com/users/apache/repos","events_url":"https://api.github.com/users/apache/events{/privacy}","received_events_url":"https://api.github.com/users/apache/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/apache/spark","description":"Mirror of Apache Spark","fork":false,"url":"https://api.github.com/repos/apache/spark","forks_url":"https://api.github.com/repos/apache/spark/forks","keys_url":"https://api.github.com/repos/apache/spark/keys{/key_id}","collaborators_url":"https://api.github.com/repos/apache/spark/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/apache/spark/teams","hooks_url":"https://api.github.com/repos/apache/spark/hooks","issue_events_url":"https://api.github.com/repos/apache/spark/issues/events{/number}","events_url":"https://api.github.com/repos/apache/spark/events","assignees_url":"https://api.github.com/repos/apache/spark/assignees{/user}","branches_url":"https://api.github.com/repos/apache/spark/branches{/branch}","tags_url":"https://api.github.com/repos/apache/spark/tags","blobs_url":"https://api.github.com/repos/apache/spark/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/apache/spark/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/apache/spark/git/refs{/sha}","trees_url":"https://api.github.com/repos/apache/spark/git/trees{/sha}","statuses_url":"https://api.github.com/repos/apache/spark/statuses/{sha}","languages_url":"https://api.github.com/repos/apache/spark/languages","stargazers_url":"https://api.github.com/repos/apache/spark/stargazers","contributors_url":"https://api.github.com/repos/apache/spark/contributors","subscribers_url":"https://api.github.com/repos/apache/spark/subscribers","subscription_url":"https://api.github.com/repos/apache/spark/subscription","commits_url":"https://api.github.com/repos/apache/spark/commits{/sha}","git_commits_url":"https://api.github.com/repos/apache/spark/git/commits{/sha}","comments_url":"https://api.github.com/repos/apache/spark/comments{/number}","issue_comment_url":"https://api.github.com/repos/apache/spark/issues/comments{/number}","contents_url":"https://api.github.com/repos/apache/spark/contents/{+path}","compare_url":"https://api.github.com/repos/apache/spark/compare/{base}...{head}","merges_url":"https://api.github.com/repos/apache/spark/merges","archive_url":"https://api.github.com/repos/apache/spark/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/apache/spark/downloads","issues_url":"https://api.github.com/repos/apache/spark/issues{/number}","pulls_url":"https://api.github.com/repos/apache/spark/pulls{/number}","milestones_url":"https://api.github.com/repos/apache/spark/milestones{/number}","notifications_url":"https://api.github.com/repos/apache/spark/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/apache/spark/labels{/name}","releases_url":"https://api.github.com/repos/apache/spark/releases{/id}","deployments_url":"https://api.github.com/repos/apache/spark/deployments","created_at":"2014-02-25T08:00:08Z","updated_at":"2016-08-22T09:45:23Z","pushed_at":"2016-08-22T14:32:59Z","git_url":"git://github.com/apache/spark.git","ssh_url":"git@github.com:apache/spark.git","clone_url":"https://github.com/apache/spark.git","svn_url":"https://github.com/apache/spark","homepage":null,"size":510272,"stargazers_count":9733,"watchers_count":9733,"language":"Scala","has_issues":false,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":9079,"mirror_url":"git://git.apache.org/spark.git","open_issues_count":478,"forks":9079,"open_issues":478,"watchers":9733,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/apache/spark/pulls/14597"},"html":{"href":"https://github.com/apache/spark/pull/14597"},"issue":{"href":"https://api.github.com/repos/apache/spark/issues/14597"},"comments":{"href":"https://api.github.com/repos/apache/spark/issues/14597/comments"},"review_comments":{"href":"https://api.github.com/repos/apache/spark/pulls/14597/comments"},"review_comment":{"href":"https://api.github.com/repos/apache/spark/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/apache/spark/pulls/14597/commits"},"statuses":{"href":"https://api.github.com/repos/apache/spark/statuses/61b71c81a75f88f8f9144e325e1a58f271e1aba0"}}}}
{"actor":{"display_login":"hqzizania"}}