Returns a ChiSquared feature selector.
Returns a ChiSquared feature selector.
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.
Creates a ChiSquared feature selector. The selector supports different selection methods:
numTopFeatures
,percentile
,fpr
.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-value is below a threshold, thus controlling the false positive rate of selection. By default, the selection method isnumTopFeatures
, with the default number of top features set to 50.