org.apache.spark.mllib.regression
Class LinearRegressionModel

Object
  extended by org.apache.spark.mllib.regression.GeneralizedLinearModel
      extended by org.apache.spark.mllib.regression.LinearRegressionModel
All Implemented Interfaces:
java.io.Serializable, PMMLExportable, RegressionModel, Saveable

public class LinearRegressionModel
extends GeneralizedLinearModel
implements RegressionModel, scala.Serializable, Saveable, PMMLExportable

Regression model trained using LinearRegression.

param: weights Weights computed for every feature. param: intercept Intercept computed for this model.

See Also:
Serialized Form

Constructor Summary
LinearRegressionModel(Vector weights, double intercept)
           
 
Method Summary
 double intercept()
           
static LinearRegressionModel load(SparkContext sc, String path)
           
 void save(SparkContext sc, String path)
          Save this model to the given path.
 Vector weights()
           
 
Methods inherited from class org.apache.spark.mllib.regression.GeneralizedLinearModel
predict, predict, toString
 
Methods inherited from class Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface org.apache.spark.mllib.regression.RegressionModel
predict, predict, predict
 
Methods inherited from interface org.apache.spark.mllib.pmml.PMMLExportable
toPMML, toPMML, toPMML, toPMML, toPMML
 

Constructor Detail

LinearRegressionModel

public LinearRegressionModel(Vector weights,
                             double intercept)
Method Detail

load

public static LinearRegressionModel load(SparkContext sc,
                                         String path)

weights

public Vector weights()
Overrides:
weights in class GeneralizedLinearModel

intercept

public double intercept()
Overrides:
intercept in class GeneralizedLinearModel

save

public void save(SparkContext sc,
                 String path)
Description copied from interface: Saveable
Save 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.

Specified by:
save in interface Saveable
Parameters:
sc - Spark context used to save model data.
path - Path specifying the directory in which to save this model. If the directory already exists, this method throws an exception.