public class LinearRegressionModel extends GeneralizedLinearModel implements RegressionModel, scala.Serializable, Saveable, PMMLExportable
param: weights Weights computed for every feature. param: intercept Intercept computed for this model.
| Constructor and Description |
|---|
LinearRegressionModel(Vector weights,
double intercept) |
| Modifier and Type | Method and Description |
|---|---|
protected java.lang.String |
formatVersion()
Current version of model save/load format.
|
double |
intercept() |
static LinearRegressionModel |
load(SparkContext sc,
java.lang.String path) |
protected double |
predictPoint(Vector dataMatrix,
Vector weightMatrix,
double intercept)
Predict the result given a data point and the weights learned.
|
void |
save(SparkContext sc,
java.lang.String path)
Save this model to the given path.
|
Vector |
weights() |
predict, predict, toStringclone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitpredict, predict, predictpublic LinearRegressionModel(Vector weights, double intercept)
public static LinearRegressionModel load(SparkContext sc, java.lang.String path)
public Vector weights()
weights in class GeneralizedLinearModelpublic double intercept()
intercept in class GeneralizedLinearModelprotected double predictPoint(Vector dataMatrix, Vector weightMatrix, double intercept)
GeneralizedLinearModelpredictPoint in class GeneralizedLinearModeldataMatrix - Row vector containing the features for this data pointweightMatrix - Column vector containing the weights of the modelintercept - Intercept of the model.public void save(SparkContext sc, java.lang.String path)
SaveableThis saves: - human-readable (JSON) model metadata to path/metadata/ - Parquet formatted data to path/data/
The model may be loaded using Loader.load.
protected java.lang.String formatVersion()
SaveableformatVersion in interface Saveable