public class LogisticRegressionModel extends GeneralizedLinearModel implements ClassificationModel, scala.Serializable, Saveable
Constructor and Description |
---|
LogisticRegressionModel(Vector weights,
double intercept)
Constructs a
LogisticRegressionModel with weights and intercept for binary classification. |
LogisticRegressionModel(Vector weights,
double intercept,
int numFeatures,
int numClasses) |
Modifier and Type | Method and Description |
---|---|
LogisticRegressionModel |
clearThreshold()
:: Experimental ::
Clears the threshold so that
predict will output raw prediction scores. |
scala.Option<Object> |
getThreshold()
:: Experimental ::
Returns the threshold (if any) used for converting raw prediction scores into 0/1 predictions.
|
double |
intercept() |
static LogisticRegressionModel |
load(SparkContext sc,
String path) |
int |
numClasses() |
int |
numFeatures() |
void |
save(SparkContext sc,
String path)
Save this model to the given path.
|
LogisticRegressionModel |
setThreshold(double threshold)
:: Experimental ::
Sets the threshold that separates positive predictions from negative predictions
in Binary Logistic Regression.
|
Vector |
weights() |
predict, predict, toString
predict, predict, predict
public LogisticRegressionModel(Vector weights, double intercept, int numFeatures, int numClasses)
public LogisticRegressionModel(Vector weights, double intercept)
LogisticRegressionModel
with weights and intercept for binary classification.public static LogisticRegressionModel load(SparkContext sc, String path)
public Vector weights()
weights
in class GeneralizedLinearModel
public double intercept()
intercept
in class GeneralizedLinearModel
public int numFeatures()
public int numClasses()
public LogisticRegressionModel setThreshold(double threshold)
public scala.Option<Object> getThreshold()
public LogisticRegressionModel clearThreshold()
predict
will output raw prediction scores.public void save(SparkContext sc, String path)
Saveable
This saves: - human-readable (JSON) model metadata to path/metadata/ - Parquet formatted data to path/data/
The model may be loaded using Loader.load
.