LogisticRegressionParams (Spark 3.5.5 JavaDoc) (original) (raw)
- All Superinterfaces:
ClassifierParams, HasAggregationDepth, HasElasticNetParam, HasFeaturesCol, HasFitIntercept, HasLabelCol, HasMaxBlockSizeInMB, HasMaxIter, HasPredictionCol, HasProbabilityCol, HasRawPredictionCol, HasRegParam, HasStandardization, HasThreshold, HasThresholds, HasTol, HasWeightCol, Identifiable, Params, PredictorParams, ProbabilisticClassifierParams, java.io.Serializable
All Known Implementing Classes:
LogisticRegression, LogisticRegressionModel
public interface LogisticRegressionParams
extends ProbabilisticClassifierParams, HasRegParam, HasElasticNetParam, HasMaxIter, HasFitIntercept, HasTol, HasStandardization, HasWeightCol, HasThreshold, HasAggregationDepth, HasMaxBlockSizeInMB
Params for logistic regression.
Method Summary
All Methods Instance Methods Abstract Methods
Modifier and Type Method and Description void checkThresholdConsistency() If threshold and thresholds are both set, ensures they are consistent. Param family() Param for the name of family which is a description of the label distribution to be used in the model. String getFamily() Matrix getLowerBoundsOnCoefficients() Vector getLowerBoundsOnIntercepts() double getThreshold() Get threshold for binary classification. double[] getThresholds() Get thresholds for binary or multiclass classification. Matrix getUpperBoundsOnCoefficients() Vector getUpperBoundsOnIntercepts() Param<Matrix> lowerBoundsOnCoefficients() The lower bounds on coefficients if fitting under bound constrained optimization. Param<Vector> lowerBoundsOnIntercepts() The lower bounds on intercepts if fitting under bound constrained optimization. LogisticRegressionParams setThreshold(double value) Set threshold in binary classification, in range [0, 1]. LogisticRegressionParams setThresholds(double[] value) Set thresholds in multiclass (or binary) classification to adjust the probability of predicting each class. Param<Matrix> upperBoundsOnCoefficients() The upper bounds on coefficients if fitting under bound constrained optimization. Param<Vector> upperBoundsOnIntercepts() The upper bounds on intercepts if fitting under bound constrained optimization. boolean usingBoundConstrainedOptimization() StructType validateAndTransformSchema(StructType schema, boolean fitting,DataType featuresDataType) Validates and transforms the input schema with the provided param map. * ### Methods inherited from interface org.apache.spark.ml.param.shared.[HasLabelCol](../../../../../org/apache/spark/ml/param/shared/HasLabelCol.html "interface in org.apache.spark.ml.param.shared") `[getLabelCol](../../../../../org/apache/spark/ml/param/shared/HasLabelCol.html#getLabelCol--), [labelCol](../../../../../org/apache/spark/ml/param/shared/HasLabelCol.html#labelCol--)` * ### Methods inherited from interface org.apache.spark.ml.param.shared.[HasFeaturesCol](../../../../../org/apache/spark/ml/param/shared/HasFeaturesCol.html "interface in org.apache.spark.ml.param.shared") `[featuresCol](../../../../../org/apache/spark/ml/param/shared/HasFeaturesCol.html#featuresCol--), [getFeaturesCol](../../../../../org/apache/spark/ml/param/shared/HasFeaturesCol.html#getFeaturesCol--)` * ### Methods inherited from interface org.apache.spark.ml.param.shared.[HasPredictionCol](../../../../../org/apache/spark/ml/param/shared/HasPredictionCol.html "interface in org.apache.spark.ml.param.shared") `[getPredictionCol](../../../../../org/apache/spark/ml/param/shared/HasPredictionCol.html#getPredictionCol--), [predictionCol](../../../../../org/apache/spark/ml/param/shared/HasPredictionCol.html#predictionCol--)` * ### Methods inherited from interface org.apache.spark.ml.param.[Params](../../../../../org/apache/spark/ml/param/Params.html "interface in org.apache.spark.ml.param") `[clear](../../../../../org/apache/spark/ml/param/Params.html#clear-org.apache.spark.ml.param.Param-), [copy](../../../../../org/apache/spark/ml/param/Params.html#copy-org.apache.spark.ml.param.ParamMap-), [copyValues](../../../../../org/apache/spark/ml/param/Params.html#copyValues-T-org.apache.spark.ml.param.ParamMap-), [defaultCopy](../../../../../org/apache/spark/ml/param/Params.html#defaultCopy-org.apache.spark.ml.param.ParamMap-), [defaultParamMap](../../../../../org/apache/spark/ml/param/Params.html#defaultParamMap--), [explainParam](../../../../../org/apache/spark/ml/param/Params.html#explainParam-org.apache.spark.ml.param.Param-), [explainParams](../../../../../org/apache/spark/ml/param/Params.html#explainParams--), [extractParamMap](../../../../../org/apache/spark/ml/param/Params.html#extractParamMap--), [extractParamMap](../../../../../org/apache/spark/ml/param/Params.html#extractParamMap-org.apache.spark.ml.param.ParamMap-), [get](../../../../../org/apache/spark/ml/param/Params.html#get-org.apache.spark.ml.param.Param-), [getDefault](../../../../../org/apache/spark/ml/param/Params.html#getDefault-org.apache.spark.ml.param.Param-), [getOrDefault](../../../../../org/apache/spark/ml/param/Params.html#getOrDefault-org.apache.spark.ml.param.Param-), [getParam](../../../../../org/apache/spark/ml/param/Params.html#getParam-java.lang.String-), [hasDefault](../../../../../org/apache/spark/ml/param/Params.html#hasDefault-org.apache.spark.ml.param.Param-), [hasParam](../../../../../org/apache/spark/ml/param/Params.html#hasParam-java.lang.String-), [isDefined](../../../../../org/apache/spark/ml/param/Params.html#isDefined-org.apache.spark.ml.param.Param-), [isSet](../../../../../org/apache/spark/ml/param/Params.html#isSet-org.apache.spark.ml.param.Param-), [onParamChange](../../../../../org/apache/spark/ml/param/Params.html#onParamChange-org.apache.spark.ml.param.Param-), [paramMap](../../../../../org/apache/spark/ml/param/Params.html#paramMap--), [params](../../../../../org/apache/spark/ml/param/Params.html#params--), [set](../../../../../org/apache/spark/ml/param/Params.html#set-org.apache.spark.ml.param.Param-T-), [set](../../../../../org/apache/spark/ml/param/Params.html#set-org.apache.spark.ml.param.ParamPair-), [set](../../../../../org/apache/spark/ml/param/Params.html#set-java.lang.String-java.lang.Object-), [setDefault](../../../../../org/apache/spark/ml/param/Params.html#setDefault-org.apache.spark.ml.param.Param-T-), [setDefault](../../../../../org/apache/spark/ml/param/Params.html#setDefault-scala.collection.Seq-), [shouldOwn](../../../../../org/apache/spark/ml/param/Params.html#shouldOwn-org.apache.spark.ml.param.Param-)` * ### Methods inherited from interface org.apache.spark.ml.util.[Identifiable](../../../../../org/apache/spark/ml/util/Identifiable.html "interface in org.apache.spark.ml.util") `[toString](../../../../../org/apache/spark/ml/util/Identifiable.html#toString--), [uid](../../../../../org/apache/spark/ml/util/Identifiable.html#uid--)` * ### Methods inherited from interface org.apache.spark.ml.param.shared.[HasRawPredictionCol](../../../../../org/apache/spark/ml/param/shared/HasRawPredictionCol.html "interface in org.apache.spark.ml.param.shared") `[getRawPredictionCol](../../../../../org/apache/spark/ml/param/shared/HasRawPredictionCol.html#getRawPredictionCol--), [rawPredictionCol](../../../../../org/apache/spark/ml/param/shared/HasRawPredictionCol.html#rawPredictionCol--)` * ### Methods inherited from interface org.apache.spark.ml.param.shared.[HasProbabilityCol](../../../../../org/apache/spark/ml/param/shared/HasProbabilityCol.html "interface in org.apache.spark.ml.param.shared") `[getProbabilityCol](../../../../../org/apache/spark/ml/param/shared/HasProbabilityCol.html#getProbabilityCol--), [probabilityCol](../../../../../org/apache/spark/ml/param/shared/HasProbabilityCol.html#probabilityCol--)` * ### Methods inherited from interface org.apache.spark.ml.param.shared.[HasThresholds](../../../../../org/apache/spark/ml/param/shared/HasThresholds.html "interface in org.apache.spark.ml.param.shared") `[thresholds](../../../../../org/apache/spark/ml/param/shared/HasThresholds.html#thresholds--)` * ### Methods inherited from interface org.apache.spark.ml.param.shared.[HasRegParam](../../../../../org/apache/spark/ml/param/shared/HasRegParam.html "interface in org.apache.spark.ml.param.shared") `[getRegParam](../../../../../org/apache/spark/ml/param/shared/HasRegParam.html#getRegParam--), [regParam](../../../../../org/apache/spark/ml/param/shared/HasRegParam.html#regParam--)` * ### Methods inherited from interface org.apache.spark.ml.param.shared.[HasElasticNetParam](../../../../../org/apache/spark/ml/param/shared/HasElasticNetParam.html "interface in org.apache.spark.ml.param.shared") `[elasticNetParam](../../../../../org/apache/spark/ml/param/shared/HasElasticNetParam.html#elasticNetParam--), [getElasticNetParam](../../../../../org/apache/spark/ml/param/shared/HasElasticNetParam.html#getElasticNetParam--)` * ### Methods inherited from interface org.apache.spark.ml.param.shared.[HasMaxIter](../../../../../org/apache/spark/ml/param/shared/HasMaxIter.html "interface in org.apache.spark.ml.param.shared") `[getMaxIter](../../../../../org/apache/spark/ml/param/shared/HasMaxIter.html#getMaxIter--), [maxIter](../../../../../org/apache/spark/ml/param/shared/HasMaxIter.html#maxIter--)` * ### Methods inherited from interface org.apache.spark.ml.param.shared.[HasFitIntercept](../../../../../org/apache/spark/ml/param/shared/HasFitIntercept.html "interface in org.apache.spark.ml.param.shared") `[fitIntercept](../../../../../org/apache/spark/ml/param/shared/HasFitIntercept.html#fitIntercept--), [getFitIntercept](../../../../../org/apache/spark/ml/param/shared/HasFitIntercept.html#getFitIntercept--)` * ### Methods inherited from interface org.apache.spark.ml.param.shared.[HasTol](../../../../../org/apache/spark/ml/param/shared/HasTol.html "interface in org.apache.spark.ml.param.shared") `[getTol](../../../../../org/apache/spark/ml/param/shared/HasTol.html#getTol--), [tol](../../../../../org/apache/spark/ml/param/shared/HasTol.html#tol--)` * ### Methods inherited from interface org.apache.spark.ml.param.shared.[HasStandardization](../../../../../org/apache/spark/ml/param/shared/HasStandardization.html "interface in org.apache.spark.ml.param.shared") `[getStandardization](../../../../../org/apache/spark/ml/param/shared/HasStandardization.html#getStandardization--), [standardization](../../../../../org/apache/spark/ml/param/shared/HasStandardization.html#standardization--)` * ### Methods inherited from interface org.apache.spark.ml.param.shared.[HasWeightCol](../../../../../org/apache/spark/ml/param/shared/HasWeightCol.html "interface in org.apache.spark.ml.param.shared") `[getWeightCol](../../../../../org/apache/spark/ml/param/shared/HasWeightCol.html#getWeightCol--), [weightCol](../../../../../org/apache/spark/ml/param/shared/HasWeightCol.html#weightCol--)` * ### Methods inherited from interface org.apache.spark.ml.param.shared.[HasThreshold](../../../../../org/apache/spark/ml/param/shared/HasThreshold.html "interface in org.apache.spark.ml.param.shared") `[threshold](../../../../../org/apache/spark/ml/param/shared/HasThreshold.html#threshold--)` * ### Methods inherited from interface org.apache.spark.ml.param.shared.[HasAggregationDepth](../../../../../org/apache/spark/ml/param/shared/HasAggregationDepth.html "interface in org.apache.spark.ml.param.shared") `[aggregationDepth](../../../../../org/apache/spark/ml/param/shared/HasAggregationDepth.html#aggregationDepth--), [getAggregationDepth](../../../../../org/apache/spark/ml/param/shared/HasAggregationDepth.html#getAggregationDepth--)` * ### Methods inherited from interface org.apache.spark.ml.param.shared.[HasMaxBlockSizeInMB](../../../../../org/apache/spark/ml/param/shared/HasMaxBlockSizeInMB.html "interface in org.apache.spark.ml.param.shared") `[getMaxBlockSizeInMB](../../../../../org/apache/spark/ml/param/shared/HasMaxBlockSizeInMB.html#getMaxBlockSizeInMB--), [maxBlockSizeInMB](../../../../../org/apache/spark/ml/param/shared/HasMaxBlockSizeInMB.html#maxBlockSizeInMB--)`
Method Detail
* #### 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](../../../../../org/apache/spark/ml/param/Param.html "class in org.apache.spark.ml.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](../../../../../org/apache/spark/ml/linalg/Matrix.html "interface in org.apache.spark.ml.linalg") getLowerBoundsOnCoefficients() * #### getLowerBoundsOnIntercepts [Vector](../../../../../org/apache/spark/ml/linalg/Vector.html "interface in org.apache.spark.ml.linalg") 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](../../../../../org/apache/spark/ml/param/shared/HasThreshold.html#getThreshold--)` in interface `[HasThreshold](../../../../../org/apache/spark/ml/param/shared/HasThreshold.html "interface in org.apache.spark.ml.param.shared")` 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](../../../../../org/apache/spark/ml/param/shared/HasThresholds.html#getThresholds--)` in interface `[HasThresholds](../../../../../org/apache/spark/ml/param/shared/HasThresholds.html "interface in org.apache.spark.ml.param.shared")` Returns: (undocumented) * #### getUpperBoundsOnCoefficients [Matrix](../../../../../org/apache/spark/ml/linalg/Matrix.html "interface in org.apache.spark.ml.linalg") getUpperBoundsOnCoefficients() * #### getUpperBoundsOnIntercepts [Vector](../../../../../org/apache/spark/ml/linalg/Vector.html "interface in org.apache.spark.ml.linalg") getUpperBoundsOnIntercepts() * #### lowerBoundsOnCoefficients [Param](../../../../../org/apache/spark/ml/param/Param.html "class in org.apache.spark.ml.param")<[Matrix](../../../../../org/apache/spark/ml/linalg/Matrix.html "interface in org.apache.spark.ml.linalg")> 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](../../../../../org/apache/spark/ml/param/Param.html "class in org.apache.spark.ml.param")<[Vector](../../../../../org/apache/spark/ml/linalg/Vector.html "interface in org.apache.spark.ml.linalg")> 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](../../../../../org/apache/spark/ml/classification/LogisticRegressionParams.html "interface in org.apache.spark.ml.classification") 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](../../../../../org/apache/spark/ml/classification/LogisticRegressionParams.html "interface in org.apache.spark.ml.classification") 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](../../../../../org/apache/spark/ml/param/Param.html "class in org.apache.spark.ml.param")<[Matrix](../../../../../org/apache/spark/ml/linalg/Matrix.html "interface in org.apache.spark.ml.linalg")> 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](../../../../../org/apache/spark/ml/param/Param.html "class in org.apache.spark.ml.param")<[Vector](../../../../../org/apache/spark/ml/linalg/Vector.html "interface in org.apache.spark.ml.linalg")> 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](../../../../../org/apache/spark/sql/types/StructType.html "class in org.apache.spark.sql.types") validateAndTransformSchema([StructType](../../../../../org/apache/spark/sql/types/StructType.html "class in org.apache.spark.sql.types") schema, boolean fitting, [DataType](../../../../../org/apache/spark/sql/types/DataType.html "class in org.apache.spark.sql.types") featuresDataType) Validates and transforms the input schema with the provided param map. Specified by: `[validateAndTransformSchema](../../../../../org/apache/spark/ml/classification/ClassifierParams.html#validateAndTransformSchema-org.apache.spark.sql.types.StructType-boolean-org.apache.spark.sql.types.DataType-)` in interface `[ClassifierParams](../../../../../org/apache/spark/ml/classification/ClassifierParams.html "interface in org.apache.spark.ml.classification")` Specified by: `[validateAndTransformSchema](../../../../../org/apache/spark/ml/PredictorParams.html#validateAndTransformSchema-org.apache.spark.sql.types.StructType-boolean-org.apache.spark.sql.types.DataType-)` in interface `[PredictorParams](../../../../../org/apache/spark/ml/PredictorParams.html "interface in org.apache.spark.ml")` Specified by: `[validateAndTransformSchema](../../../../../org/apache/spark/ml/classification/ProbabilisticClassifierParams.html#validateAndTransformSchema-org.apache.spark.sql.types.StructType-boolean-org.apache.spark.sql.types.DataType-)` in interface `[ProbabilisticClassifierParams](../../../../../org/apache/spark/ml/classification/ProbabilisticClassifierParams.html "interface in org.apache.spark.ml.classification")` Parameters: `schema` \- input schema `fitting` \- whether this is in fitting `featuresDataType` \- SQL DataType for FeaturesType. E.g., `VectorUDT` for vector features. Returns: output schema