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
- All Known Implementing Classes:
LogisticRegression,LogisticRegressionModel
-
Method Summary
Modifier and TypeMethodDescriptionvoidIfthresholdandthresholdsare both set, ensures they are consistent.family()Param for the name of family which is a description of the label distribution to be used in the model.doubleGet threshold for binary classification.double[]Get thresholds for binary or multiclass classification.The lower bounds on coefficients if fitting under bound constrained optimization.The lower bounds on intercepts if fitting under bound constrained optimization.setThreshold(double value) Set threshold in binary classification, in range [0, 1].setThresholds(double[] value) Set thresholds in multiclass (or binary) classification to adjust the probability of predicting each class.The upper bounds on coefficients if fitting under bound constrained optimization.The upper bounds on intercepts if fitting under bound constrained optimization.booleanvalidateAndTransformSchema(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.HasAggregationDepth
aggregationDepth, getAggregationDepthMethods inherited from interface org.apache.spark.ml.param.shared.HasElasticNetParam
elasticNetParam, getElasticNetParamMethods inherited from interface org.apache.spark.ml.param.shared.HasFeaturesCol
featuresCol, getFeaturesColMethods inherited from interface org.apache.spark.ml.param.shared.HasFitIntercept
fitIntercept, getFitInterceptMethods inherited from interface org.apache.spark.ml.param.shared.HasLabelCol
getLabelCol, labelColMethods inherited from interface org.apache.spark.ml.param.shared.HasMaxBlockSizeInMB
getMaxBlockSizeInMB, maxBlockSizeInMBMethods inherited from interface org.apache.spark.ml.param.shared.HasMaxIter
getMaxIter, maxIterMethods inherited from interface org.apache.spark.ml.param.shared.HasPredictionCol
getPredictionCol, predictionColMethods inherited from interface org.apache.spark.ml.param.shared.HasProbabilityCol
getProbabilityCol, probabilityColMethods inherited from interface org.apache.spark.ml.param.shared.HasRawPredictionCol
getRawPredictionCol, rawPredictionColMethods inherited from interface org.apache.spark.ml.param.shared.HasRegParam
getRegParam, regParamMethods inherited from interface org.apache.spark.ml.param.shared.HasStandardization
getStandardization, standardizationMethods inherited from interface org.apache.spark.ml.param.shared.HasThreshold
thresholdMethods inherited from interface org.apache.spark.ml.param.shared.HasThresholds
thresholdsMethods inherited from interface org.apache.spark.ml.param.shared.HasWeightCol
getWeightCol, weightColMethods inherited from interface org.apache.spark.ml.util.Identifiable
toString, uidMethods inherited from interface org.apache.spark.ml.param.Params
clear, copy, copyValues, defaultCopy, defaultParamMap, estimateMatadataSize, explainParam, explainParams, extractParamMap, extractParamMap, get, getDefault, getOrDefault, getParam, hasDefault, hasParam, isDefined, isSet, onParamChange, paramMap, params, set, set, set, setDefault, setDefault, shouldOwn
-
Method Details
-
checkThresholdConsistency
void checkThresholdConsistency()Ifthresholdandthresholdsare both set, ensures they are consistent.- Throws:
IllegalArgumentException- ifthresholdandthresholdsare not equivalent
-
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
thresholdsis set with length 2 (i.e., binary classification), this returns the equivalent threshold:
. 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.1 / (1 + thresholds(0) / thresholds(1))- Specified by:
getThresholdin interfaceHasThreshold- Returns:
- (undocumented)
-
getThresholds
double[] getThresholds()Get thresholds for binary or multiclass classification.If
thresholdsis set, return its value. Otherwise, ifthresholdis set, return the equivalent thresholds for binary classification: (1-threshold, threshold). If neither are set, throw an exception.- Specified by:
getThresholdsin interfaceHasThresholds- Returns:
- (undocumented)
-
getUpperBoundsOnCoefficients
Matrix getUpperBoundsOnCoefficients() -
getUpperBoundsOnIntercepts
Vector getUpperBoundsOnIntercepts() -
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
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
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)). WhensetThreshold()is called, any user-set value forthresholdswill be cleared. If boththresholdandthresholdsare set in a ParamMap, then they must be equivalent.Default is 0.5.
- Parameters:
value- (undocumented)- Returns:
- (undocumented)
-
setThresholds
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 forthresholdwill be cleared. If boththresholdandthresholdsare set in a ParamMap, then they must be equivalent.- Parameters:
value- (undocumented)- Returns:
- (undocumented)
-
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
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:PredictorParamsValidates and transforms the input schema with the provided param map.- Specified by:
validateAndTransformSchemain interfaceClassifierParams- Specified by:
validateAndTransformSchemain interfacePredictorParams- Specified by:
validateAndTransformSchemain interfaceProbabilisticClassifierParams- Parameters:
schema- input schemafitting- whether this is in fittingfeaturesDataType- SQL DataType for FeaturesType. E.g.,VectorUDTfor vector features.- Returns:
- output schema
-