Class ChiSqSelectorModel

All Implemented Interfaces:
Serializable, org.apache.spark.internal.Logging, SelectorParams, Params, HasFeaturesCol, HasLabelCol, HasOutputCol, Identifiable, MLWritable, scala.Serializable

public final class ChiSqSelectorModel extends Model<T>
Model fitted by ChiSqSelector.
See Also:
  • Method Details

    • read

      public static MLReader<ChiSqSelectorModel> read()
    • load

      public static ChiSqSelectorModel load(String path)
    • uid

      public String uid()
      Description copied from interface: Identifiable
      An immutable unique ID for the object and its derivatives.
      Specified by:
      uid in interface Identifiable
      Returns:
      (undocumented)
    • selectedFeatures

      public int[] selectedFeatures()
    • setFeaturesCol

      public ChiSqSelectorModel setFeaturesCol(String value)
    • setOutputCol

      public ChiSqSelectorModel setOutputCol(String value)
    • transformSchema

      public StructType transformSchema(StructType schema)
      Description copied from class: PipelineStage
      Check transform validity and derive the output schema from the input schema.

      We check validity for interactions between parameters during transformSchema and raise an exception if any parameter value is invalid. Parameter value checks which do not depend on other parameters are handled by Param.validate().

      Typical implementation should first conduct verification on schema change and parameter validity, including complex parameter interaction checks.

      Parameters:
      schema - (undocumented)
      Returns:
      (undocumented)
    • copy

      public ChiSqSelectorModel copy(ParamMap extra)
      Description copied from interface: Params
      Creates a copy of this instance with the same UID and some extra params. Subclasses should implement this method and set the return type properly. See defaultCopy().
      Specified by:
      copy in interface Params
      Specified by:
      copy in class Model<ChiSqSelectorModel>
      Parameters:
      extra - (undocumented)
      Returns:
      (undocumented)
    • write

      public MLWriter write()
      Description copied from interface: MLWritable
      Returns an MLWriter instance for this ML instance.
      Returns:
      (undocumented)
    • toString

      public String toString()
      Specified by:
      toString in interface Identifiable
      Overrides:
      toString in class Object
    • prepOutputField

      public static StructField prepOutputField(StructType schema, int[] selectedFeatures, String outputCol, String featuresCol, boolean isNumericAttribute)
      Prepare the output column field, including per-feature metadata.
      Parameters:
      schema - (undocumented)
      selectedFeatures - (undocumented)
      outputCol - (undocumented)
      featuresCol - (undocumented)
      isNumericAttribute - (undocumented)
      Returns:
      (undocumented)
    • compressSparse

      public static scala.Tuple2<int[],double[]> compressSparse(int[] indices, double[] values, int[] selectedFeatures)
    • numTopFeatures

      public final IntParam numTopFeatures()
      Description copied from interface: SelectorParams
      Number of features that selector will select, ordered by ascending p-value. If the number of features is less than numTopFeatures, then this will select all features. Only applicable when selectorType = "numTopFeatures". The default value of numTopFeatures is 50.

      Specified by:
      numTopFeatures in interface SelectorParams
      Returns:
      (undocumented)
    • percentile

      public final DoubleParam percentile()
      Description copied from interface: SelectorParams
      Percentile of features that selector will select, ordered by ascending p-value. Only applicable when selectorType = "percentile". Default value is 0.1.
      Specified by:
      percentile in interface SelectorParams
      Returns:
      (undocumented)
    • fpr

      public final DoubleParam fpr()
      Description copied from interface: SelectorParams
      The highest p-value for features to be kept. Only applicable when selectorType = "fpr". Default value is 0.05.
      Specified by:
      fpr in interface SelectorParams
      Returns:
      (undocumented)
    • fdr

      public final DoubleParam fdr()
      Description copied from interface: SelectorParams
      The upper bound of the expected false discovery rate. Only applicable when selectorType = "fdr". Default value is 0.05.
      Specified by:
      fdr in interface SelectorParams
      Returns:
      (undocumented)
    • fwe

      public final DoubleParam fwe()
      Description copied from interface: SelectorParams
      The upper bound of the expected family-wise error rate. Only applicable when selectorType = "fwe". Default value is 0.05.
      Specified by:
      fwe in interface SelectorParams
      Returns:
      (undocumented)
    • selectorType

      public final Param<String> selectorType()
      Description copied from interface: SelectorParams
      The selector type. Supported options: "numTopFeatures" (default), "percentile", "fpr", "fdr", "fwe"
      Specified by:
      selectorType in interface SelectorParams
      Returns:
      (undocumented)
    • outputCol

      public final Param<String> outputCol()
      Description copied from interface: HasOutputCol
      Param for output column name.
      Specified by:
      outputCol in interface HasOutputCol
      Returns:
      (undocumented)
    • labelCol

      public final Param<String> labelCol()
      Description copied from interface: HasLabelCol
      Param for label column name.
      Specified by:
      labelCol in interface HasLabelCol
      Returns:
      (undocumented)
    • featuresCol

      public final Param<String> featuresCol()
      Description copied from interface: HasFeaturesCol
      Param for features column name.
      Specified by:
      featuresCol in interface HasFeaturesCol
      Returns:
      (undocumented)
    • transform

      public Dataset<Row> transform(Dataset<?> dataset)
      Description copied from class: Transformer
      Transforms the input dataset.
      Specified by:
      transform in class Transformer
      Parameters:
      dataset - (undocumented)
      Returns:
      (undocumented)