Class LogisticRegressionModel
- All Implemented Interfaces:
- Serializable,- ClassificationModel,- PMMLExportable,- Saveable
param: weights Weights computed for every feature. param: intercept Intercept computed for this model. (Only used in Binary Logistic Regression. In Multinomial Logistic Regression, the intercepts will not be a single value, so the intercepts will be part of the weights.) param: numFeatures the dimension of the features. param: numClasses the number of possible outcomes for k classes classification problem in Multinomial Logistic Regression. By default, it is binary logistic regression so numClasses will be set to 2.
- See Also:
- 
Constructor SummaryConstructorsConstructorDescriptionLogisticRegressionModel(Vector weights, double intercept) Constructs aLogisticRegressionModelwith weights and intercept for binary classification.LogisticRegressionModel(Vector weights, double intercept, int numFeatures, int numClasses) 
- 
Method SummaryModifier and TypeMethodDescriptionClears the threshold so thatpredictwill output raw prediction scores.scala.Option<Object>Returns the threshold (if any) used for converting raw prediction scores into 0/1 predictions.doublestatic LogisticRegressionModelload(SparkContext sc, String path) intintvoidsave(SparkContext sc, String path) Save this model to the given path.setThreshold(double threshold) Sets the threshold that separates positive predictions from negative predictions in Binary Logistic Regression.toString()Print a summary of the model.weights()Methods inherited from class org.apache.spark.mllib.regression.GeneralizedLinearModelpredict, predictMethods inherited from class java.lang.Objectequals, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface org.apache.spark.mllib.classification.ClassificationModelpredict, predict, predict
- 
Constructor Details- 
LogisticRegressionModel
- 
LogisticRegressionModelConstructs aLogisticRegressionModelwith weights and intercept for binary classification.- Parameters:
- weights- (undocumented)
- intercept- (undocumented)
 
 
- 
- 
Method Details- 
load
- 
weights- Overrides:
- weightsin class- GeneralizedLinearModel
 
- 
interceptpublic double intercept()- Overrides:
- interceptin class- GeneralizedLinearModel
 
- 
numFeaturespublic int numFeatures()
- 
numClassespublic int numClasses()
- 
setThresholdSets the threshold that separates positive predictions from negative predictions in Binary Logistic Regression. An example with prediction score greater than or equal to this threshold is identified as a positive, and negative otherwise. The default value is 0.5. It is only used for binary classification.- Parameters:
- threshold- (undocumented)
- Returns:
- (undocumented)
 
- 
getThresholdReturns the threshold (if any) used for converting raw prediction scores into 0/1 predictions. It is only used for binary classification.- Returns:
- (undocumented)
 
- 
clearThresholdClears the threshold so thatpredictwill output raw prediction scores. It is only used for binary classification.- Returns:
- (undocumented)
 
- 
saveDescription copied from interface:SaveableSave this model to the given path.This saves: - human-readable (JSON) model metadata to path/metadata/ - Parquet formatted data to path/data/ The model may be loaded using Loader.load.
- 
toStringDescription copied from class:GeneralizedLinearModelPrint a summary of the model.- Overrides:
- toStringin class- GeneralizedLinearModel
- Returns:
- (undocumented)
 
 
-