class ChiSqSelector extends Serializable
Creates a ChiSquared feature selector.
The selector supports different selection methods: numTopFeatures
, percentile
, fpr
,
fdr
, fwe
.
numTopFeatures
chooses a fixed number of top features according to a chi-squared test.percentile
is similar but chooses a fraction of all features instead of a fixed number.fpr
chooses all features whose p-values are below a threshold, thus controlling the false positive rate of selection.fdr
uses the [Benjamini-Hochberg procedure] (https://en.wikipedia.org/wiki/False_discovery_rate#Benjamini.E2.80.93Hochberg_procedure) to choose all features whose false discovery rate is below a threshold.fwe
chooses all features whose p-values are below a threshold. The threshold is scaled by 1/numFeatures, thus controlling the family-wise error rate of selection. By default, the selection method isnumTopFeatures
, with the default number of top features set to 50.
- Annotations
- @Since( "1.3.0" )
- Source
- ChiSqSelector.scala
- Alphabetic
- By Inheritance
- ChiSqSelector
- Serializable
- Serializable
- AnyRef
- Any
- Hide All
- Show All
- Public
- All
Instance Constructors
Value Members
- var fdr: Double
-
def
fit(data: RDD[LabeledPoint]): ChiSqSelectorModel
Returns a ChiSquared feature selector.
Returns a ChiSquared feature selector.
- data
an
RDD[LabeledPoint]
containing the labeled dataset with categorical features. Real-valued features will be treated as categorical for each distinct value. Apply feature discretizer before using this function.
- Annotations
- @Since( "1.3.0" )
- var fpr: Double
- var fwe: Double
- var numTopFeatures: Int
- var percentile: Double
- var selectorType: String
-
def
setFdr(value: Double): ChiSqSelector.this.type
- Annotations
- @Since( "2.2.0" )
-
def
setFpr(value: Double): ChiSqSelector.this.type
- Annotations
- @Since( "2.1.0" )
-
def
setFwe(value: Double): ChiSqSelector.this.type
- Annotations
- @Since( "2.2.0" )
-
def
setNumTopFeatures(value: Int): ChiSqSelector.this.type
- Annotations
- @Since( "1.6.0" )
-
def
setPercentile(value: Double): ChiSqSelector.this.type
- Annotations
- @Since( "2.1.0" )
-
def
setSelectorType(value: String): ChiSqSelector.this.type
- Annotations
- @Since( "2.1.0" )