Interface RFormulaBase

All Superinterfaces:
HasFeaturesCol, HasHandleInvalid, HasLabelCol, Identifiable, Params, Serializable
All Known Implementing Classes:
RFormula, RFormulaModel

public interface RFormulaBase extends HasFeaturesCol, HasLabelCol, HasHandleInvalid
Base trait for RFormula and RFormulaModel.
  • Method Details

    • forceIndexLabel

      BooleanParam forceIndexLabel()
      Force to index label whether it is numeric or string type. Usually we index label only when it is string type. If the formula was used by classification algorithms, we can force to index label even it is numeric type by setting this param with true. Default: false.
      Returns:
      (undocumented)
    • formula

      Param<String> formula()
      R formula parameter. The formula is provided in string form.
      Returns:
      (undocumented)
    • getForceIndexLabel

      boolean getForceIndexLabel()
    • getFormula

      String getFormula()
    • getStringIndexerOrderType

      String getStringIndexerOrderType()
    • handleInvalid

      Param<String> handleInvalid()
      Param for how to handle invalid data (unseen or NULL values) in features and label column of string type. Options are 'skip' (filter out rows with invalid data), 'error' (throw an error), or 'keep' (put invalid data in a special additional bucket, at index numLabels). Default: "error"
      Specified by:
      handleInvalid in interface HasHandleInvalid
      Returns:
      (undocumented)
    • hasLabelCol

      boolean hasLabelCol(StructType schema)
    • stringIndexerOrderType

      Param<String> stringIndexerOrderType()
      Param for how to order categories of a string FEATURE column used by StringIndexer. The last category after ordering is dropped when encoding strings. Supported options: 'frequencyDesc', 'frequencyAsc', 'alphabetDesc', 'alphabetAsc'. The default value is 'frequencyDesc'. When the ordering is set to 'alphabetDesc', RFormula drops the same category as R when encoding strings.

      The options are explained using an example 'b', 'a', 'b', 'a', 'c', 'b':

      
       +-----------------+---------------------------------------+----------------------------------+
       |      Option     | Category mapped to 0 by StringIndexer |  Category dropped by RFormula    |
       +-----------------+---------------------------------------+----------------------------------+
       | 'frequencyDesc' | most frequent category ('b')          | least frequent category ('c')    |
       | 'frequencyAsc'  | least frequent category ('c')         | most frequent category ('b')     |
       | 'alphabetDesc'  | last alphabetical category ('c')      | first alphabetical category ('a')|
       | 'alphabetAsc'   | first alphabetical category ('a')     | last alphabetical category ('c') |
       +-----------------+---------------------------------------+----------------------------------+
       
      Note that this ordering option is NOT used for the label column. When the label column is indexed, it uses the default descending frequency ordering in StringIndexer.

      Returns:
      (undocumented)