Github user mpjlu commented on a diff in the pull request:

    https://github.com/apache/spark/pull/14597#discussion_r75802754
  
    --- Diff: 
mllib/src/main/scala/org/apache/spark/mllib/feature/ChiSqSelector.scala ---
    @@ -171,14 +180,47 @@ object ChiSqSelectorModel extends 
Loader[ChiSqSelectorModel] {
     
     /**
      * Creates a ChiSquared feature selector.
    - * @param numTopFeatures number of features that selector will select
    - *                       (ordered by statistic value descending)
    - *                       Note that if the number of features is less than 
numTopFeatures,
    - *                       then this will select all features.
      */
    -@Since("1.3.0")
    -class ChiSqSelector @Since("1.3.0") (
    -  @Since("1.3.0") val numTopFeatures: Int) extends Serializable {
    +@Since("2.1.0")
    +class ChiSqSelector @Since("2.1.0") () extends Serializable {
    +  private var numTopFeatures: Int = 50
    +  private var percentile: Double = 0.1
    +  private var alpha: Double = 0.05
    +  private var selectorType = ChiSqSelectorType.KBest
    +
    +  @Since("1.3.0")
    +  def this(numTopFeatures: Int) {
    +    this()
    +    this.numTopFeatures = numTopFeatures
    +  }
    +
    +  @Since("2.1.0")
    +  def setNumTopFeatures(value: Int): this.type = {
    +    numTopFeatures = value
    +    selectorType = ChiSqSelectorType.KBest
    +    this
    +  }
    +
    +  @Since("2.1.0")
    +  def setPercentile(value: Double): this.type = {
    +    require(value <= 1 && value >= 0, "Percentile should be larger than 0 
and less than 100")
    --- End diff --
    
    Thanks, the code is updated


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscr...@spark.apache.org
For additional commands, e-mail: reviews-h...@spark.apache.org

Reply via email to