Interface LogisticRegressionParams

All Superinterfaces:
ClassifierParams, HasAggregationDepth, HasElasticNetParam, HasFeaturesCol, HasFitIntercept, HasLabelCol, HasMaxBlockSizeInMB, HasMaxIter, HasPredictionCol, HasProbabilityCol, HasRawPredictionCol, HasRegParam, HasStandardization, HasThreshold, HasThresholds, HasTol, HasWeightCol, Identifiable, Params, PredictorParams, ProbabilisticClassifierParams, Serializable, scala.Serializable
All Known Implementing Classes:
LogisticRegression, LogisticRegressionModel

Params for logistic regression.
  • Method Details

    • checkThresholdConsistency

      void checkThresholdConsistency()
      If threshold and thresholds are both set, ensures they are consistent.

      Throws:
      IllegalArgumentException - if threshold and thresholds are not equivalent
    • family

      Param<String> family()
      Param for the name of family which is a description of the label distribution to be used in the model. Supported options: - "auto": Automatically select the family based on the number of classes: If numClasses == 1 || numClasses == 2, set to "binomial". Else, set to "multinomial" - "binomial": Binary logistic regression with pivoting. - "multinomial": Multinomial logistic (softmax) regression without pivoting. Default is "auto".

      Returns:
      (undocumented)
    • getFamily

      String getFamily()
    • getLowerBoundsOnCoefficients

      Matrix getLowerBoundsOnCoefficients()
    • getLowerBoundsOnIntercepts

      Vector getLowerBoundsOnIntercepts()
    • getThreshold

      double getThreshold()
      Get threshold for binary classification.

      If thresholds is set with length 2 (i.e., binary classification), this returns the equivalent threshold:

      1 / (1 + thresholds(0) / thresholds(1))
      . Otherwise, returns `threshold` if set, or its default value if unset. @group getParam @throws IllegalArgumentException if `thresholds` is set to an array of length other than 2.
      Specified by:
      getThreshold in interface HasThreshold
      Returns:
      (undocumented)
    • getThresholds

      double[] getThresholds()
      Get thresholds for binary or multiclass classification.

      If thresholds is set, return its value. Otherwise, if threshold is set, return the equivalent thresholds for binary classification: (1-threshold, threshold). If neither are set, throw an exception.

      Specified by:
      getThresholds in interface HasThresholds
      Returns:
      (undocumented)
    • getUpperBoundsOnCoefficients

      Matrix getUpperBoundsOnCoefficients()
    • getUpperBoundsOnIntercepts

      Vector getUpperBoundsOnIntercepts()
    • lowerBoundsOnCoefficients

      Param<Matrix> lowerBoundsOnCoefficients()
      The lower bounds on coefficients if fitting under bound constrained optimization. The bound matrix must be compatible with the shape (1, number of features) for binomial regression, or (number of classes, number of features) for multinomial regression. Otherwise, it throws exception. Default is none.

      Returns:
      (undocumented)
    • lowerBoundsOnIntercepts

      Param<Vector> lowerBoundsOnIntercepts()
      The lower bounds on intercepts if fitting under bound constrained optimization. The bounds vector size must be equal to 1 for binomial regression, or the number of classes for multinomial regression. Otherwise, it throws exception. Default is none.

      Returns:
      (undocumented)
    • setThreshold

      LogisticRegressionParams setThreshold(double value)
      Set threshold in binary classification, in range [0, 1].

      If the estimated probability of class label 1 is greater than threshold, then predict 1, else 0. A high threshold encourages the model to predict 0 more often; a low threshold encourages the model to predict 1 more often.

      Note: Calling this with threshold p is equivalent to calling setThresholds(Array(1-p, p)). When setThreshold() is called, any user-set value for thresholds will be cleared. If both threshold and thresholds are set in a ParamMap, then they must be equivalent.

      Default is 0.5.

      Parameters:
      value - (undocumented)
      Returns:
      (undocumented)
    • setThresholds

      LogisticRegressionParams setThresholds(double[] value)
      Set thresholds in multiclass (or binary) classification to adjust the probability of predicting each class. Array must have length equal to the number of classes, with values greater than 0, excepting that at most one value may be 0. The class with largest value p/t is predicted, where p is the original probability of that class and t is the class's threshold.

      Note: When setThresholds() is called, any user-set value for threshold will be cleared. If both threshold and thresholds are set in a ParamMap, then they must be equivalent.

      Parameters:
      value - (undocumented)
      Returns:
      (undocumented)
    • upperBoundsOnCoefficients

      Param<Matrix> upperBoundsOnCoefficients()
      The upper bounds on coefficients if fitting under bound constrained optimization. The bound matrix must be compatible with the shape (1, number of features) for binomial regression, or (number of classes, number of features) for multinomial regression. Otherwise, it throws exception. Default is none.

      Returns:
      (undocumented)
    • upperBoundsOnIntercepts

      Param<Vector> upperBoundsOnIntercepts()
      The upper bounds on intercepts if fitting under bound constrained optimization. The bound vector size must be equal to 1 for binomial regression, or the number of classes for multinomial regression. Otherwise, it throws exception. Default is none.

      Returns:
      (undocumented)
    • usingBoundConstrainedOptimization

      boolean usingBoundConstrainedOptimization()
    • validateAndTransformSchema

      StructType validateAndTransformSchema(StructType schema, boolean fitting, DataType featuresDataType)
      Description copied from interface: PredictorParams
      Validates and transforms the input schema with the provided param map.

      Specified by:
      validateAndTransformSchema in interface ClassifierParams
      Specified by:
      validateAndTransformSchema in interface PredictorParams
      Specified by:
      validateAndTransformSchema in interface ProbabilisticClassifierParams
      Parameters:
      schema - input schema
      fitting - whether this is in fitting
      featuresDataType - SQL DataType for FeaturesType. E.g., VectorUDT for vector features.
      Returns:
      output schema